diff options
author | Avery Pennarun <apenwarr@gmail.com> | 2010-05-01 20:03:50 -0400 |
---|---|---|
committer | Avery Pennarun <apenwarr@gmail.com> | 2010-05-01 20:03:50 -0400 |
commit | 72ed385b7f0200e9d4cf4fa4f12c8f017fd4c362 (patch) | |
tree | adb80b62fbf005bb8f33f2d5c08ec0fa7aa65f27 /main.py | |
parent | a818105dfe66c91823e72436a1ba4a77f2648725 (diff) |
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.
Diffstat (limited to 'main.py')
-rwxr-xr-x | main.py | 29 |
1 files changed, 28 insertions, 1 deletions
@@ -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)) |