diff --git a/README.md b/README.md index 490b60709b..de24dc24d5 100644 --- a/README.md +++ b/README.md @@ -286,6 +286,7 @@ RATE-LIMIT: -jsc, -js-concurrency int maximum number of javascript runtimes to be executed in parallel (default 120) -pc, -payload-concurrency int max payload concurrency for each template (default 25) -prc, -probe-concurrency int http probe concurrency with httpx (default 50) + -tlc, -template-loading-concurrency int maximum number of concurrent template loading operations (default 50) OPTIMIZATIONS: -timeout int time to wait in seconds before timeout (default 10) diff --git a/README_CN.md b/README_CN.md index 99f150e6e8..5fb4dd14e9 100644 --- a/README_CN.md +++ b/README_CN.md @@ -238,6 +238,7 @@ UNCOVER引擎: -c, -concurrency int 并行执行的最大模板数量(默认:25) -hbs, -headless-bulk-size int 每个模板并行运行的无头主机最大数量(默认:10) -headc, -headless-concurrency int 并行指定无头主机最大数量(默认:10) + -tlc, -template-loading-concurrency int 最大并发模板加载操作数(默认:50) 优化: diff --git a/README_ES.md b/README_ES.md index 27f60ee8b0..ec7949efef 100644 --- a/README_ES.md +++ b/README_ES.md @@ -244,6 +244,7 @@ RATE-LIMIT: -headc, -headless-concurrency int número máximo de plantillas headless a ejecutar en paralelo (por defecto 10) -jsc, -js-concurrency int número máximo de entornos de ejecución de JavaScript a ejecutar en paralelo (por defecto 120) -pc, -payload-concurrency int concurrencia máxima de carga útil para cada plantilla (por defecto 25) + -tlc, -template-loading-concurrency int número máximo de operaciones de carga de plantillas concurrentes (por defecto 50) OPTIMIZATIONS: -timeout int tiempo de espera en segundos (por defecto 10) diff --git a/README_ID.md b/README_ID.md index 05c163c231..459352b4d5 100644 --- a/README_ID.md +++ b/README_ID.md @@ -211,6 +211,7 @@ RATE-LIMIT: -c, -concurrency int maximum number of templates to be executed in parallel (default 25) -hbs, -headless-bulk-size int maximum number of headless hosts to be analyzed in parallel per template (default 10) -headc, -headless-concurrency int maximum number of headless templates to be executed in parallel (default 10) + -tlc, -template-loading-concurrency int maximum number of concurrent template loading operations (default 50) OPTIMIZATIONS: -timeout int time to wait in seconds before timeout (default 10) diff --git a/README_KR.md b/README_KR.md index 6181c866b0..d0828564ab 100644 --- a/README_KR.md +++ b/README_KR.md @@ -209,6 +209,7 @@ RATE-LIMIT: -c, -concurrency int 병렬로 실행할 최대 템플릿 수 (기본값 25) -hbs, -headless-bulk-size int 템플릿당 병렬로 분석할 최대 headless 호스트 수 (기본값 10) -headc, -headless-concurrency int 병렬로 실행할 최대 headless 템플릿 수 (기본값 10) + -tlc, -template-loading-concurrency int 최대 동시 템플릿 로딩 작업 수 (기본값 50) OPTIMIZATIONS: -timeout int 타임아웃 전에 기다릴 초 수 (기본값 10) diff --git a/README_PT-BR.md b/README_PT-BR.md index 012f878f70..e63a3d8a1e 100644 --- a/README_PT-BR.md +++ b/README_PT-BR.md @@ -244,6 +244,7 @@ RATE-LIMIT: -headc, -headless-concurrency int número máximo de templates headless a serem executados em paralelo (padrão 10) -jsc, -js-concurrency int número máximo de ambientes de execução de JavaScript a serem executados em paralelo (padrão 120) -pc, -payload-concurrency int concorrência máxima de payload para cada template (padrão 25) + -tlc, -template-loading-concurrency int número máximo de operações de carregamento de templates concorrentes (padrão 50) OPTIMIZATIONS: -timeout int tempo limite em segundos (padrão 10) diff --git a/cmd/nuclei/main.go b/cmd/nuclei/main.go index c08f52bfb3..188d3fba92 100644 --- a/cmd/nuclei/main.go +++ b/cmd/nuclei/main.go @@ -411,6 +411,7 @@ on extensive configurability, massive extensibility and ease of use.`) flagSet.IntVarP(&options.JsConcurrency, "js-concurrency", "jsc", 120, "maximum number of javascript runtimes to be executed in parallel"), flagSet.IntVarP(&options.PayloadConcurrency, "payload-concurrency", "pc", 25, "max payload concurrency for each template"), flagSet.IntVarP(&options.ProbeConcurrency, "probe-concurrency", "prc", 50, "http probe concurrency with httpx"), + flagSet.IntVarP(&options.TemplateLoadingConcurrency, "template-loading-concurrency", "tlc", types.DefaultTemplateLoadingConcurrency, "maximum number of concurrent template loading operations"), ) flagSet.CreateGroup("optimization", "Optimizations", flagSet.IntVar(&options.Timeout, "timeout", 10, "time to wait in seconds before timeout"), diff --git a/pkg/catalog/loader/loader.go b/pkg/catalog/loader/loader.go index b1887149d5..1a8fe57425 100644 --- a/pkg/catalog/loader/loader.go +++ b/pkg/catalog/loader/loader.go @@ -524,7 +524,11 @@ func (store *Store) LoadTemplatesWithTags(templatesList, tags []string) []*templ } } - wgLoadTemplates, errWg := syncutil.New(syncutil.WithSize(50)) + concurrency := store.config.ExecutorOptions.Options.TemplateLoadingConcurrency + if concurrency <= 0 { + concurrency = types.DefaultTemplateLoadingConcurrency + } + wgLoadTemplates, errWg := syncutil.New(syncutil.WithSize(concurrency)) if errWg != nil { panic("could not create wait group") } diff --git a/pkg/types/types.go b/pkg/types/types.go index 26e98ba69d..08ed924ffb 100644 --- a/pkg/types/types.go +++ b/pkg/types/types.go @@ -20,6 +20,8 @@ import ( unitutils "github.com/projectdiscovery/utils/unit" ) +const DefaultTemplateLoadingConcurrency = 50 + var ( // ErrNoMoreRequests is internal error to indicate that generator has no more requests to generate ErrNoMoreRequests = io.EOF @@ -429,6 +431,8 @@ type Options struct { PayloadConcurrency int // ProbeConcurrency is the number of concurrent http probes to run with httpx ProbeConcurrency int + // TemplateLoadingConcurrency is the number of concurrent template loading operations + TemplateLoadingConcurrency int // Dast only runs DAST templates DAST bool // DASTServer is the flag to start nuclei as a DAST server @@ -775,19 +779,20 @@ func (options *Options) HasClientCertificates() bool { // DefaultOptions returns default options for nuclei func DefaultOptions() *Options { return &Options{ - RateLimit: 150, - RateLimitDuration: time.Second, - BulkSize: 25, - TemplateThreads: 25, - HeadlessBulkSize: 10, - PayloadConcurrency: 25, - HeadlessTemplateThreads: 10, - ProbeConcurrency: 50, - Timeout: 5, - Retries: 1, - MaxHostError: 30, - ResponseReadSize: 10 * unitutils.Mega, - ResponseSaveSize: unitutils.Mega, + RateLimit: 150, + RateLimitDuration: time.Second, + BulkSize: 25, + TemplateThreads: 25, + HeadlessBulkSize: 10, + PayloadConcurrency: 25, + HeadlessTemplateThreads: 10, + ProbeConcurrency: 50, + TemplateLoadingConcurrency: DefaultTemplateLoadingConcurrency, + Timeout: 5, + Retries: 1, + MaxHostError: 30, + ResponseReadSize: 10 * unitutils.Mega, + ResponseSaveSize: unitutils.Mega, } }