Skip to content

Instantly share code, notes, and snippets.

@flashingpumpkin
Created June 4, 2012 09:40
Show Gist options
  • Save flashingpumpkin/2867483 to your computer and use it in GitHub Desktop.
Save flashingpumpkin/2867483 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
import sys
import os
import optparse
parser = optparse.OptionParser()
parser.add_option('-p','--port',help = "Port number locally", default = 8888)
if __name__ == "__main__":
opts, args = parser.parse_args()
print opts, args
if not len(args) == 1:
parser.print_usage()
sys.exit(0)
os.popen('ssh -NfD %s %s' % (opts.port,args[0] ))
@flashingpumpkin
Copy link
Author

run proxy.py username@host -p 8888 to set up a SOCKS proxy listening locally on port 8888.

@dbrgn
Copy link

dbrgn commented Jun 4, 2012

This is pretty trivial stuff. Why not use the SSH command directly? :)

Also, there's https://github.com/apenwarr/sshuttle, but I've never tried it out yet.

@flashingpumpkin
Copy link
Author

True true. Keeps me from remembering the SSH flags though. :)

@dbrgn
Copy link

dbrgn commented Jun 4, 2012

.bashrc:

alias proxy="ssh -NfD $1 $2"

:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment