MCPcopy Index your code
hub / github.com/bettercap/bettercap / runRule

Method runRule

modules/packet_proxy/packet_proxy_linux.go:99–123  ·  view source on GitHub ↗
(enable bool)

Source from the content-addressed store, hash-verified

97}
98
99func (mod *PacketProxy) runRule(enable bool) (err error) {
100 action := "-I"
101 if !enable {
102 action = "-D"
103 }
104
105 args := []string{
106 action, mod.chainName,
107 }
108
109 if mod.rule != "" {
110 rule := strings.Split(mod.rule, " ")
111 args = append(args, rule...)
112 }
113
114 args = append(args, []string{
115 "-j", "NFQUEUE",
116 "--queue-num", fmt.Sprintf("%d", mod.queueNum),
117 }...)
118
119 mod.Debug("iptables %s", args)
120
121 _, err = core.Exec("iptables", args)
122 return
123}
124
125func (mod *PacketProxy) Configure() (err error) {
126 mod.destroyQueue()

Callers 2

ConfigureMethod · 0.95
StopMethod · 0.95

Calls 2

ExecFunction · 0.92
DebugMethod · 0.45

Tested by

no test coverage detected