Created
April 14, 2015 01:48
-
-
Save ptantiku/e2a5169fff40ca027bfc to your computer and use it in GitHub Desktop.
MITM setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# flush all iptables | |
iptables -F | |
iptables -t nat -F | |
# enable port forwarding | |
echo 1 > /proc/sys/net/ipv4/ip_forward | |
# set NAT: intranet --> eth1 --> MITM --> eth0 --> internet | |
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE | |
iptables -A FORWARD -i eth1 -j ACCEPT | |
# route HTTP/HTTPS traffic to port 8080 | |
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 80 -j REDIRECT --to-port 8080 | |
iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 443 -j REDIRECT --to-port 8080 | |
# start MITM proxy on port 8080 | |
# (-T = Transparent Mode) | |
mitmproxy -T |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
only for this scenario:
intranet --> eth1 --> MITM --> eth0 --> internet