mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-24 23:05:26 +00:00
* use parsed options while signing * update project layout to v3 * fix .gitignore * remove example template * misc updates * bump tlsx version * hide template sig warning with env * js: retain value while using log * fix nil pointer derefernce * misc doc update --------- Co-authored-by: sandeep <8293321+ehsandeep@users.noreply.github.com>
40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
package inputs
|
|
|
|
import (
|
|
"github.com/projectdiscovery/httpx/common/httpx"
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/contextargs"
|
|
"github.com/projectdiscovery/nuclei/v3/pkg/utils"
|
|
)
|
|
|
|
type SimpleInputProvider struct {
|
|
Inputs []*contextargs.MetaInput
|
|
}
|
|
|
|
// Count returns the number of items for input provider
|
|
func (s *SimpleInputProvider) Count() int64 {
|
|
return int64(len(s.Inputs))
|
|
}
|
|
|
|
// Scan calls a callback function till the input provider is exhausted
|
|
func (s *SimpleInputProvider) Scan(callback func(value *contextargs.MetaInput) bool) {
|
|
for _, v := range s.Inputs {
|
|
if !callback(v) {
|
|
return
|
|
}
|
|
}
|
|
}
|
|
|
|
// Set adds item to input provider
|
|
func (s *SimpleInputProvider) Set(value string) {
|
|
s.Inputs = append(s.Inputs, &contextargs.MetaInput{Input: value})
|
|
}
|
|
|
|
// SetWithProbe adds item to input provider with http probing
|
|
func (s *SimpleInputProvider) SetWithProbe(value string, httpxClient *httpx.HTTPX) {
|
|
valueToAppend := value
|
|
if result := utils.ProbeURL(value, httpxClient); result != "" {
|
|
valueToAppend = result
|
|
}
|
|
s.Inputs = append(s.Inputs, &contextargs.MetaInput{Input: valueToAppend})
|
|
}
|