Skip to content
This repository has been archived by the owner on Feb 28, 2018. It is now read-only.

Commit

Permalink
Fixed #78: Issue with iptables when starting http proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
evilsocket committed Dec 1, 2015
1 parent bcd7af3 commit 6bac5a7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/bettercap/firewalls/linux.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6bac5a7

Please sign in to comment.