| 1 | package http_proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/ |
| 2 | |
| 3 | import ( |
| 4 | "bufioscip-go gomod github.com/golang/go/src go1.16 bufio/" |
| 5 | "bytesscip-go gomod github.com/golang/go/src go1.16 bytes/" |
| 6 | "contextscip-go gomod github.com/golang/go/src go1.16 context/" |
| 7 | "crypto/tlsscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/" |
| 8 | "crypto/x509scip-go gomod github.com/golang/go/src go1.16 `crypto/x509`/" |
| 9 | "fmtscip-go gomod github.com/golang/go/src go1.16 fmt/" |
| 10 | "io/ioutilscip-go gomod github.com/golang/go/src go1.16 `io/ioutil`/" |
| 11 | "netscip-go gomod github.com/golang/go/src go1.16 net/" |
| 12 | "net/httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/" |
| 13 | "net/urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/" |
| 14 | "path/filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/" |
| 15 | "strconvscip-go gomod github.com/golang/go/src go1.16 strconv/" |
| 16 | "stringsscip-go gomod github.com/golang/go/src go1.16 strings/" |
| 17 | "timescip-go gomod github.com/golang/go/src go1.16 time/" |
| 18 | |
| 19 | "github.com/bettercap/bettercap/firewallscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/" |
| 20 | "github.com/bettercap/bettercap/sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/" |
| 21 | btlsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/tls`/ "github.com/bettercap/bettercap/tlsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/tls`/" |
| 22 | |
| 23 | "github.com/elazarl/goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/" |
| 24 | "github.com/inconshreveable/go-vhostscip-go gomod github.com/inconshreveable/go-vhost v1.0.0 `github.com/inconshreveable/go-vhost`/" |
| 25 | |
| 26 | "github.com/evilsocket/islazy/fsscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/fs`/" |
| 27 | "github.com/evilsocket/islazy/logscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/" |
| 28 | "github.com/evilsocket/islazy/strscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/" |
| 29 | "github.com/evilsocket/islazy/tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/" |
| 30 | ) |
| 31 | |
| 32 | const ( |
| 33 | httpReadTimeoutscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/httpReadTimeout. = 5 * timescip-go gomod github.com/golang/go/src go1.16 time/.Secondscip-go gomod github.com/golang/go/src go1.16 time/Second. |
| 34 | httpWriteTimeoutscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/httpWriteTimeout. = 10 * timescip-go gomod github.com/golang/go/src go1.16 time/.Secondscip-go gomod github.com/golang/go/src go1.16 time/Second. |
| 35 | ) |
| 36 | |
| 37 | type HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy# struct { |
| 38 | Namescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Name. string |
| 39 | Addressscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Address. string |
| 40 | Serverscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Server. *httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.Serverscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server# |
| 41 | Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Redirection. *firewallscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/.Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/Redirection# |
| 42 | Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy. *goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ProxyHttpServerscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer# |
| 43 | Scriptscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Script. *HttpProxyScriptscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HttpProxyScript# |
| 44 | CertFilescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#CertFile. string |
| 45 | KeyFilescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#KeyFile. string |
| 46 | Blacklistscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Blacklist. []string |
| 47 | Whitelistscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Whitelist. []string |
| 48 | Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess. *sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/.Sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session# |
| 49 | Stripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Stripper. *SSLStripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/SSLStripper# |
| 50 | |
| 51 | jsHookscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#jsHook. string |
| 52 | isTLSscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isTLS. bool |
| 53 | isRunningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isRunning. bool |
| 54 | doRedirectscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#doRedirect. bool |
| 55 | sniListenerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#sniListener. netscip-go gomod github.com/golang/go/src go1.16 net/.Listenerscip-go gomod github.com/golang/go/src go1.16 net/Listener# |
| 56 | tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#tag. string |
| 57 | } |
| 58 | |
| 59 | func stripPortscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/stripPort().(s string) string { |
| 60 | ix := stringsscip-go gomod github.com/golang/go/src go1.16 strings/.IndexRunescip-go gomod github.com/golang/go/src go1.16 strings/IndexRune().(s, ':') |
| 61 | if ix == -1 { |
| 62 | return s |
| 63 | } |
| 64 | return s[:ix] |
| 65 | } |
| 66 | |
| 67 | type dummyLoggerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dummyLogger# struct { |
| 68 | pscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dummyLogger#p. *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy# |
| 69 | } |
| 70 | |
| 71 | func (l dummyLoggerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dummyLogger#) Printfscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dummyLogger#Printf().(format string, v ...interface{}) { |
| 72 | l.pscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dummyLogger#p..Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().("[goproxy.log] %s", strscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/.Trimscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/str`/Trim().(fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().(format, v...))) |
| 73 | } |
| 74 | |
| 75 | func NewHTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/NewHTTPProxy().(s *sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/.Sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#, tag string) *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy# { |
| 76 | p := &HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#{ |
| 77 | Namescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Name.: "http.proxy", |
| 78 | Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy.: goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.NewProxyHttpServerscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/NewProxyHttpServer().(), |
| 79 | Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess.: s, |
| 80 | Stripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Stripper.: NewSSLStripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/NewSSLStripper().(s, false), |
| 81 | isTLSscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isTLS.: false, |
| 82 | doRedirectscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#doRedirect.: true, |
| 83 | Serverscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Server.: nil, |
| 84 | Blacklistscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Blacklist.: make([]string, 0), |
| 85 | Whitelistscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Whitelist.: make([]string, 0), |
| 86 | tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#tag.: sessionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/.AsTagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/AsTag().(tag), |
| 87 | } |
| 88 | |
| 89 | p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy..Verbosescip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer#Verbose. = false |
| 90 | p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy..Loggerscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer#Logger. = dummyLoggerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dummyLogger#{p} |
| 91 | |
| 92 | p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy..NonproxyHandlerscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer#NonproxyHandler. = httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.HandlerFuncscip-go gomod github.com/golang/go/src go1.16 `net/http`/HandlerFunc#(func(w httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.ResponseWriterscip-go gomod github.com/golang/go/src go1.16 `net/http`/ResponseWriter#, req *httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#) { |
| 93 | if p.doProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#doProxy().(req) { |
| 94 | if !p.isTLSscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isTLS. { |
| 95 | req.URLscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#URL..Schemescip-go gomod github.com/golang/go/src go1.16 `net/url`/URL#Scheme. = "http" |
| 96 | } |
| 97 | req.URLscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#URL..Hostscip-go gomod github.com/golang/go/src go1.16 `net/url`/URL#Host. = req.Hostscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#Host. |
| 98 | p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy..ServeHTTPscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer#ServeHTTP().(w, req) |
| 99 | } |
| 100 | }) |
| 101 | |
| 102 | p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy..OnRequestscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer#OnRequest().().HandleConnectscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ReqProxyConds#HandleConnect().(goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.AlwaysMitmscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/AlwaysMitm.) |
| 103 | p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy..OnRequestscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer#OnRequest().().DoFuncscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ReqProxyConds#DoFunc().(p.onRequestFilterscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#onRequestFilter().) |
| 104 | p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy..OnResponsescip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer#OnResponse().().DoFuncscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyConds#DoFunc().(p.onResponseFilterscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#onResponseFilter().) |
| 105 | |
| 106 | return p |
| 107 | } |
| 108 | |
| 109 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().(format string, args ...interface{}) { |
| 110 | p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Events..Logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Log().(logscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/.DEBUGscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/DEBUG., p.tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#tag.+format, args...) |
| 111 | } |
| 112 | |
| 113 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Info().(format string, args ...interface{}) { |
| 114 | p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Events..Logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Log().(logscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/.INFOscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/INFO., p.tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#tag.+format, args...) |
| 115 | } |
| 116 | |
| 117 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) Warningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Warning().(format string, args ...interface{}) { |
| 118 | p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Events..Logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Log().(logscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/.WARNINGscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/WARNING., p.tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#tag.+format, args...) |
| 119 | } |
| 120 | |
| 121 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) Errorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Error().(format string, args ...interface{}) { |
| 122 | p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Events..Logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Log().(logscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/.ERRORscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/ERROR., p.tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#tag.+format, args...) |
| 123 | } |
| 124 | |
| 125 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) Fatalscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Fatal().(format string, args ...interface{}) { |
| 126 | p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Eventsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Events..Logscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/EventPool#Log().(logscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/.FATALscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/log`/FATAL., p.tagscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#tag.+format, args...) |
| 127 | } |
| 128 | |
| 129 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) doProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#doProxy().(req *httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#) bool { |
| 130 | if req.Hostscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#Host. == "" { |
| 131 | p.Errorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Error().("got request with empty host: %v", req) |
| 132 | return false |
| 133 | } |
| 134 | |
| 135 | hostname := stringsscip-go gomod github.com/golang/go/src go1.16 strings/.Splitscip-go gomod github.com/golang/go/src go1.16 strings/Split().(req.Hostscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#Host., ":")[0] |
| 136 | for _, local := range []string{"localhost", "127.0.0.1"} { |
| 137 | if hostname == local { |
| 138 | p.Errorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Error().("got request with localed host: %s", req.Hostscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#Host.) |
| 139 | return false |
| 140 | } |
| 141 | } |
| 142 | |
| 143 | return true |
| 144 | } |
| 145 | |
| 146 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) shouldProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#shouldProxy().(req *httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#) bool { |
| 147 | hostname := stringsscip-go gomod github.com/golang/go/src go1.16 strings/.Splitscip-go gomod github.com/golang/go/src go1.16 strings/Split().(req.Hostscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#Host., ":")[0] |
| 148 | |
| 149 | // check for the whitelist |
| 150 | for _, expr := range p.Whitelistscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Whitelist. { |
| 151 | if matched, err := filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/.Matchscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/Match().(expr, hostname); err != nil { |
| 152 | p.Errorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Error().("error while using proxy whitelist expression '%s': %v", expr, err) |
| 153 | } else if matched { |
| 154 | p.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().("hostname '%s' matched whitelisted element '%s'", hostname, expr) |
| 155 | return true |
| 156 | } |
| 157 | } |
| 158 | |
| 159 | // then the blacklist |
| 160 | for _, expr := range p.Blacklistscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Blacklist. { |
| 161 | if matched, err := filepathscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/.Matchscip-go gomod github.com/golang/go/src go1.16 `path/filepath`/Match().(expr, hostname); err != nil { |
| 162 | p.Errorscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Error().("error while using proxy blacklist expression '%s': %v", expr, err) |
| 163 | } else if matched { |
| 164 | p.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().("hostname '%s' matched blacklisted element '%s'", hostname, expr) |
| 165 | return false |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | return true |
| 170 | } |
| 171 | |
| 172 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) Configurescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Configure().(address string, proxyPort int, httpPort int, doRedirect bool, scriptPath string, |
| 173 | jsToInject string, stripSSL bool) error { |
| 174 | var err error |
| 175 | |
| 176 | // check if another http(s) proxy is using sslstrip and merge strippers |
| 177 | if stripSSL { |
| 178 | for _, mname := range []string{"http.proxy", "https.proxy"}{ |
| 179 | err, m := p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Modulescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Module().(mname) |
| 180 | if err == nil && m.Runningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Module#Running.() { |
| 181 | var mextra interface{} |
| 182 | var mstripper *SSLStripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/SSLStripper# |
| 183 | mextra = m.Extrascip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Module#Extra.() |
| 184 | mextramap := mextra.(map[string]interface{}) |
| 185 | mstripper = mextramap["stripper"].(*SSLStripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/SSLStripper#) |
| 186 | if mstripper != nil && mstripper.Enabledscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/SSLStripper#Enabled().() { |
| 187 | p.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Info().("found another proxy using sslstrip -> merging strippers...") |
| 188 | p.Stripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Stripper. = mstripper |
| 189 | break |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | } |
| 194 | |
| 195 | p.Stripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Stripper..Enablescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/SSLStripper#Enable().(stripSSL) |
| 196 | p.Addressscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Address. = address |
| 197 | p.doRedirectscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#doRedirect. = doRedirect |
| 198 | p.jsHookscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#jsHook. = "" |
| 199 | |
| 200 | if stringsscip-go gomod github.com/golang/go/src go1.16 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.16 strings/HasPrefix().(jsToInject, "http://") || stringsscip-go gomod github.com/golang/go/src go1.16 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.16 strings/HasPrefix().(jsToInject, "https://") { |
| 201 | p.jsHookscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#jsHook. = fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().("<script src=\"%s\" type=\"text/javascript\"></script></head>", jsToInject) |
| 202 | } else if fsscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/fs`/.Existsscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/fs`/Exists().(jsToInject) { |
| 203 | if data, err := ioutilscip-go gomod github.com/golang/go/src go1.16 `io/ioutil`/.ReadFilescip-go gomod github.com/golang/go/src go1.16 `io/ioutil`/ReadFile().(jsToInject); err != nil { |
| 204 | return err |
| 205 | } else { |
| 206 | jsToInject = string(data) |
| 207 | } |
| 208 | } |
| 209 | |
| 210 | if p.jsHookscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#jsHook. == "" && jsToInject != "" { |
| 211 | if !stringsscip-go gomod github.com/golang/go/src go1.16 strings/.HasPrefixscip-go gomod github.com/golang/go/src go1.16 strings/HasPrefix().(jsToInject, "<script ") { |
| 212 | jsToInject = fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().("<script type=\"text/javascript\">%s</script>", jsToInject) |
| 213 | } |
| 214 | p.jsHookscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#jsHook. = fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().("%s</head>", jsToInject) |
| 215 | } |
| 216 | |
| 217 | if scriptPath != "" { |
| 218 | if err, p.Scriptscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Script. = LoadHttpProxyScriptscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/LoadHttpProxyScript().(scriptPath, p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess.); err != nil { |
| 219 | return err |
| 220 | } else { |
| 221 | p.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().("proxy script %s loaded.", scriptPath) |
| 222 | } |
| 223 | } |
| 224 | |
| 225 | p.Serverscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Server. = &httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.Serverscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#{ |
| 226 | Addrscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#Addr.: fmtscip-go gomod github.com/golang/go/src go1.16 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.16 fmt/Sprintf().("%s:%d", p.Addressscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Address., proxyPort), |
| 227 | Handlerscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#Handler.: p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy., |
| 228 | ReadTimeoutscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#ReadTimeout.: httpReadTimeoutscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/httpReadTimeout., |
| 229 | WriteTimeoutscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#WriteTimeout.: httpWriteTimeoutscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/httpWriteTimeout., |
| 230 | } |
| 231 | |
| 232 | if p.doRedirectscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#doRedirect. { |
| 233 | if !p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Firewallscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Firewall..IsForwardingEnabledscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/FirewallManager#IsForwardingEnabled.() { |
| 234 | p.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Info().("enabling forwarding.") |
| 235 | p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Firewallscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Firewall..EnableForwardingscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/FirewallManager#EnableForwarding.(true) |
| 236 | } |
| 237 | |
| 238 | p.Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Redirection. = firewallscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/.NewRedirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/NewRedirection().(p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Interfacescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Interface..Namescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/network`/Endpoint#Name().(), |
| 239 | "TCP", |
| 240 | httpPort, |
| 241 | p.Addressscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Address., |
| 242 | proxyPort) |
| 243 | |
| 244 | if err := p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Firewallscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Firewall..EnableRedirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/FirewallManager#EnableRedirection.(p.Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Redirection., true); err != nil { |
| 245 | return err |
| 246 | } |
| 247 | |
| 248 | p.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().("applied redirection %s", p.Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Redirection..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/Redirection#String().()) |
| 249 | } else { |
| 250 | p.Warningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Warning().("port redirection disabled, the proxy must be set manually to work") |
| 251 | } |
| 252 | |
| 253 | p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..UnkCmdCallbackscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#UnkCmdCallback. = func(cmd string) bool { |
| 254 | if p.Scriptscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Script. != nil { |
| 255 | return p.Scriptscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Script..OnCommandscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HttpProxyScript#OnCommand().(cmd) |
| 256 | } |
| 257 | return false |
| 258 | } |
| 259 | |
| 260 | return nil |
| 261 | } |
| 262 | |
| 263 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) TLSConfigFromCAscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#TLSConfigFromCA().(ca *tlsscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/.Certificatescip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Certificate#) func(host string, ctx *goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ProxyCtxscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyCtx#) (*tlsscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/.Configscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Config#, error) { |
| 264 | return func(host string, ctx *goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ProxyCtxscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyCtx#) (c *tlsscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/.Configscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Config#, err error) { |
| 265 | parts := stringsscip-go gomod github.com/golang/go/src go1.16 strings/.SplitNscip-go gomod github.com/golang/go/src go1.16 strings/SplitN().(host, ":", 2) |
| 266 | hostname := parts[0] |
| 267 | port := 443 |
| 268 | if len(parts) > 1 { |
| 269 | port, err = strconvscip-go gomod github.com/golang/go/src go1.16 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.16 strconv/Atoi().(parts[1]) |
| 270 | if err != nil { |
| 271 | port = 443 |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | cert := getCachedCertscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/getCachedCert().(hostname, port) |
| 276 | if cert == nil { |
| 277 | p.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Info().("creating spoofed certificate for %s:%d", tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.Yellowscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/Yellow().(hostname), port) |
| 278 | cert, err = btlsscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/tls`/.SignCertificateForHostscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/tls`/SignCertificateForHost().(ca, hostname, port) |
| 279 | if err != nil { |
| 280 | p.Warningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Warning().("cannot sign host certificate with provided CA: %s", err) |
| 281 | return nil, err |
| 282 | } |
| 283 | |
| 284 | setCachedCertscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/setCachedCert().(hostname, port, cert) |
| 285 | } else { |
| 286 | p.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().("serving spoofed certificate for %s:%d", tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.Yellowscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/Yellow().(hostname), port) |
| 287 | } |
| 288 | |
| 289 | config := tlsscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/.Configscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Config#{ |
| 290 | InsecureSkipVerifyscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Config#InsecureSkipVerify.: true, |
| 291 | Certificatesscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Config#Certificates.: []tlsscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/.Certificatescip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Certificate#{*cert}, |
| 292 | } |
| 293 | |
| 294 | return &config, nil |
| 295 | } |
| 296 | } |
| 297 | |
| 298 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) ConfigureTLSscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#ConfigureTLS().(address string, proxyPort int, httpPort int, doRedirect bool, scriptPath string, |
| 299 | certFile string, |
| 300 | keyFile string, jsToInject string, stripSSL bool) (err error) { |
| 301 | if err = p.Configurescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Configure().(address, proxyPort, httpPort, doRedirect, scriptPath, jsToInject, stripSSL); err != nil { |
| 302 | return err |
| 303 | } |
| 304 | |
| 305 | p.isTLSscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isTLS. = true |
| 306 | p.Namescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Name. = "https.proxy" |
| 307 | p.CertFilescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#CertFile. = certFile |
| 308 | p.KeyFilescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#KeyFile. = keyFile |
| 309 | |
| 310 | rawCert, _ := ioutilscip-go gomod github.com/golang/go/src go1.16 `io/ioutil`/.ReadFilescip-go gomod github.com/golang/go/src go1.16 `io/ioutil`/ReadFile().(p.CertFilescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#CertFile.) |
| 311 | rawKey, _ := ioutilscip-go gomod github.com/golang/go/src go1.16 `io/ioutil`/.ReadFilescip-go gomod github.com/golang/go/src go1.16 `io/ioutil`/ReadFile().(p.KeyFilescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#KeyFile.) |
| 312 | ourCa, err := tlsscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/.X509KeyPairscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/X509KeyPair().(rawCert, rawKey) |
| 313 | if err != nil { |
| 314 | return err |
| 315 | } |
| 316 | |
| 317 | if ourCa.Leafscip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Certificate#Leaf., err = x509scip-go gomod github.com/golang/go/src go1.16 `crypto/x509`/.ParseCertificatescip-go gomod github.com/golang/go/src go1.16 `crypto/x509`/ParseCertificate().(ourCa.Certificatescip-go gomod github.com/golang/go/src go1.16 `crypto/tls`/Certificate#Certificate.[0]); err != nil { |
| 318 | return err |
| 319 | } |
| 320 | |
| 321 | goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.GoproxyCascip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/GoproxyCa. = ourCa |
| 322 | goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.OkConnectscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/OkConnect. = &goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ConnectActionscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#{Actionscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#Action.: goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ConnectAcceptscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAccept., TLSConfigscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#TLSConfig.: p.TLSConfigFromCAscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#TLSConfigFromCA().(&ourCa)} |
| 323 | goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.MitmConnectscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/MitmConnect. = &goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ConnectActionscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#{Actionscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#Action.: goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ConnectMitmscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectMitm., TLSConfigscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#TLSConfig.: p.TLSConfigFromCAscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#TLSConfigFromCA().(&ourCa)} |
| 324 | goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.HTTPMitmConnectscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/HTTPMitmConnect. = &goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ConnectActionscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#{Actionscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#Action.: goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ConnectHTTPMitmscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectHTTPMitm., TLSConfigscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#TLSConfig.: p.TLSConfigFromCAscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#TLSConfigFromCA().(&ourCa)} |
| 325 | goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.RejectConnectscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/RejectConnect. = &goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ConnectActionscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#{Actionscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#Action.: goproxyscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/.ConnectRejectscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectReject., TLSConfigscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ConnectAction#TLSConfig.: p.TLSConfigFromCAscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#TLSConfigFromCA().(&ourCa)} |
| 326 | |
| 327 | return nil |
| 328 | } |
| 329 | |
| 330 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) httpWorkerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#httpWorker().() error { |
| 331 | p.isRunningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isRunning. = true |
| 332 | return p.Serverscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Server..ListenAndServescip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#ListenAndServe().() |
| 333 | } |
| 334 | |
| 335 | type dumbResponseWriterscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter# struct { |
| 336 | netscip-go gomod github.com/golang/go/src go1.16 net/.Connscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#Conn. |
| 337 | } |
| 338 | |
| 339 | func (dumb dumbResponseWriterscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#) Headerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#Header().() httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.Headerscip-go gomod github.com/golang/go/src go1.16 `net/http`/Header# { |
| 340 | panic("Header() should not be called on this ResponseWriter") |
| 341 | } |
| 342 | |
| 343 | func (dumb dumbResponseWriterscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#) Writescip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#Write().(buf []byte) (int, error) { |
| 344 | if bytesscip-go gomod github.com/golang/go/src go1.16 bytes/.Equalscip-go gomod github.com/golang/go/src go1.16 bytes/Equal().(buf, []byte("HTTP/1.0 200 OK\r\n\r\n")) { |
| 345 | return len(buf), nil // throw away the HTTP OK response from the faux CONNECT request |
| 346 | } |
| 347 | return dumb.Connscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#Conn..Writescip-go gomod github.com/golang/go/src go1.16 net/Conn#Write().(buf) |
| 348 | } |
| 349 | |
| 350 | func (dumb dumbResponseWriterscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#) WriteHeaderscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#WriteHeader().(code int) { |
| 351 | panic("WriteHeader() should not be called on this ResponseWriter") |
| 352 | } |
| 353 | |
| 354 | func (dumb dumbResponseWriterscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#) Hijackscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#Hijack().() (netscip-go gomod github.com/golang/go/src go1.16 net/.Connscip-go gomod github.com/golang/go/src go1.16 net/Conn#, *bufioscip-go gomod github.com/golang/go/src go1.16 bufio/.ReadWriterscip-go gomod github.com/golang/go/src go1.16 bufio/ReadWriter#, error) { |
| 355 | return dumb, bufioscip-go gomod github.com/golang/go/src go1.16 bufio/.NewReadWriterscip-go gomod github.com/golang/go/src go1.16 bufio/NewReadWriter().(bufioscip-go gomod github.com/golang/go/src go1.16 bufio/.NewReaderscip-go gomod github.com/golang/go/src go1.16 bufio/NewReader().(dumb), bufioscip-go gomod github.com/golang/go/src go1.16 bufio/.NewWriterscip-go gomod github.com/golang/go/src go1.16 bufio/NewWriter().(dumb)), nil |
| 356 | } |
| 357 | |
| 358 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) httpsWorkerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#httpsWorker().() error { |
| 359 | var err error |
| 360 | |
| 361 | // listen to the TLS ClientHello but make it a CONNECT request instead |
| 362 | p.sniListenerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#sniListener., err = netscip-go gomod github.com/golang/go/src go1.16 net/.Listenscip-go gomod github.com/golang/go/src go1.16 net/Listen().("tcp", p.Serverscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Server..Addrscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#Addr.) |
| 363 | if err != nil { |
| 364 | return err |
| 365 | } |
| 366 | |
| 367 | p.isRunningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isRunning. = true |
| 368 | for p.isRunningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isRunning. { |
| 369 | c, err := p.sniListenerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#sniListener..Acceptscip-go gomod github.com/golang/go/src go1.16 net/Listener#Accept().() |
| 370 | if err != nil { |
| 371 | p.Warningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Warning().("error accepting connection: %s.", err) |
| 372 | continue |
| 373 | } |
| 374 | |
| 375 | go func(c netscip-go gomod github.com/golang/go/src go1.16 net/.Connscip-go gomod github.com/golang/go/src go1.16 net/Conn#) { |
| 376 | now := timescip-go gomod github.com/golang/go/src go1.16 time/.Nowscip-go gomod github.com/golang/go/src go1.16 time/Now().() |
| 377 | c.SetReadDeadlinescip-go gomod github.com/golang/go/src go1.16 net/Conn#SetReadDeadline().(now.Addscip-go gomod github.com/golang/go/src go1.16 time/Time#Add().(httpReadTimeoutscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/httpReadTimeout.)) |
| 378 | c.SetWriteDeadlinescip-go gomod github.com/golang/go/src go1.16 net/Conn#SetWriteDeadline().(now.Addscip-go gomod github.com/golang/go/src go1.16 time/Time#Add().(httpWriteTimeoutscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/httpWriteTimeout.)) |
| 379 | |
| 380 | tlsConn, err := vhostscip-go gomod github.com/inconshreveable/go-vhost v1.0.0 `github.com/inconshreveable/go-vhost`/.TLSscip-go gomod github.com/inconshreveable/go-vhost v1.0.0 `github.com/inconshreveable/go-vhost`/TLS().(c) |
| 381 | if err != nil { |
| 382 | p.Warningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Warning().("error reading SNI: %s.", err) |
| 383 | return |
| 384 | } |
| 385 | |
| 386 | hostname := tlsConn.Hostscip-go gomod github.com/inconshreveable/go-vhost v1.0.0 `github.com/inconshreveable/go-vhost`/TLSConn#Host().() |
| 387 | if hostname == "" { |
| 388 | p.Warningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Warning().("client does not support SNI.") |
| 389 | return |
| 390 | } |
| 391 | |
| 392 | p.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().("proxying connection from %s to %s", tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.Boldscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/Bold().(stripPortscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/stripPort().(c.RemoteAddrscip-go gomod github.com/golang/go/src go1.16 net/Conn#RemoteAddr().().Stringscip-go gomod github.com/golang/go/src go1.16 net/Addr#String().())), tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.Yellowscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/Yellow().(hostname)) |
| 393 | |
| 394 | req := &httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.Requestscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#{ |
| 395 | Methodscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#Method.: "CONNECT", |
| 396 | URLscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#URL.: &urlscip-go gomod github.com/golang/go/src go1.16 `net/url`/.URLscip-go gomod github.com/golang/go/src go1.16 `net/url`/URL#{ |
| 397 | Opaquescip-go gomod github.com/golang/go/src go1.16 `net/url`/URL#Opaque.: hostname, |
| 398 | Hostscip-go gomod github.com/golang/go/src go1.16 `net/url`/URL#Host.: netscip-go gomod github.com/golang/go/src go1.16 net/.JoinHostPortscip-go gomod github.com/golang/go/src go1.16 net/JoinHostPort().(hostname, "443"), |
| 399 | }, |
| 400 | Hostscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#Host.: hostname, |
| 401 | Headerscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#Header.: make(httpscip-go gomod github.com/golang/go/src go1.16 `net/http`/.Headerscip-go gomod github.com/golang/go/src go1.16 `net/http`/Header#), |
| 402 | RemoteAddrscip-go gomod github.com/golang/go/src go1.16 `net/http`/Request#RemoteAddr.: c.RemoteAddrscip-go gomod github.com/golang/go/src go1.16 net/Conn#RemoteAddr().().Stringscip-go gomod github.com/golang/go/src go1.16 net/Addr#String().(), |
| 403 | } |
| 404 | p.Proxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Proxy..ServeHTTPscip-go gomod github.com/elazarl/goproxy 8b0c20506380 `github.com/elazarl/goproxy`/ProxyHttpServer#ServeHTTP().(dumbResponseWriterscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/dumbResponseWriter#{tlsConn}, req) |
| 405 | }(c) |
| 406 | } |
| 407 | |
| 408 | return nil |
| 409 | } |
| 410 | |
| 411 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) Startscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Start().() { |
| 412 | go func() { |
| 413 | var err error |
| 414 | |
| 415 | strip := tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.Yellowscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/Yellow().("enabled") |
| 416 | if !p.Stripperscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Stripper..Enabledscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/SSLStripper#Enabled().() { |
| 417 | strip = tuiscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/.Dimscip-go gomod github.com/evilsocket/islazy v1.11.0 `github.com/evilsocket/islazy/tui`/Dim().("disabled") |
| 418 | } |
| 419 | |
| 420 | p.Infoscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Info().("started on %s (sslstrip %s)", p.Serverscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Server..Addrscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#Addr., strip) |
| 421 | |
| 422 | if p.isTLSscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isTLS. { |
| 423 | err = p.httpsWorkerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#httpsWorker().() |
| 424 | } else { |
| 425 | err = p.httpWorkerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#httpWorker().() |
| 426 | } |
| 427 | |
| 428 | if err != nil && err.Error() != "http: Server closed" { |
| 429 | p.Fatalscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Fatal().("%s", err) |
| 430 | } |
| 431 | }() |
| 432 | } |
| 433 | |
| 434 | func (p *HTTPProxyscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#) Stopscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Stop().() error { |
| 435 | if p.doRedirectscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#doRedirect. && p.Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Redirection. != nil { |
| 436 | p.Debugscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Debug().("disabling redirection %s", p.Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Redirection..Stringscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/Redirection#String().()) |
| 437 | if err := p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..Firewallscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#Firewall..EnableRedirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/firewall`/FirewallManager#EnableRedirection.(p.Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Redirection., false); err != nil { |
| 438 | return err |
| 439 | } |
| 440 | p.Redirectionscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Redirection. = nil |
| 441 | } |
| 442 | |
| 443 | p.Sessscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Sess..UnkCmdCallbackscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/session`/Session#UnkCmdCallback. = nil |
| 444 | |
| 445 | if p.isTLSscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isTLS. { |
| 446 | p.isRunningscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#isRunning. = false |
| 447 | p.sniListenerscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#sniListener..Closescip-go gomod github.com/golang/go/src go1.16 net/Listener#Close().() |
| 448 | return nil |
| 449 | } else { |
| 450 | ctx, cancel := contextscip-go gomod github.com/golang/go/src go1.16 context/.WithTimeoutscip-go gomod github.com/golang/go/src go1.16 context/WithTimeout().(contextscip-go gomod github.com/golang/go/src go1.16 context/.Backgroundscip-go gomod github.com/golang/go/src go1.16 context/Background().(), 5*timescip-go gomod github.com/golang/go/src go1.16 time/.Secondscip-go gomod github.com/golang/go/src go1.16 time/Second.) |
| 451 | defer cancel() |
| 452 | return p.Serverscip-go gomod github.com/bettercap/bettercap . `github.com/bettercap/bettercap/modules/http_proxy`/HTTPProxy#Server..Shutdownscip-go gomod github.com/golang/go/src go1.16 `net/http`/Server#Shutdown().(ctx) |
| 453 | } |
| 454 | } |