Skip to content

Instantly share code, notes, and snippets.

@grimen
Last active August 29, 2015 14:26
Show Gist options
  • Save grimen/84016d8f697767af2a9a to your computer and use it in GitHub Desktop.
Save grimen/84016d8f697767af2a9a to your computer and use it in GitHub Desktop.
$ ./mitmiproxy.sh
#!/bin/bash -x
sudo sysctl -w net.inet.ip.forwarding=1
# sudo sysctl -w net.inet.ip.scopedroute=0
## OSX can't change the net.inet.ip.scopedroute kernel flag in user space so I used:
## sudo defaults write "/Library/Preferences/SystemConfiguration/com.apple.Boot" "Kernel Flags" "net.inet.ip.scopedroute=0
## and then rebooted
sudo defaults read /Library/Preferences/SystemConfiguration/com.apple.Boot
cat > pf.conf << _EOF_
rdr on en0 inet proto tcp to any port 80 -> 127.0.0.1 port 8085
rdr on en0 inet proto tcp to any port 443 -> 127.0.0.1 port 8085
_EOF_
cat pf.conf
sudo pfctl -d
sudo pfctl -f pf.conf
sudo pfctl -e
mitmproxy -T --host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment