mirror of
https://github.com/projectdiscovery/nuclei.git
synced 2025-12-22 20:45:24 +00:00
misc flag update
This commit is contained in:
parent
7b4803132d
commit
e0a2e5d292
@ -127,7 +127,7 @@ on extensive configurability, massive extensibility and ease of use.`)
|
|||||||
createGroup(flagSet, "optimization", "Optimizations",
|
createGroup(flagSet, "optimization", "Optimizations",
|
||||||
flagSet.IntVar(&options.Timeout, "timeout", 5, "time to wait in seconds before timeout"),
|
flagSet.IntVar(&options.Timeout, "timeout", 5, "time to wait in seconds before timeout"),
|
||||||
flagSet.IntVar(&options.Retries, "retries", 1, "number of times to retry a failed request"),
|
flagSet.IntVar(&options.Retries, "retries", 1, "number of times to retry a failed request"),
|
||||||
flagSet.IntVar(&options.HostMaxErrors, "host-max-error", 30, "max errors for a host before skipping from scan"),
|
flagSet.IntVar(&options.MaxHostError, "max-host-error", 30, "max errors for a host before skipping from scan"),
|
||||||
|
|
||||||
flagSet.BoolVar(&options.Project, "project", false, "use a project folder to avoid sending same request multiple times"),
|
flagSet.BoolVar(&options.Project, "project", false, "use a project folder to avoid sending same request multiple times"),
|
||||||
flagSet.StringVar(&options.ProjectPath, "project-path", os.TempDir(), "set a specific project path"),
|
flagSet.StringVar(&options.ProjectPath, "project-path", os.TempDir(), "set a specific project path"),
|
||||||
|
|||||||
@ -297,8 +297,8 @@ func (r *Runner) RunEnumeration() error {
|
|||||||
r.options.ExcludedTemplates = append(r.options.ExcludedTemplates, ignoreFile.Files...)
|
r.options.ExcludedTemplates = append(r.options.ExcludedTemplates, ignoreFile.Files...)
|
||||||
|
|
||||||
var cache *hosterrorscache.Cache
|
var cache *hosterrorscache.Cache
|
||||||
if r.options.HostMaxErrors > 0 {
|
if r.options.MaxHostError > 0 {
|
||||||
cache = hosterrorscache.New(r.options.HostMaxErrors, hosterrorscache.DefaultMaxHostsCount).SetVerbose(r.options.Verbose)
|
cache = hosterrorscache.New(r.options.MaxHostError, hosterrorscache.DefaultMaxHostsCount).SetVerbose(r.options.Verbose)
|
||||||
}
|
}
|
||||||
r.hostErrors = cache
|
r.hostErrors = cache
|
||||||
executerOpts := protocols.ExecuterOptions{
|
executerOpts := protocols.ExecuterOptions{
|
||||||
|
|||||||
@ -28,7 +28,7 @@ type Config struct {
|
|||||||
const nucleiConfigFilename = ".templates-config.json"
|
const nucleiConfigFilename = ".templates-config.json"
|
||||||
|
|
||||||
// Version is the current version of nuclei
|
// Version is the current version of nuclei
|
||||||
const Version = `2.4.4-dev`
|
const Version = `2.5.0`
|
||||||
|
|
||||||
func getConfigDetails() (string, error) {
|
func getConfigDetails() (string, error) {
|
||||||
homeDir, err := os.UserHomeDir()
|
homeDir, err := os.UserHomeDir()
|
||||||
|
|||||||
@ -16,7 +16,7 @@ import (
|
|||||||
// It uses an LRU cache internally for skipping unresponsive hosts
|
// It uses an LRU cache internally for skipping unresponsive hosts
|
||||||
// that remain so for a duration.
|
// that remain so for a duration.
|
||||||
type Cache struct {
|
type Cache struct {
|
||||||
hostMaxErrors int
|
MaxHostError int
|
||||||
verbose bool
|
verbose bool
|
||||||
failedTargets gcache.Cache
|
failedTargets gcache.Cache
|
||||||
}
|
}
|
||||||
@ -24,11 +24,11 @@ type Cache struct {
|
|||||||
const DefaultMaxHostsCount = 10000
|
const DefaultMaxHostsCount = 10000
|
||||||
|
|
||||||
// New returns a new host max errors cache
|
// New returns a new host max errors cache
|
||||||
func New(hostMaxErrors, maxHostsCount int) *Cache {
|
func New(MaxHostError, maxHostsCount int) *Cache {
|
||||||
gc := gcache.New(maxHostsCount).
|
gc := gcache.New(maxHostsCount).
|
||||||
ARC().
|
ARC().
|
||||||
Build()
|
Build()
|
||||||
return &Cache{failedTargets: gc, hostMaxErrors: hostMaxErrors}
|
return &Cache{failedTargets: gc, MaxHostError: MaxHostError}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetVerbose sets the cache to log at verbose level
|
// SetVerbose sets the cache to log at verbose level
|
||||||
@ -88,7 +88,7 @@ func (c *Cache) Check(value string) bool {
|
|||||||
if numberOfErrors == -1 {
|
if numberOfErrors == -1 {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
if numberOfErrorsValue >= c.hostMaxErrors {
|
if numberOfErrorsValue >= c.MaxHostError {
|
||||||
_ = c.failedTargets.Set(finalValue, -1)
|
_ = c.failedTargets.Set(finalValue, -1)
|
||||||
if c.verbose {
|
if c.verbose {
|
||||||
gologger.Verbose().Msgf("Skipping %s as previously unresponsive %d times", finalValue, numberOfErrorsValue)
|
gologger.Verbose().Msgf("Skipping %s as previously unresponsive %d times", finalValue, numberOfErrorsValue)
|
||||||
|
|||||||
@ -65,8 +65,8 @@ type Options struct {
|
|||||||
StatsInterval int
|
StatsInterval int
|
||||||
// MetricsPort is the port to show metrics on
|
// MetricsPort is the port to show metrics on
|
||||||
MetricsPort int
|
MetricsPort int
|
||||||
// HostMaxErrors is the maximum number of errors allowed for a host
|
// MaxHostError is the maximum number of errors allowed for a host
|
||||||
HostMaxErrors int
|
MaxHostError int
|
||||||
// BulkSize is the of targets analyzed in parallel for each template
|
// BulkSize is the of targets analyzed in parallel for each template
|
||||||
BulkSize int
|
BulkSize int
|
||||||
// TemplateThreads is the number of templates executed in parallel
|
// TemplateThreads is the number of templates executed in parallel
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user