mirror of
https://github.com/bettercap/bettercap
synced 2025-07-06 04:52:10 -07:00
refact: simplified firewall interface
This commit is contained in:
parent
f140520037
commit
2d9764d026
3 changed files with 1 additions and 21 deletions
|
@ -3,8 +3,6 @@ package firewall
|
|||
type FirewallManager interface {
|
||||
IsForwardingEnabled() bool
|
||||
EnableForwarding(enabled bool) error
|
||||
EnableIcmpBcast(enabled bool) error
|
||||
EnableSendRedirects(enabled bool) error
|
||||
EnableRedirection(r *Redirection, enabled bool) error
|
||||
Restore()
|
||||
}
|
||||
|
|
|
@ -89,14 +89,6 @@ func (f PfFirewall) EnableForwarding(enabled bool) error {
|
|||
return f.enableParam("net.inet.ip.forwarding", enabled)
|
||||
}
|
||||
|
||||
func (f PfFirewall) EnableIcmpBcast(enabled bool) error {
|
||||
return f.enableParam("net.inet.icmp.bmcastecho", enabled)
|
||||
}
|
||||
|
||||
func (f PfFirewall) EnableSendRedirects(enabled bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f PfFirewall) generateRule(r *Redirection) string {
|
||||
src_a := "any"
|
||||
dst_a := "any"
|
||||
|
|
|
@ -15,8 +15,6 @@ type LinuxFirewall struct {
|
|||
|
||||
const (
|
||||
IPV4ForwardingFile = "/proc/sys/net/ipv4/ip_forward"
|
||||
IPV4ICMPBcastFile = "/proc/sys/net/ipv4/icmp_echo_ignore_broadcasts"
|
||||
IPV4SendRedirectsFile = "/proc/sys/net/ipv4/conf/all/send_redirects"
|
||||
)
|
||||
|
||||
func Make() FirewallManager {
|
||||
|
@ -64,14 +62,6 @@ func (f LinuxFirewall) EnableForwarding(enabled bool) error {
|
|||
return f.enableFeature(IPV4ForwardingFile, enabled)
|
||||
}
|
||||
|
||||
func (f LinuxFirewall) EnableIcmpBcast(enabled bool) error {
|
||||
return f.enableFeature(IPV4ICMPBcastFile, enabled)
|
||||
}
|
||||
|
||||
func (f LinuxFirewall) EnableSendRedirects(enabled bool) error {
|
||||
return f.enableFeature(IPV4SendRedirectsFile, enabled)
|
||||
}
|
||||
|
||||
func (f *LinuxFirewall) EnableRedirection(r *Redirection, enabled bool) error {
|
||||
var opts []string
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue