mirror of
https://github.com/bettercap/bettercap
synced 2025-08-14 10:46:57 -07:00
new: implementing IsForwardingEnabled for windows firewall
This commit is contained in:
parent
c87e1e7f1d
commit
5887883683
4 changed files with 14 additions and 6 deletions
|
@ -10,6 +10,7 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/core"
|
||||
"github.com/evilsocket/bettercap-ng/net"
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -18,12 +19,14 @@ var (
|
|||
)
|
||||
|
||||
type PfFirewall struct {
|
||||
iface *net.Endpoint
|
||||
filename string
|
||||
forwarding bool
|
||||
}
|
||||
|
||||
func Make() FirewallManager {
|
||||
func Make(iface *net.Endpoint) FirewallManager {
|
||||
firewall := &PfFirewall{
|
||||
iface: iface,
|
||||
filename: pfFilePath,
|
||||
forwarding: false,
|
||||
}
|
||||
|
|
|
@ -6,9 +6,11 @@ import (
|
|||
"os"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/core"
|
||||
"github.com/evilsocket/bettercap-ng/net"
|
||||
)
|
||||
|
||||
type LinuxFirewall struct {
|
||||
iface *net.Endpoint
|
||||
forwarding bool
|
||||
redirections map[string]*Redirection
|
||||
}
|
||||
|
@ -17,8 +19,9 @@ const (
|
|||
IPV4ForwardingFile = "/proc/sys/net/ipv4/ip_forward"
|
||||
)
|
||||
|
||||
func Make() FirewallManager {
|
||||
func Make(iface *net.Endpoint) FirewallManager {
|
||||
firewall := &LinuxFirewall{
|
||||
iface: iface,
|
||||
forwarding: false,
|
||||
redirections: make(map[string]*Redirection, 0),
|
||||
}
|
||||
|
|
|
@ -5,16 +5,18 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/evilsocket/bettercap-ng/core"
|
||||
"github.com/evilsocket/bettercap-ng/session"
|
||||
"github.com/evilsocket/bettercap-ng/net"
|
||||
)
|
||||
|
||||
type WindowsFirewall struct {
|
||||
iface *net.Enpoint
|
||||
forwarding bool
|
||||
redirections map[string]*Redirection
|
||||
}
|
||||
|
||||
func Make() FirewallManager {
|
||||
func Make(iface *net.Endpoint) FirewallManager {
|
||||
firewall := &WindowsFirewall{
|
||||
iface: iface,
|
||||
forwarding: false,
|
||||
redirections: make(map[string]*Redirection, 0),
|
||||
}
|
||||
|
@ -34,7 +36,7 @@ func (f WindowsFirewall) IsForwardingEnabled() bool {
|
|||
}
|
||||
|
||||
func (f WindowsFirewall) EnableForwarding(enabled bool) error {
|
||||
fmt.Printf("iface idx=%d\n", session.I.Interface.Index)
|
||||
fmt.Printf("iface idx=%d\n", f.iface.Index)
|
||||
return fmt.Errorf("Not implemented")
|
||||
}
|
||||
|
||||
|
|
|
@ -224,7 +224,7 @@ func (s *Session) Start() error {
|
|||
s.Env.Set("gateway.mac", s.Gateway.HwAddress)
|
||||
|
||||
s.Targets = NewTargets(s, s.Interface, s.Gateway)
|
||||
s.Firewall = firewall.Make()
|
||||
s.Firewall = firewall.Make(s.Interface)
|
||||
|
||||
if err := s.setupInput(); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue