Skip to content

Instantly share code, notes, and snippets.

@bitboxer bitboxer/network-socks
Last active Aug 29, 2015

Embed
What would you like to do?
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
You can’t perform that action at this time.