mirror of
https://github.com/bettercap/bettercap
synced 2025-08-20 13:33:21 -07:00
fix: fixed win32 fw rule according to stack overflow (still doesn't work, ref #45)
This commit is contained in:
parent
9ed70d6d90
commit
1ec925fd40
1 changed files with 8 additions and 16 deletions
|
@ -53,26 +53,18 @@ func (f WindowsFirewall) EnableForwarding(enabled bool) error {
|
|||
}
|
||||
|
||||
func (f WindowsFirewall) generateRule(r *Redirection, enabled bool) []string {
|
||||
return []string{
|
||||
// https://stackoverflow.com/questions/24646165/netsh-port-forwarding-from-local-port-to-local-port-not-working
|
||||
rule := []string{
|
||||
fmt.Sprintf("listenport=%d", r.SrcPort),
|
||||
fmt.Sprintf("connectport=%d", r.DstPort),
|
||||
fmt.Sprintf("connectaddress=%s", r.DstAddress),
|
||||
fmt.Sprintf("protocol=%s", r.Protocol),
|
||||
}
|
||||
/*
|
||||
rule := []string{
|
||||
"listenaddress=0.0.0.0",
|
||||
fmt.Sprintf("listenport=%d", r.SrcPort),
|
||||
}
|
||||
|
||||
if enabled == true {
|
||||
rule = append(rule, fmt.Sprintf("protocol=%s", r.Protocol))
|
||||
rule = append(rule, fmt.Sprintf("connectport=%d", r.DstPort))
|
||||
rule = append(rule, fmt.Sprintf("connectaddress=%s", r.DstAddress))
|
||||
}
|
||||
if enabled == true {
|
||||
rule = append(rule, fmt.Sprintf("connectport=%d", r.DstPort))
|
||||
rule = append(rule, fmt.Sprintf("connectaddress=%s", r.DstAddress))
|
||||
rule = append(rule, fmt.Sprintf("protocol=%s", r.Protocol))
|
||||
}
|
||||
|
||||
return rule
|
||||
*/
|
||||
return rule
|
||||
}
|
||||
|
||||
func (f *WindowsFirewall) AllowPort(port int, address string, proto string, allow bool) error {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue