Skip to content

Instantly share code, notes, and snippets.

@ptantiku
Created April 14, 2015 01:48
Show Gist options
  • Save ptantiku/e2a5169fff40ca027bfc to your computer and use it in GitHub Desktop.
Save ptantiku/e2a5169fff40ca027bfc to your computer and use it in GitHub Desktop.
MITM setup
# 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
@ptantiku
Copy link
Author

only for this scenario:
intranet --> eth1 --> MITM --> eth0 --> internet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment