Skip to content

Instantly share code, notes, and snippets.

@ayakix
Created March 19, 2019 03:55
Show Gist options
  • Save ayakix/f1c98e4bc99a96f6b710c18edc3b5f11 to your computer and use it in GitHub Desktop.
Save ayakix/f1c98e4bc99a96f6b710c18edc3b5f11 to your computer and use it in GitHub Desktop.
mitmproxy launcher
#!/bin/sh
set -e
proxy_on() {
networksetup -setwebproxy Wi-Fi 0.0.0.0 8080
# networksetup -setwebproxy Wi-Fi localhost 8080
networksetup -setwebproxystate Wi-Fi on
networksetup -setsecurewebproxy Wi-Fi 0.0.0.0 8080
# networksetup -setsecurewebproxy Wi-Fi localhost 8080
networksetup -setsecurewebproxystate Wi-Fi on
}
proxy_off() {
retval=$?
networksetup -setwebproxystate Wi-Fi off
networksetup -setsecurewebproxystate Wi-Fi off
exit $retval
}
trap proxy_off INT QUIT TERM EXIT
proxy_on
mitmproxy -p 8080 "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment