Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@bitboxer
Last active August 29, 2015 14:11
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 bitboxer/81a89e34fe0716214f32 to your computer and use it in GitHub Desktop.
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
#!/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