Skip to content

Commit

Permalink
Merge pull request #1174 from projectdiscovery/fastdialer-memory-leak
Browse files Browse the repository at this point in the history
remove fastdialer from runner object
  • Loading branch information
Mzack9999 authored May 16, 2023
2 parents fe33d20 + 827ed16 commit 9566276
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
1 change: 1 addition & 0 deletions cmd/functional-test/testcases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ scanme.sh {{binary}} -silent -body 'a=b'
scanme.sh {{binary}} -silent -exclude-cdn
scanme.sh {{binary}} -silent -ports https:443
scanme.sh {{binary}} -silent -ztls
scanme.sh {{binary}} -silent -jarm
https://scanme.sh?a=1*1 {{binary}} -silent
https://scanme.sh:443 {{binary}} -asn
16 changes: 1 addition & 15 deletions runner/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/PuerkitoBio/goquery"
asnmap "github.com/projectdiscovery/asnmap/libs"
dsl "github.com/projectdiscovery/dsl"
"github.com/projectdiscovery/fastdialer/fastdialer"
"github.com/projectdiscovery/httpx/common/customextract"
"github.com/projectdiscovery/httpx/common/hashes/jarm"
"github.com/projectdiscovery/mapcidr/asn"
Expand Down Expand Up @@ -70,7 +69,6 @@ type Runner struct {
options *Options
hp *httpx.HTTPX
wappalyzer *wappalyzer.Wappalyze
fastdialer *fastdialer.Dialer
scanopts ScanOptions
hm *hybrid.HybridMap
stats clistats.StatisticsClient
Expand All @@ -95,18 +93,6 @@ func New(options *Options) (*Runner, error) {
os.RemoveAll(filepath.Join(options.StoreResponseDir, "response", "index.txt"))
os.RemoveAll(filepath.Join(options.StoreResponseDir, "screenshot", "index_screenshot.txt"))
}
dialerOpts := fastdialer.DefaultOptions
dialerOpts.WithDialerHistory = true
dialerOpts.MaxRetries = 3
dialerOpts.DialerTimeout = time.Duration(options.Timeout) * time.Second
if len(options.Resolvers) > 0 {
dialerOpts.BaseResolvers = options.Resolvers
}
fastDialer, err := fastdialer.NewDialer(dialerOpts)
if err != nil {
return nil, errors.Wrap(err, "could not create dialer")
}
runner.fastdialer = fastDialer

httpxOptions := httpx.DefaultOptions
// Enables automatically tlsgrab if tlsprobe is requested
Expand Down Expand Up @@ -1602,7 +1588,7 @@ retry:
}
jarmhash := ""
if r.options.Jarm {
jarmhash = jarm.Jarm(r.fastdialer, fullURL, r.options.Timeout)
jarmhash = jarm.Jarm(r.hp.Dialer, fullURL, r.options.Timeout)
builder.WriteString(" [")
if !scanopts.OutputWithNoColor {
builder.WriteString(aurora.Magenta(jarmhash).String())
Expand Down

0 comments on commit 9566276

Please sign in to comment.