mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
new: implementing IsForwardingEnabled for windows firewall
This commit is contained in:
parent
2e65b0d50f
commit
484d41c519
1 changed files with 10 additions and 2 deletions
|
@ -36,8 +36,16 @@ func (f WindowsFirewall) IsForwardingEnabled() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f WindowsFirewall) EnableForwarding(enabled bool) error {
|
func (f WindowsFirewall) EnableForwarding(enabled bool) error {
|
||||||
fmt.Printf("iface idx=%d\n", f.iface.Index)
|
out, err := core.Exec("netsh", []string{"interface", "ipv4", "set", "interface", fmt.Sprintf("%d", f.iface.Index), fmt.Sprintf("forwarding=\"%s\"", enabled)})
|
||||||
return fmt.Errorf("Not implemented")
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if strings.Contains(out, "OK") == false {
|
||||||
|
return fmt.Errorf("Unexpected netsh output: %s", out)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f *WindowsFirewall) EnableRedirection(r *Redirection, enabled bool) error {
|
func (f *WindowsFirewall) EnableRedirection(r *Redirection, enabled bool) error {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue