From dc01f66d1a0eb57647820ff520bb2a8d83566217 Mon Sep 17 00:00:00 2001 From: admin Date: Mon, 29 Jun 2026 14:53:35 +1000 Subject: [PATCH] Add --proxy / -x flag for routing requests through a proxy --- pkg/shortscan/shortscan.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/pkg/shortscan/shortscan.go b/pkg/shortscan/shortscan.go index 798ef35..060d02a 100644 --- a/pkg/shortscan/shortscan.go +++ b/pkg/shortscan/shortscan.go @@ -152,6 +152,7 @@ type arguments struct { Characters string `arg:"-C" help:"filename characters to enumerate" default:"JFKGOTMYVHSPCANDXLRWEBQUIZ8549176320-_()&'!#$%@^{}~"` Autocomplete string `arg:"-a" help:"autocomplete detection mode (auto = autoselect; method = HTTP method magic; status = HTTP status; distance = Levenshtein distance; none = disable)" placeholder:"mode" default:"auto"` IsVuln bool `arg:"-V" help:"bail after determining whether the service is vulnerable" default:"false"` + Proxy string `arg:"--proxy,-x" help:"proxy to send requests through (e.g. http://proxy:8080 or socks5://proxy:1080)" placeholder:"URL"` } func (arguments) Version() string { @@ -1105,10 +1106,20 @@ func Run() { log.SetLevel(log.WarnLevel) } + // Resolve proxy function: explicit flag takes priority over environment variables + proxyFunc := http.ProxyFromEnvironment + if args.Proxy != "" { + proxyUrl, err := nurl.Parse(args.Proxy) + if err != nil { + log.WithFields(log.Fields{"err": err}).Fatal("Invalid proxy URL") + } + proxyFunc = http.ProxyURL(proxyUrl) + } + // Build an HTTP client hc := &http.Client{ Timeout: time.Duration(args.Timeout) * time.Second, - Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true, Renegotiation: tls.RenegotiateOnceAsClient}, Proxy: http.ProxyFromEnvironment}, + Transport: &http.Transport{TLSClientConfig: &tls.Config{InsecureSkipVerify: true, Renegotiation: tls.RenegotiateOnceAsClient}, Proxy: proxyFunc}, CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }, }