Misc fixes

dev
Ice3man543 2020-04-04 18:10:26 +05:30
parent 3ea8b07be3
commit 42d0a0a37e
4 changed files with 15 additions and 5 deletions

4
go.mod
View File

@ -7,10 +7,10 @@ require (
github.com/miekg/dns v1.1.29 // indirect github.com/miekg/dns v1.1.29 // indirect
github.com/projectdiscovery/gologger v1.0.0 github.com/projectdiscovery/gologger v1.0.0
github.com/projectdiscovery/massdns v0.0.0-20200331204010-f72d136ae361 github.com/projectdiscovery/massdns v0.0.0-20200331204010-f72d136ae361
github.com/projectdiscovery/retryablehttp-go v0.0.0-20200404113336-78da8dcb5040 github.com/projectdiscovery/retryablehttp-go v0.0.0-20200404122901-546f385ed972
github.com/projectdiscovery/shuffledns v1.0.2 // indirect github.com/projectdiscovery/shuffledns v1.0.2 // indirect
github.com/rs/xid v1.2.1 github.com/rs/xid v1.2.1
github.com/stretchr/testify v1.5.1 github.com/stretchr/testify v1.5.1
github.com/valyala/fasttemplate v1.1.0 github.com/valyala/fasttemplate v1.1.0
gopkg.in/yaml.v2 v2.2.2 gopkg.in/yaml.v2 v2.2.8
) )

4
go.sum
View File

@ -21,6 +21,8 @@ github.com/projectdiscovery/massdns v0.0.0-20200331204010-f72d136ae361 h1:HXHngE
github.com/projectdiscovery/massdns v0.0.0-20200331204010-f72d136ae361/go.mod h1:F4246OEiiR3iUPQDt0BRUdEZdlrQVyM+I3Wl3AcFaUg= github.com/projectdiscovery/massdns v0.0.0-20200331204010-f72d136ae361/go.mod h1:F4246OEiiR3iUPQDt0BRUdEZdlrQVyM+I3Wl3AcFaUg=
github.com/projectdiscovery/retryablehttp-go v0.0.0-20200404113336-78da8dcb5040 h1:vQQ/wys6mfOVVRyMw+W9lS52J6Iiy7MZp3DXFI94UY0= github.com/projectdiscovery/retryablehttp-go v0.0.0-20200404113336-78da8dcb5040 h1:vQQ/wys6mfOVVRyMw+W9lS52J6Iiy7MZp3DXFI94UY0=
github.com/projectdiscovery/retryablehttp-go v0.0.0-20200404113336-78da8dcb5040/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek= github.com/projectdiscovery/retryablehttp-go v0.0.0-20200404113336-78da8dcb5040/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek=
github.com/projectdiscovery/retryablehttp-go v0.0.0-20200404122901-546f385ed972 h1:cRYSgcJoj1St1ZFW0ZpxoaFkVzE9c5LdXguk0ANlvjk=
github.com/projectdiscovery/retryablehttp-go v0.0.0-20200404122901-546f385ed972/go.mod h1:SrN6iLZilNG1X4neq1D+SBxoqfAF4nyzvmevkTkWsek=
github.com/projectdiscovery/shuffledns v1.0.2 h1:0gvWe6eHNaUr1xkJCRaYVi33dcFVU/bSaOmKp16mTis= github.com/projectdiscovery/shuffledns v1.0.2 h1:0gvWe6eHNaUr1xkJCRaYVi33dcFVU/bSaOmKp16mTis=
github.com/projectdiscovery/shuffledns v1.0.2/go.mod h1:sp+rOgvOckLYxyzAM8WtxQKkuPyHNcG/xLWkKwLm/Vo= github.com/projectdiscovery/shuffledns v1.0.2/go.mod h1:sp+rOgvOckLYxyzAM8WtxQKkuPyHNcG/xLWkKwLm/Vo=
github.com/remeh/sizedwaitgroup v1.0.0 h1:VNGGFwNo/R5+MJBf6yrsr110p0m4/OX4S3DCy7Kyl5E= github.com/remeh/sizedwaitgroup v1.0.0 h1:VNGGFwNo/R5+MJBf6yrsr110p0m4/OX4S3DCy7Kyl5E=
@ -63,3 +65,5 @@ gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw= gopkg.in/yaml.v2 v2.2.2 h1:ZCJp+EgiOT7lHqUV2J862kp8Qj64Jo6az82+3Td9dZw=
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10=
gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=

View File

@ -14,6 +14,7 @@ type Options struct {
Targets string // Targets specifies the targets to scan using templates. Targets string // Targets specifies the targets to scan using templates.
Threads int // Thread controls the number of concurrent requests to make. Threads int // Thread controls the number of concurrent requests to make.
Timeout int // Timeout is the seconds to wait for a response from the server. Timeout int // Timeout is the seconds to wait for a response from the server.
Retries int // Retries is the number of times to retry the request
Output string // Output is the file to write found subdomains to. Output string // Output is the file to write found subdomains to.
Silent bool // Silent suppresses any extra text and only writes found URLs on screen. Silent bool // Silent suppresses any extra text and only writes found URLs on screen.
Version bool // Version specifies if we should just show version and exit Version bool // Version specifies if we should just show version and exit
@ -34,8 +35,9 @@ func ParseOptions() *Options {
flag.BoolVar(&options.Version, "version", false, "Show version of nuclei") flag.BoolVar(&options.Version, "version", false, "Show version of nuclei")
flag.BoolVar(&options.Verbose, "v", false, "Show Verbose output") flag.BoolVar(&options.Verbose, "v", false, "Show Verbose output")
flag.BoolVar(&options.NoColor, "nC", false, "Don't Use colors in output") flag.BoolVar(&options.NoColor, "nC", false, "Don't Use colors in output")
flag.IntVar(&options.Threads, "c", 100, "Number of concurrent requests to make") flag.IntVar(&options.Threads, "c", 10, "Number of concurrent requests to make")
flag.IntVar(&options.Timeout, "timeout", 30, "Time to wait in seconds before timeout") flag.IntVar(&options.Timeout, "timeout", 5, "Time to wait in seconds before timeout")
flag.IntVar(&options.Retries, "retries", 1, "Number of times to retry a failed request")
flag.Parse() flag.Parse()

View File

@ -31,6 +31,10 @@ func New(options *Options) (*Runner, error) {
options: options, options: options,
} }
retryablehttpOptions := retryablehttp.DefaultOptionsSpraying
retryablehttpOptions.RetryWaitMax = 10 * time.Second
retryablehttpOptions.RetryMax = options.Retries
// Create the HTTP Client // Create the HTTP Client
client := retryablehttp.NewWithHTTPClient(&http.Client{ client := retryablehttp.NewWithHTTPClient(&http.Client{
Transport: &http.Transport{ Transport: &http.Transport{
@ -45,7 +49,7 @@ func New(options *Options) (*Runner, error) {
CheckRedirect: func(_ *http.Request, _ []*http.Request) error { CheckRedirect: func(_ *http.Request, _ []*http.Request) error {
return http.ErrUseLastResponse return http.ErrUseLastResponse
}, },
}, retryablehttp.DefaultOptionsSpraying) }, retryablehttpOptions)
client.CheckRetry = retryablehttp.HostSprayRetryPolicy() client.CheckRetry = retryablehttp.HostSprayRetryPolicy()
runner.client = client runner.client = client