From 9ed70d6d902123f78f324e7a651cb1588caa4208 Mon Sep 17 00:00:00 2001 From: evilsocket Date: Sun, 11 Feb 2018 00:51:12 +0100 Subject: [PATCH] balls --- firewall/firewall_windows.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/firewall/firewall_windows.go b/firewall/firewall_windows.go index 1acf0cd9..77becbb6 100644 --- a/firewall/firewall_windows.go +++ b/firewall/firewall_windows.go @@ -53,18 +53,26 @@ func (f WindowsFirewall) EnableForwarding(enabled bool) error { } func (f WindowsFirewall) generateRule(r *Redirection, enabled bool) []string { - rule := []string{ - "listenaddress=0.0.0.0", + return []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("protocol=%s", r.Protocol)) + rule = append(rule, fmt.Sprintf("connectport=%d", r.DstPort)) + rule = append(rule, fmt.Sprintf("connectaddress=%s", r.DstAddress)) + } - return rule + return rule + */ } func (f *WindowsFirewall) AllowPort(port int, address string, proto string, allow bool) error {