Skip to content

Instantly share code, notes, and snippets.

@d0ugal
Created May 11, 2011 10:01
Show Gist options
  • Save d0ugal/966226 to your computer and use it in GitHub Desktop.
Save d0ugal/966226 to your computer and use it in GitHub Desktop.
SOCKS Proxy
browsesecure() {
python <<SWITCH
import sys
from subprocess import Popen, call, PIPE
import time
def switch_location(name):
call(['scselect', name], stdout=open('/dev/null', 'w'))
print "Switched to %s" % name
switch_location('SOCK Proxied Public')
time.sleep(5)
print 'SOCKS Proxy on localhost:7890'
try:
call(['ssh', '-ND', '7890', 'xxx.xxx.xxx.xxx'])
except:
pass
finally:
switch_location("Automatic")
SWITCH
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment