Added stats-interval flag

This commit is contained in:
Ice3man543 2021-02-23 18:05:20 +05:30
parent ec3f85e032
commit 9b79f9b13c
4 changed files with 8 additions and 4 deletions

View File

@ -86,6 +86,7 @@ based on templates offering massive extensibility and ease of use.`)
set.BoolVar(&options.Headless, "headless", false, "Enable headless browser based templates support")
set.BoolVar(&options.ShowBrowser, "show-browser", false, "Show the browser on the screen")
set.BoolVarP(&options.Workflows, "w", "workflows", false, "Only run workflow templates with nuclei")
set.IntVar(&options.StatsInterval, "stats-interval", 5, "Number of seconds between each stats line")
_ = set.Parse()
if cfgFile != "" {

View File

@ -23,10 +23,10 @@ type Progress struct {
}
// NewProgress creates and returns a new progress tracking object.
func NewProgress(active, metrics bool, port int) (*Progress, error) {
func NewProgress(duration int, active, metrics bool, port int) (*Progress, error) {
var tickDuration time.Duration
if active {
tickDuration = 5 * time.Second
tickDuration = time.Duration(duration) * time.Second
} else {
tickDuration = -1
}

View File

@ -155,7 +155,7 @@ func New(options *types.Options) (*Runner, error) {
// Creates the progress tracking object
var progressErr error
runner.progress, progressErr = progress.NewProgress(options.EnableProgressBar, options.Metrics, options.MetricsPort)
runner.progress, progressErr = progress.NewProgress(options.StatsInterval, options.EnableProgressBar, options.Metrics, options.MetricsPort)
if progressErr != nil {
return nil, progressErr
}

View File

@ -100,5 +100,8 @@ type Options struct {
ShowBrowser bool
// Workflows specifies if only to execute workflows (no normal templates will be run)
Workflows bool
// StatsInterval is the number of seconds to display stats after
StatsInterval int
InternalResolversList []string // normalized from resolvers flag as well as file provided.
}