MCPcopy
hub / github.com/bettercap/bettercap / NewPacketProxy

Function NewPacketProxy

modules/packet_proxy/packet_proxy_linux.go:35–76  ·  view source on GitHub ↗
(s *session.Session)

Source from the content-addressed store, hash-verified

33var mod *PacketProxy
34
35func NewPacketProxy(s *session.Session) *PacketProxy {
36 mod = &PacketProxy{
37 SessionModule: session.NewSessionModule("packet.proxy", s),
38 queue: nil,
39 queueCb: nil,
40 queueNum: 0,
41 chainName: "OUTPUT",
42 }
43
44 mod.AddHandler(session.NewModuleHandler("packet.proxy on", "",
45 "Start the NFQUEUE based packet proxy.",
46 func(args []string) error {
47 return mod.Start()
48 }))
49
50 mod.AddHandler(session.NewModuleHandler("packet.proxy off", "",
51 "Stop the NFQUEUE based packet proxy.",
52 func(args []string) error {
53 return mod.Stop()
54 }))
55
56 mod.AddParam(session.NewIntParameter("packet.proxy.queue.num",
57 "0",
58 "NFQUEUE number to bind to."))
59
60 mod.AddParam(session.NewStringParameter("packet.proxy.chain",
61 "OUTPUT",
62 "",
63 "Chain name of the iptables rule."))
64
65 mod.AddParam(session.NewStringParameter("packet.proxy.plugin",
66 "",
67 "",
68 "Go plugin file to load and call for every packet."))
69
70 mod.AddParam(session.NewStringParameter("packet.proxy.rule",
71 "",
72 "",
73 "Any additional iptables rule to make the queue more selective (ex. --destination 8.8.8.8)."))
74
75 return mod
76}
77
78func (mod PacketProxy) Name() string {
79 return "packet.proxy"

Callers 1

LoadModulesFunction · 0.92

Calls 8

NewSessionModuleFunction · 0.92
NewModuleHandlerFunction · 0.92
NewIntParameterFunction · 0.92
NewStringParameterFunction · 0.92
AddHandlerMethod · 0.80
AddParamMethod · 0.80
StartMethod · 0.65
StopMethod · 0.65

Tested by

no test coverage detected