mirror of https://github.com/daffainfo/nuclei.git
adding bulk-size
parent
34656d177b
commit
a1cc52c3ff
|
@ -40,6 +40,7 @@ type Options struct {
|
|||
TemplatesDirectory string // TemplatesDirectory is the directory to use for storing templates
|
||||
RateLimit int // Rate-Limit of requests per specified target
|
||||
StopAtFirstMatch bool // Stop processing template at first full match (this may break chained requests)
|
||||
BulkSize int // Number of targets analyzed in parallel for each template
|
||||
}
|
||||
|
||||
type multiStringFlag []string
|
||||
|
@ -81,6 +82,7 @@ func ParseOptions() *Options {
|
|||
flag.BoolVar(&options.TemplateList, "tl", false, "List available templates")
|
||||
flag.IntVar(&options.RateLimit, "rate-limit", -1, "Per Target Rate-Limit")
|
||||
flag.BoolVar(&options.StopAtFirstMatch, "stop-at-first-match", false, "Stop processing http requests at first match (this may break template/workflow logic)")
|
||||
flag.IntVar(&options.BulkSize, "bulk-size", 150, "Number of hosts analyzed in parallel per template")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import (
|
|||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
tengo "github.com/d5/tengo/v2"
|
||||
"github.com/d5/tengo/v2/stdlib"
|
||||
|
@ -21,6 +20,7 @@ import (
|
|||
"github.com/projectdiscovery/nuclei/v2/pkg/requests"
|
||||
"github.com/projectdiscovery/nuclei/v2/pkg/templates"
|
||||
"github.com/projectdiscovery/nuclei/v2/pkg/workflows"
|
||||
"github.com/remeh/sizedwaitgroup"
|
||||
)
|
||||
|
||||
// workflowTemplates contains the initialized workflow templates per template group
|
||||
|
@ -79,12 +79,12 @@ func (r *Runner) processTemplateWithList(p progress.IProgress, template *templat
|
|||
|
||||
var globalresult atomicboolean.AtomBool
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg := sizedwaitgroup.New(r.options.BulkSize)
|
||||
|
||||
scanner := bufio.NewScanner(strings.NewReader(r.input))
|
||||
for scanner.Scan() {
|
||||
URL := scanner.Text()
|
||||
wg.Add(1)
|
||||
wg.Add()
|
||||
go func(URL string) {
|
||||
defer wg.Done()
|
||||
|
||||
|
@ -125,12 +125,12 @@ func (r *Runner) processWorkflowWithList(p progress.IProgress, workflow *workflo
|
|||
|
||||
logicBytes := []byte(workflow.Logic)
|
||||
|
||||
var wg sync.WaitGroup
|
||||
wg := sizedwaitgroup.New(r.options.BulkSize)
|
||||
|
||||
scanner := bufio.NewScanner(strings.NewReader(r.input))
|
||||
for scanner.Scan() {
|
||||
targetURL := scanner.Text()
|
||||
wg.Add(1)
|
||||
wg.Add()
|
||||
|
||||
go func(targetURL string) {
|
||||
defer wg.Done()
|
||||
|
|
Loading…
Reference in New Issue