Really basic transproxying on localhost.

When regenerating outgoing connections, we set TTL=42 to prevent re-proxying
of requests.  That's a little hacky, but at least it avoids infinite loops.
This commit is contained in:
Avery Pennarun
2010-05-01 20:03:50 -04:00
parent a818105dfe
commit 72ed385b7f
3 changed files with 159 additions and 7 deletions

29
main.py
View File

@ -1,2 +1,29 @@
#!/usr/bin/env python
import ssh, options
import sys
import options, client
optspec = """
sshuttle [-l [ip:]port] [-r [username@]sshserver] <subnets...>
--
l,listen= transproxy to this ip address and port number [default=0]
r,remote= ssh hostname (and optional username) of remote sshuttle server
server [internal use only]
iptables [internal use only]
"""
o = options.Options('sshuttle', optspec)
(opt, flags, extra) = o.parse(sys.argv[1:])
if opt.server:
o.fatal('server mode not implemented yet')
sys.exit(1)
elif opt.iptables:
o.fatal('iptables mode not implemented yet')
sys.exit(1)
else:
if len(extra) < 1:
o.fatal('at least one argument expected')
remotename = extra[0]
if remotename == '' or remotename == '-':
remotename = None
subnets = extra[1:]
sys.exit(client.main(remotename, subnets))