Last active
August 29, 2015 14:11
-
-
Save bitboxer/81a89e34fe0716214f32 to your computer and use it in GitHub Desktop.
Enable Socks on all network devices and create ssh connection, remove it afterwards
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
#!/bin/sh | |
echo "Setting up Socks Network" | |
networksetup listallnetworkservices|grep -v "*"|while read device | |
do | |
echo "$device" | |
sudo networksetup -setsocksfirewallproxy "$device" localhost 8080 | |
sudo networksetup -setsocksfirewallproxystate "$device" on | |
done | |
echo "Connecting to Socks" | |
ssh -ND 8080 USER@SERVER | |
echo "Resetting Network Settings" | |
networksetup listallnetworkservices|grep -v "*"|while read device | |
do | |
echo "$device" | |
sudo networksetup -setsocksfirewallproxy "$device" empty | |
sudo networksetup -setsocksfirewallproxystate "$device" off | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment