| 1 | package runnerscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.18 bytes/" |
| 5 | "compress/flatescip-go gomod github.com/golang/go/src go1.18 `compress/flate`/" |
| 6 | "compress/gzipscip-go gomod github.com/golang/go/src go1.18 `compress/gzip`/" |
| 7 | "crypto/tlsscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/" |
| 8 | "fmtscip-go gomod github.com/golang/go/src go1.18 fmt/" |
| 9 | "ioscip-go gomod github.com/golang/go/src go1.18 io/" |
| 10 | "netscip-go gomod github.com/golang/go/src go1.18 net/" |
| 11 | "net/httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/" |
| 12 | "net/http/httptracescip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/" |
| 13 | "net/http/httputilscip-go gomod github.com/golang/go/src go1.18 `net/http/httputil`/" |
| 14 | "net/textprotoscip-go gomod github.com/golang/go/src go1.18 `net/textproto`/" |
| 15 | "net/urlscip-go gomod github.com/golang/go/src go1.18 `net/url`/" |
| 16 | "strconvscip-go gomod github.com/golang/go/src go1.18 strconv/" |
| 17 | "stringsscip-go gomod github.com/golang/go/src go1.18 strings/" |
| 18 | "timescip-go gomod github.com/golang/go/src go1.18 time/" |
| 19 | |
| 20 | "github.com/ffuf/ffuf/v2/pkg/ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/" |
| 21 | |
| 22 | "github.com/andybalholm/brotliscip-go gomod github.com/andybalholm/brotli v1.0.5 `github.com/andybalholm/brotli`/" |
| 23 | ) |
| 24 | |
| 25 | // Download results < 5MB |
| 26 | const MAX_DOWNLOAD_SIZEscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/MAX_DOWNLOAD_SIZE. = 5242880 |
| 27 | |
| 28 | type SimpleRunnerscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner# struct { |
| 29 | configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config. *ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config# |
| 30 | clientscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#client. *httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.18 `net/http`/Client# |
| 31 | } |
| 32 | |
| 33 | func NewSimpleRunnerscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/NewSimpleRunner().(conf *ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#, replay bool) ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.RunnerProviderscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/RunnerProvider# { |
| 34 | var simplerunner SimpleRunnerscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner# |
| 35 | proxyURL := httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.ProxyFromEnvironmentscip-go gomod github.com/golang/go/src go1.18 `net/http`/ProxyFromEnvironment(). |
| 36 | customProxy := "" |
| 37 | |
| 38 | if replay { |
| 39 | customProxy = conf.ReplayProxyURLscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#ReplayProxyURL. |
| 40 | } else { |
| 41 | customProxy = conf.ProxyURLscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#ProxyURL. |
| 42 | } |
| 43 | if len(customProxy) > 0 { |
| 44 | pu, err := urlscip-go gomod github.com/golang/go/src go1.18 `net/url`/.Parsescip-go gomod github.com/golang/go/src go1.18 `net/url`/Parse().(customProxy) |
| 45 | if err == nil { |
| 46 | proxyURL = httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.ProxyURLscip-go gomod github.com/golang/go/src go1.18 `net/http`/ProxyURL().(pu) |
| 47 | } |
| 48 | } |
| 49 | cert := []tlsscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/.Certificatescip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/Certificate#{} |
| 50 | |
| 51 | if conf.ClientCertscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#ClientCert. != "" && conf.ClientKeyscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#ClientKey. != "" { |
| 52 | tmp, _ := tlsscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/.LoadX509KeyPairscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/LoadX509KeyPair().(conf.ClientCertscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#ClientCert., conf.ClientKeyscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#ClientKey.) |
| 53 | cert = []tlsscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/.Certificatescip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/Certificate#{tmp} |
| 54 | } |
| 55 | |
| 56 | simplerunner.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config. = conf |
| 57 | simplerunner.clientscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#client. = &httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Clientscip-go gomod github.com/golang/go/src go1.18 `net/http`/Client#{ |
| 58 | CheckRedirectscip-go gomod github.com/golang/go/src go1.18 `net/http`/Client#CheckRedirect.: func(req *httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#, via []*httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#) error { return httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.ErrUseLastResponsescip-go gomod github.com/golang/go/src go1.18 `net/http`/ErrUseLastResponse. }, |
| 59 | Timeoutscip-go gomod github.com/golang/go/src go1.18 `net/http`/Client#Timeout.: timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration#(timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration#(conf.Timeoutscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#Timeout.) * timescip-go gomod github.com/golang/go/src go1.18 time/.Secondscip-go gomod github.com/golang/go/src go1.18 time/Second.), |
| 60 | Transportscip-go gomod github.com/golang/go/src go1.18 `net/http`/Client#Transport.: &httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Transportscip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#{ |
| 61 | ForceAttemptHTTP2scip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#ForceAttemptHTTP2.: conf.Http2scip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#Http2., |
| 62 | Proxyscip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#Proxy.: proxyURL, |
| 63 | MaxIdleConnsscip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#MaxIdleConns.: 1000, |
| 64 | MaxIdleConnsPerHostscip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#MaxIdleConnsPerHost.: 500, |
| 65 | MaxConnsPerHostscip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#MaxConnsPerHost.: 500, |
| 66 | DialContextscip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#DialContext.: (&netscip-go gomod github.com/golang/go/src go1.18 net/.Dialerscip-go gomod github.com/golang/go/src go1.18 net/Dialer#{ |
| 67 | Timeoutscip-go gomod github.com/golang/go/src go1.18 net/Dialer#Timeout.: timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration#(timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration#(conf.Timeoutscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#Timeout.) * timescip-go gomod github.com/golang/go/src go1.18 time/.Secondscip-go gomod github.com/golang/go/src go1.18 time/Second.), |
| 68 | }).DialContextscip-go gomod github.com/golang/go/src go1.18 net/Dialer#DialContext()., |
| 69 | TLSHandshakeTimeoutscip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#TLSHandshakeTimeout.: timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration#(timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration#(conf.Timeoutscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#Timeout.) * timescip-go gomod github.com/golang/go/src go1.18 time/.Secondscip-go gomod github.com/golang/go/src go1.18 time/Second.), |
| 70 | TLSClientConfigscip-go gomod github.com/golang/go/src go1.18 `net/http`/Transport#TLSClientConfig.: &tlsscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/.Configscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/Config#{ |
| 71 | InsecureSkipVerifyscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/Config#InsecureSkipVerify.: true, |
| 72 | MinVersionscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/Config#MinVersion.: tlsscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/.VersionTLS10scip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/VersionTLS10., |
| 73 | Renegotiationscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/Config#Renegotiation.: tlsscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/.RenegotiateOnceAsClientscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/RenegotiateOnceAsClient., |
| 74 | ServerNamescip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/Config#ServerName.: conf.SNIscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#SNI., |
| 75 | Certificatesscip-go gomod github.com/golang/go/src go1.18 `crypto/tls`/Config#Certificates.: cert, |
| 76 | }, |
| 77 | }} |
| 78 | |
| 79 | if conf.FollowRedirectsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#FollowRedirects. { |
| 80 | simplerunner.clientscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#client..CheckRedirectscip-go gomod github.com/golang/go/src go1.18 `net/http`/Client#CheckRedirect. = nil |
| 81 | } |
| 82 | return &simplerunner |
| 83 | } |
| 84 | |
| 85 | func (r *SimpleRunnerscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#) Preparescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#Prepare().(input map[string][]byte, basereq *ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Requestscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#) (ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Requestscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#, error) { |
| 86 | req := ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.CopyRequestscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/CopyRequest().(basereq) |
| 87 | |
| 88 | for keyword, inputitem := range input { |
| 89 | req.Methodscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Method. = stringsscip-go gomod github.com/golang/go/src go1.18 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.18 strings/ReplaceAll().(req.Methodscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Method., keyword, string(inputitem)) |
| 90 | headers := make(map[string]string, len(req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.)) |
| 91 | for h, v := range req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers. { |
| 92 | var CanonicalHeader string = textprotoscip-go gomod github.com/golang/go/src go1.18 `net/textproto`/.CanonicalMIMEHeaderKeyscip-go gomod github.com/golang/go/src go1.18 `net/textproto`/CanonicalMIMEHeaderKey().(stringsscip-go gomod github.com/golang/go/src go1.18 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.18 strings/ReplaceAll().(h, keyword, string(inputitem))) |
| 93 | headers[CanonicalHeader] = stringsscip-go gomod github.com/golang/go/src go1.18 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.18 strings/ReplaceAll().(v, keyword, string(inputitem)) |
| 94 | } |
| 95 | req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers. = headers |
| 96 | req.Urlscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Url. = stringsscip-go gomod github.com/golang/go/src go1.18 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.18 strings/ReplaceAll().(req.Urlscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Url., keyword, string(inputitem)) |
| 97 | req.Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Data. = []byte(stringsscip-go gomod github.com/golang/go/src go1.18 strings/.ReplaceAllscip-go gomod github.com/golang/go/src go1.18 strings/ReplaceAll().(string(req.Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Data.), keyword, string(inputitem))) |
| 98 | } |
| 99 | |
| 100 | req.Inputscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Input. = input |
| 101 | return req, nil |
| 102 | } |
| 103 | |
| 104 | func (r *SimpleRunnerscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#) Executescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#Execute().(req *ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Requestscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#) (ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Responsescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#, error) { |
| 105 | var httpreq *httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request# |
| 106 | var err error |
| 107 | var rawreq []byte |
| 108 | data := bytesscip-go gomod github.com/golang/go/src go1.18 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.18 bytes/NewReader().(req.Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Data.) |
| 109 | |
| 110 | var start timescip-go gomod github.com/golang/go/src go1.18 time/.Timescip-go gomod github.com/golang/go/src go1.18 time/Time# |
| 111 | var firstByteTime timescip-go gomod github.com/golang/go/src go1.18 time/.Durationscip-go gomod github.com/golang/go/src go1.18 time/Duration# |
| 112 | |
| 113 | trace := &httptracescip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/.ClientTracescip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/ClientTrace#{ |
| 114 | WroteRequestscip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/ClientTrace#WroteRequest.: func(wri httptracescip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/.WroteRequestInfoscip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/WroteRequestInfo#) { |
| 115 | start = timescip-go gomod github.com/golang/go/src go1.18 time/.Nowscip-go gomod github.com/golang/go/src go1.18 time/Now().() // begin the timer after the request is fully written |
| 116 | }, |
| 117 | GotFirstResponseBytescip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/ClientTrace#GotFirstResponseByte.: func() { |
| 118 | firstByteTime = timescip-go gomod github.com/golang/go/src go1.18 time/.Sincescip-go gomod github.com/golang/go/src go1.18 time/Since().(start) // record when the first byte of the response was received |
| 119 | }, |
| 120 | } |
| 121 | |
| 122 | httpreq, err = httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.NewRequestWithContextscip-go gomod github.com/golang/go/src go1.18 `net/http`/NewRequestWithContext().(r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..Contextscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#Context., req.Methodscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Method., req.Urlscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Url., data) |
| 123 | |
| 124 | if err != nil { |
| 125 | return ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Responsescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#{}, err |
| 126 | } |
| 127 | |
| 128 | // set default User-Agent header if not present |
| 129 | if _, ok := req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.["User-Agent"]; !ok { |
| 130 | req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.["User-Agent"] = fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().("%s v%s", "Fuzz Faster U Fool", ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Versionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Version().()) |
| 131 | } |
| 132 | |
| 133 | // Handle Go http.Request special cases |
| 134 | if _, ok := req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.["Host"]; ok { |
| 135 | httpreq.Hostscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#Host. = req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.["Host"] |
| 136 | } |
| 137 | |
| 138 | req.Hostscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Host. = httpreq.Hostscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#Host. |
| 139 | httpreq = httpreq.WithContextscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#WithContext().(httptracescip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/.WithClientTracescip-go gomod github.com/golang/go/src go1.18 `net/http/httptrace`/WithClientTrace().(r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..Contextscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#Context., trace)) |
| 140 | |
| 141 | if r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..Rawscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#Raw. { |
| 142 | httpreq.URLscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#URL..Opaquescip-go gomod github.com/golang/go/src go1.18 `net/url`/URL#Opaque. = req.Urlscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Url. |
| 143 | } |
| 144 | |
| 145 | for k, v := range req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers. { |
| 146 | httpreq.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Set().(k, v) |
| 147 | } |
| 148 | |
| 149 | if len(r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..OutputDirectoryscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#OutputDirectory.) > 0 || len(r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..AuditLogscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#AuditLog.) > 0 { |
| 150 | rawreq, _ = httputilscip-go gomod github.com/golang/go/src go1.18 `net/http/httputil`/.DumpRequestOutscip-go gomod github.com/golang/go/src go1.18 `net/http/httputil`/DumpRequestOut().(httpreq, true) |
| 151 | req.Rawscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Raw. = string(rawreq) |
| 152 | } |
| 153 | |
| 154 | httpresp, err := r.clientscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#client..Doscip-go gomod github.com/golang/go/src go1.18 `net/http`/Client#Do().(httpreq) |
| 155 | if err != nil { |
| 156 | return ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Responsescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#{}, err |
| 157 | } |
| 158 | |
| 159 | req.Timestampscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Timestamp. = start |
| 160 | |
| 161 | resp := ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.NewResponsescip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/NewResponse().(httpresp, req) |
| 162 | defer httpresp.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http`/Response#Body..Closescip-go gomod github.com/golang/go/src go1.18 io/Closer#Close().() |
| 163 | |
| 164 | // Check if we should download the resource or not |
| 165 | size, err := strconvscip-go gomod github.com/golang/go/src go1.18 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.18 strconv/Atoi().(httpresp.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Response#Header..Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Content-Length")) |
| 166 | if err == nil { |
| 167 | resp.ContentLengthscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#ContentLength. = int64(size) |
| 168 | if (r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..IgnoreBodyscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#IgnoreBody.) || (size > MAX_DOWNLOAD_SIZEscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/MAX_DOWNLOAD_SIZE.) { |
| 169 | resp.Cancelledscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Cancelled. = true |
| 170 | return resp, nil |
| 171 | } |
| 172 | } |
| 173 | |
| 174 | if len(r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..OutputDirectoryscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#OutputDirectory.) > 0 || len(r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..AuditLogscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#AuditLog.) > 0 { |
| 175 | rawresp, _ := httputilscip-go gomod github.com/golang/go/src go1.18 `net/http/httputil`/.DumpResponsescip-go gomod github.com/golang/go/src go1.18 `net/http/httputil`/DumpResponse().(httpresp, true) |
| 176 | resp.Requestscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Request..Rawscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Raw. = string(rawreq) |
| 177 | resp.Rawscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Raw. = string(rawresp) |
| 178 | } |
| 179 | var bodyReader ioscip-go gomod github.com/golang/go/src go1.18 io/.Readerscip-go gomod github.com/golang/go/src go1.18 io/Reader# = httpresp.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http`/Response#Body. |
| 180 | switch httpresp.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Response#Header..Getscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Get().("Content-Encoding") { |
| 181 | case "gzip": |
| 182 | if zr, zerr := gzipscip-go gomod github.com/golang/go/src go1.18 `compress/gzip`/.NewReaderscip-go gomod github.com/golang/go/src go1.18 `compress/gzip`/NewReader().(httpresp.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http`/Response#Body.); zerr == nil { |
| 183 | bodyReader = zr |
| 184 | } // else: fall back to the raw (undecoded) body |
| 185 | case "br": |
| 186 | bodyReader = brotliscip-go gomod github.com/andybalholm/brotli v1.0.5 `github.com/andybalholm/brotli`/.NewReaderscip-go gomod github.com/andybalholm/brotli v1.0.5 `github.com/andybalholm/brotli`/NewReader().(httpresp.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http`/Response#Body.) |
| 187 | case "deflate": |
| 188 | bodyReader = flatescip-go gomod github.com/golang/go/src go1.18 `compress/flate`/.NewReaderscip-go gomod github.com/golang/go/src go1.18 `compress/flate`/NewReader().(httpresp.Bodyscip-go gomod github.com/golang/go/src go1.18 `net/http`/Response#Body.) |
| 189 | } |
| 190 | |
| 191 | // Bound the DECOMPRESSED read. The Content-Length guard above is not |
| 192 | // sufficient on its own: a malicious server can send a small compressed body |
| 193 | // (or a chunked response with no Content-Length, or one the transport |
| 194 | // transparently decoded and stripped the headers from) that expands to |
| 195 | // gigabytes. LimitReader caps the bytes we ever pull from the possibly- |
| 196 | // decompressing reader, so a decompression bomb only materialises |
| 197 | // MAX_DOWNLOAD_SIZE+1 bytes in memory instead of OOM-killing the process. |
| 198 | limited := ioscip-go gomod github.com/golang/go/src go1.18 io/.LimitReaderscip-go gomod github.com/golang/go/src go1.18 io/LimitReader().(bodyReader, int64(MAX_DOWNLOAD_SIZEscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/MAX_DOWNLOAD_SIZE.)+1) |
| 199 | if respbody, rerr := ioscip-go gomod github.com/golang/go/src go1.18 io/.ReadAllscip-go gomod github.com/golang/go/src go1.18 io/ReadAll().(limited); rerr == nil { |
| 200 | if len(respbody) > MAX_DOWNLOAD_SIZEscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/MAX_DOWNLOAD_SIZE. { |
| 201 | resp.Cancelledscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Cancelled. = true |
| 202 | return resp, nil |
| 203 | } |
| 204 | resp.ContentLengthscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#ContentLength. = int64(len(respbody)) |
| 205 | resp.Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Data. = respbody |
| 206 | } |
| 207 | |
| 208 | wordsSize := len(stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Splitscip-go gomod github.com/golang/go/src go1.18 strings/Split().(string(resp.Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Data.), " ")) |
| 209 | linesSize := len(stringsscip-go gomod github.com/golang/go/src go1.18 strings/.Splitscip-go gomod github.com/golang/go/src go1.18 strings/Split().(string(resp.Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Data.), "\n")) |
| 210 | resp.ContentWordsscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#ContentWords. = int64(wordsSize) |
| 211 | resp.ContentLinesscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#ContentLines. = int64(linesSize) |
| 212 | resp.Durationscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Duration. = firstByteTime |
| 213 | resp.Timestampscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Response#Timestamp. = start.Addscip-go gomod github.com/golang/go/src go1.18 time/Time#Add().(firstByteTime) |
| 214 | |
| 215 | return resp, nil |
| 216 | } |
| 217 | |
| 218 | func (r *SimpleRunnerscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#) Dumpscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#Dump().(req *ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Requestscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#) ([]byte, error) { |
| 219 | var httpreq *httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request# |
| 220 | var err error |
| 221 | data := bytesscip-go gomod github.com/golang/go/src go1.18 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.18 bytes/NewReader().(req.Datascip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Data.) |
| 222 | httpreq, err = httpscip-go gomod github.com/golang/go/src go1.18 `net/http`/.NewRequestWithContextscip-go gomod github.com/golang/go/src go1.18 `net/http`/NewRequestWithContext().(r.configscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/runner`/SimpleRunner#config..Contextscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Config#Context., req.Methodscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Method., req.Urlscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Url., data) |
| 223 | if err != nil { |
| 224 | return []byte{}, err |
| 225 | } |
| 226 | |
| 227 | // set default User-Agent header if not present |
| 228 | if _, ok := req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.["User-Agent"]; !ok { |
| 229 | req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.["User-Agent"] = fmtscip-go gomod github.com/golang/go/src go1.18 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.18 fmt/Sprintf().("%s v%s", "Fuzz Faster U Fool", ffufscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/.Versionscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Version().()) |
| 230 | } |
| 231 | |
| 232 | // Handle Go http.Request special cases |
| 233 | if _, ok := req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.["Host"]; ok { |
| 234 | httpreq.Hostscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#Host. = req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers.["Host"] |
| 235 | } |
| 236 | |
| 237 | req.Hostscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Host. = httpreq.Hostscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#Host. |
| 238 | for k, v := range req.Headersscip-go gomod github.com/ffuf/ffuf/v2 . `github.com/ffuf/ffuf/v2/pkg/ffuf`/Request#Headers. { |
| 239 | httpreq.Headerscip-go gomod github.com/golang/go/src go1.18 `net/http`/Request#Header..Setscip-go gomod github.com/golang/go/src go1.18 `net/http`/Header#Set().(k, v) |
| 240 | } |
| 241 | return httputilscip-go gomod github.com/golang/go/src go1.18 `net/http/httputil`/.DumpRequestOutscip-go gomod github.com/golang/go/src go1.18 `net/http/httputil`/DumpRequestOut().(httpreq, true) |
| 242 | } |