fixing global dealer

dev
Mzack9999 2020-10-24 01:27:46 +02:00
parent 5b073c1876
commit 17827f4ab8
3 changed files with 17 additions and 9 deletions

View File

@ -72,6 +72,7 @@ func (r *Runner) processTemplateWithList(p progress.IProgress, template *templat
Decolorizer: r.decolorizer,
StopAtFirstMatch: r.options.StopAtFirstMatch,
PF: r.pf,
Dialer: &r.dialer,
})
}

View File

@ -12,6 +12,7 @@ import (
"github.com/logrusorgru/aurora"
"github.com/pkg/errors"
"github.com/projectdiscovery/gologger"
"github.com/projectdiscovery/httpx/common/cache"
"github.com/projectdiscovery/nuclei/v2/internal/bufwriter"
"github.com/projectdiscovery/nuclei/v2/internal/progress"
"github.com/projectdiscovery/nuclei/v2/internal/tracelog"
@ -48,6 +49,9 @@ type Runner struct {
// output coloring
colorizer colorizer.NucleiColorizer
decolorizer *regexp.Regexp
// http dialer
dialer cache.DialerFunc
}
// New creates a new client for running enumeration process.
@ -194,6 +198,12 @@ func New(options *Options) (*Runner, error) {
collaborator.DefaultCollaborator.Collab.AddBIID(options.BurpCollaboratorBiid)
}
// Create Dialer
runner.dialer, err = cache.NewDialer(cache.DefaultOptions)
if err != nil {
return nil, err
}
return runner, nil
}

View File

@ -89,14 +89,16 @@ type HTTPOptions struct {
ColoredOutput bool
StopAtFirstMatch bool
PF *projetctfile.ProjectFile
Dialer *cache.DialerFunc
}
// NewHTTPExecuter creates a new HTTP executer from a template
// and a HTTP request query.
func NewHTTPExecuter(options *HTTPOptions) (*HTTPExecuter, error) {
var proxyURL *url.URL
var err error
var (
proxyURL *url.URL
err error
)
if options.ProxyURL != "" {
proxyURL, err = url.Parse(options.ProxyURL)
@ -601,13 +603,8 @@ func makeHTTPClient(proxyURL *url.URL, options *HTTPOptions) (*retryablehttp.Cli
followRedirects := options.BulkHTTPRequest.Redirects
maxRedirects := options.BulkHTTPRequest.MaxRedirects
dialer, err := cache.NewDialer(cache.DefaultOptions)
if err != nil {
return nil, err
}
transport := &http.Transport{
DialContext: dialer,
DialContext: *options.Dialer,
MaxIdleConns: maxIdleConns,
MaxIdleConnsPerHost: maxIdleConnsPerHost,
MaxConnsPerHost: maxConnsPerHost,