mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 02:36:57 -07:00
misc: small fix or general refactoring i did not bother commenting
This commit is contained in:
parent
8025410f77
commit
fa713eb68c
1 changed files with 6 additions and 2 deletions
|
@ -29,6 +29,7 @@ func Make(iface *network.Endpoint) FirewallManager {
|
|||
iface: iface,
|
||||
filename: pfFilePath,
|
||||
forwarding: false,
|
||||
enabled: false,
|
||||
}
|
||||
|
||||
firewall.forwarding = firewall.IsForwardingEnabled()
|
||||
|
@ -108,7 +109,8 @@ func (f PfFirewall) generateRule(r *Redirection) string {
|
|||
r.Interface, r.Protocol, src_a, r.SrcPort, dst_a, r.DstPort)
|
||||
}
|
||||
|
||||
func (f PfFirewall) enable(enabled bool) {
|
||||
func (f *PfFirewall) enable(enabled bool) {
|
||||
f.enabled = enabled
|
||||
if enabled {
|
||||
core.Exec("pfctl", []string{"-e"})
|
||||
} else {
|
||||
|
@ -166,6 +168,8 @@ func (f PfFirewall) EnableRedirection(r *Redirection, enabled bool) error {
|
|||
|
||||
func (f PfFirewall) Restore() {
|
||||
f.EnableForwarding(f.forwarding)
|
||||
f.enable(false)
|
||||
if f.enabled {
|
||||
f.enable(false)
|
||||
}
|
||||
os.Remove(f.filename)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue