Skip to content

Instantly share code, notes, and snippets.

@linktohack
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save linktohack/64ff0952b1d1c48c3c42 to your computer and use it in GitHub Desktop.
Save linktohack/64ff0952b1d1c48c3c42 to your computer and use it in GitHub Desktop.
tor and socks proxy alias for OS X
function t () {
INTERFACE=Wi-Fi
sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 9050 off
sudo networksetup -setsocksfirewallproxystate $INTERFACE on
if ! [ -z $1 ]; then
mv /usr/local/etc/tor/torrc{,.t} 2>&1 > /dev/null
echo "ExitNodes {$1}" | tee /usr/local/etc/tor/torrc
fi
tor
if ! [ -z $1 ]; then
rm -rf /usr/local/etc/tor/torrc
mv /usr/local/etc/tor/torrc{.t,} 2>&1 > /dev/null
fi
sudo networksetup -setsocksfirewallproxystate $INTERFACE off
}
function s () {
INTERFACE=Wi-Fi
PORT=${1:-1080}
trap break SIGINT SIGTERM
sudo networksetup -setsocksfirewallproxy $INTERFACE 127.0.0.1 $PORT off
sudo networksetup -setsocksfirewallproxystate $INTERFACE on
while true; do; done
sudo networksetup -setsocksfirewallproxystate $INTERFACE off
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment