2021-10-29 03:19:43 +05:30
|
|
|
package inputs
|
|
|
|
|
|
2022-11-09 14:18:56 +01:00
|
|
|
import "github.com/projectdiscovery/nuclei/v2/pkg/protocols/common/contextargs"
|
|
|
|
|
|
2021-10-29 03:19:43 +05:30
|
|
|
type SimpleInputProvider struct {
|
2022-11-09 14:18:56 +01:00
|
|
|
Inputs []*contextargs.MetaInput
|
2021-10-29 03:19:43 +05:30
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// 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
|
2022-11-09 14:18:56 +01:00
|
|
|
func (s *SimpleInputProvider) Scan(callback func(value *contextargs.MetaInput) bool) {
|
2021-10-29 03:19:43 +05:30
|
|
|
for _, v := range s.Inputs {
|
2022-10-20 17:23:00 +05:30
|
|
|
if !callback(v) {
|
|
|
|
|
return
|
|
|
|
|
}
|
2021-10-29 03:19:43 +05:30
|
|
|
}
|
|
|
|
|
}
|