Running Nuclei through the CLI on hundreds of targets
max-requests
is a metadata field under info section of template that contains maximum number of outgoing requests this template can make.
Below are some flags and options that directly affect the resource utilization of Nuclei:
payloads
field in template and usually sends multiple requests. This concurrency per template is controlled by threads: 10
value in template
But if threads
is not defined or missing (since it is optional), then nuclei will use -c
value to decide concurrency of requests per template
-hbs
(-headless-bulk-size) and -headc
(-headless-concurrency) flags are variants of -bs
and -c
flags specifically for headless templates since headless templates are resource intensive and run a headless browser in background.
flow
field and javascript protocol
Although javascript templates are few compared to http templates, but this provides a way to control the resource utilization of javascript templates.
Default value of this flag is 120 and is tested to be optimal with minimal resource utilization (Note: Nuclei by default reuses javascript runtimes to avoid overhead of creating new runtimes for each request)
payloads
field and does not have threads
field set, default of this flag is 25 and can be updated as per requirement
-rl
flag, this flag controls the global rate limit of http requests in nuclei but in terms of requests per minute (Not used as default and is mutually exclusive with -rl
flag)
auto
auto
is currently a placeholder for template-spray
strategytemplate-spray
strategy can be understood as stealthy mode of scanning and does not aggressively scan a single target. Instead of running all templates on single target it runs a template on multiple targets thereby reducing the load on single target without compromising the speed of scanninghost-spray
strategy can be understood as more of a focused mode of scanning where it runs all templates on single target before moving to next targettemplate-spray
strategy is more stealthy but consumes more memory than host-spray
since input/target chunk is different for each template contrary to host-spray
strategy where input/target chunk is same for all templates
This flag only decides strategy of scanning and uses concurrency specified by -c
and -bs
flags
Note: host-spray
strategy currently does not support resume feature due to complexity of implementation
1-1.5x x (concurrency * response-size-read)
template-spray
strategy as there is a Marshal/Unmarshal overhead is involved and each template has different copy of input/target chunk
host-spray
strategy when possible-c
, -bs
and -rl
flags after understanding requirement and capabilities of your own system as well as targets you are scanningPPROF=1
environment variable and also accepts addition option PPROF_TIME=10s
using these two env variables will enable profiling and snapshot of cpu profile and memory profile will be collected and store in appropriate directories every 10 seconds(PPROF_TIME). For addition options about profiling refer to nuclei-pprof.
A good example of reporting performance issue like memory leak is #4552 .