feat: add SystemResolvers / InternalResolversList options to NetworkConfig (#4719)

This commit is contained in:
denysvitali-niantic 2024-02-02 17:57:00 +01:00 committed by GitHub
parent ee68de6ea8
commit 340c953138
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -5,6 +5,8 @@ import (
"time"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/ratelimit"
"github.com/projectdiscovery/nuclei/v3/pkg/model/types/severity"
"github.com/projectdiscovery/nuclei/v3/pkg/output"
"github.com/projectdiscovery/nuclei/v3/pkg/progress"
@ -13,7 +15,6 @@ import (
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/common/utils/vardump"
"github.com/projectdiscovery/nuclei/v3/pkg/protocols/headless/engine"
"github.com/projectdiscovery/nuclei/v3/pkg/templates/types"
"github.com/projectdiscovery/ratelimit"
)
// TemplateSources contains template sources
@ -220,14 +221,16 @@ func WithVerbosity(opts VerbosityOptions) NucleiSDKOptions {
// NetworkConfig contains network config options
// ex: retries , httpx probe , timeout etc
type NetworkConfig struct {
Timeout int // Timeout in seconds
Retries int // Number of retries
LeaveDefaultPorts bool // Leave default ports for http/https
MaxHostError int // Maximum number of host errors to allow before skipping that host
TrackError []string // Adds given errors to max host error watchlist
DisableMaxHostErr bool // Disable max host error optimization (Hosts are not skipped even if they are not responding)
Interface string // Interface to use for network scan
SourceIP string // SourceIP sets custom source IP address for network requests
DisableMaxHostErr bool // Disable max host error optimization (Hosts are not skipped even if they are not responding)
Interface string // Interface to use for network scan
InternalResolversList []string // Use a list of resolver
LeaveDefaultPorts bool // Leave default ports for http/https
MaxHostError int // Maximum number of host errors to allow before skipping that host
Retries int // Number of retries
SourceIP string // SourceIP sets custom source IP address for network requests
SystemResolvers bool // Use system resolvers
Timeout int // Timeout in seconds
TrackError []string // Adds given errors to max host error watchlist
}
// WithNetworkConfig allows setting network config options
@ -242,6 +245,8 @@ func WithNetworkConfig(opts NetworkConfig) NucleiSDKOptions {
e.hostErrCache = hosterrorscache.New(opts.MaxHostError, hosterrorscache.DefaultMaxHostsCount, opts.TrackError)
e.opts.Interface = opts.Interface
e.opts.SourceIP = opts.SourceIP
e.opts.SystemResolvers = opts.SystemResolvers
e.opts.InternalResolversList = opts.InternalResolversList
return nil
}
}