Last active
August 29, 2015 14:16
-
-
Save linktohack/64ff0952b1d1c48c3c42 to your computer and use it in GitHub Desktop.
tor and socks proxy alias for OS X
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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