From 6bac5a7203c8650f9e208597d88fa669d9c3f49f Mon Sep 17 00:00:00 2001 From: evilsocket Date: Tue, 1 Dec 2015 19:58:39 +0100 Subject: [PATCH] Fixed #78: Issue with iptables when starting http proxy --- lib/bettercap/firewalls/linux.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/bettercap/firewalls/linux.rb b/lib/bettercap/firewalls/linux.rb index 771e25ec..b6b0d839 100644 --- a/lib/bettercap/firewalls/linux.rb +++ b/lib/bettercap/firewalls/linux.rb @@ -31,14 +31,14 @@ def add_port_redirection( iface, proto, from, addr, to ) # accept all shell.execute('iptables -P FORWARD ACCEPT') # add redirection - shell.execute("iptables -t nat -A PREROUTING -i #{iface} -p #{proto} --dport #{from} -j REDIRECT --to #{addr}:#{to}") + shell.execute("iptables -t nat -A PREROUTING -i #{iface} -p #{proto} --dport #{from} -j DNAT --to #{addr}:#{to}") end def del_port_redirection( iface, proto, from, addr, to ) # remove post route shell.execute('iptables -t nat -D POSTROUTING -s 0/0 -j MASQUERADE') # remove redirection - shell.execute("iptables -t nat -D PREROUTING -i #{iface} -p #{proto} --dport #{from} -j REDIRECT --to #{addr}:#{to}") + shell.execute("iptables -t nat -D PREROUTING -i #{iface} -p #{proto} --dport #{from} -j DNAT --to #{addr}:#{to}") end private