MCPcopy
hub / github.com/bettercap/bettercap / NewHttpProxy

Function NewHttpProxy

modules/http_proxy/http_proxy.go:14–72  ·  view source on GitHub ↗
(s *session.Session)

Source from the content-addressed store, hash-verified

12}
13
14func NewHttpProxy(s *session.Session) *HttpProxy {
15 mod := &HttpProxy{
16 SessionModule: session.NewSessionModule("http.proxy", s),
17 proxy: NewHTTPProxy(s, "http.proxy"),
18 }
19
20 mod.AddParam(session.NewIntParameter("http.port",
21 "80",
22 "HTTP port to redirect when the proxy is activated."))
23
24 mod.AddParam(session.NewStringParameter("http.proxy.address",
25 session.ParamIfaceAddress,
26 session.IPv4Validator,
27 "Address to bind the HTTP proxy to."))
28
29 mod.AddParam(session.NewIntParameter("http.proxy.port",
30 "8080",
31 "Port to bind the HTTP proxy to."))
32
33 mod.AddParam(session.NewBoolParameter("http.proxy.redirect",
34 "true",
35 "Enable or disable port redirection with iptables."))
36
37 mod.AddParam(session.NewStringParameter("http.proxy.script",
38 "",
39 "",
40 "Path of a proxy JS script."))
41
42 mod.AddParam(session.NewStringParameter("http.proxy.injectjs",
43 "",
44 "",
45 "URL, path or javascript code to inject into every HTML page."))
46
47 mod.AddParam(session.NewStringParameter("http.proxy.blacklist", "", "",
48 "Comma separated list of hostnames to skip while proxying (wildcard expressions can be used)."))
49
50 mod.AddParam(session.NewStringParameter("http.proxy.whitelist", "", "",
51 "Comma separated list of hostnames to proxy if the blacklist is used (wildcard expressions can be used)."))
52
53 mod.AddParam(session.NewBoolParameter("http.proxy.sslstrip",
54 "false",
55 "Enable or disable SSL stripping."))
56
57 mod.AddHandler(session.NewModuleHandler("http.proxy on", "",
58 "Start HTTP proxy.",
59 func(args []string) error {
60 return mod.Start()
61 }))
62
63 mod.AddHandler(session.NewModuleHandler("http.proxy off", "",
64 "Stop HTTP proxy.",
65 func(args []string) error {
66 return mod.Stop()
67 }))
68
69 mod.InitState("stripper")
70
71 return mod

Callers 5

LoadModulesFunction · 0.92
TestNewHttpProxyFunction · 0.85
TestHttpProxyConfigureFunction · 0.85
TestHttpProxyStartStopFunction · 0.85

Calls 11

StartMethod · 0.95
StopMethod · 0.95
NewSessionModuleFunction · 0.92
NewIntParameterFunction · 0.92
NewStringParameterFunction · 0.92
NewBoolParameterFunction · 0.92
NewModuleHandlerFunction · 0.92
NewHTTPProxyFunction · 0.85
AddParamMethod · 0.80
AddHandlerMethod · 0.80
InitStateMethod · 0.80

Tested by 4

TestNewHttpProxyFunction · 0.68
TestHttpProxyConfigureFunction · 0.68
TestHttpProxyStartStopFunction · 0.68