Skip to content

Instantly share code, notes, and snippets.

@linktohack
Last active August 29, 2015 14:16
Embed
What would you like to do?
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