new: implementing IsForwardingEnabled for windows firewall

This commit is contained in:
evilsocket 2018-02-08 01:20:10 +01:00
commit 484d41c519

View file

@ -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 {