From 340c953138591a17f6e2058bd6da3da9910915c1 Mon Sep 17 00:00:00 2001 From: denysvitali-niantic <157139422+denysvitali-niantic@users.noreply.github.com> Date: Fri, 2 Feb 2024 17:57:00 +0100 Subject: [PATCH] feat: add SystemResolvers / InternalResolversList options to NetworkConfig (#4719) --- lib/config.go | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/lib/config.go b/lib/config.go index e816b4b97..0c48f373b 100644 --- a/lib/config.go +++ b/lib/config.go @@ -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 } }