diff options
author | chocolateboy <chocolate@cpan.org> | 2010-09-03 15:46:25 +0100 |
---|---|---|
committer | Avery Pennarun <apenwarr@gmail.com> | 2010-09-03 23:00:26 -0700 |
commit | ee74110cffe09a0127aac68f5a29d06bf33ea7d8 (patch) | |
tree | 3f9615ced81a7f41018bf9a850c4f81e2ff0375c | |
parent | 5bf8687ce37dcd5bddd50fb38daaeae8c5215a9a (diff) |
add option to allow the remote python binary's name/path to be specified
-rw-r--r-- | client.py | 8 | ||||
-rwxr-xr-x | main.py | 2 | ||||
-rw-r--r-- | ssh.py | 6 |
3 files changed, 9 insertions, 7 deletions
@@ -92,7 +92,7 @@ class FirewallClient: raise Fatal('cleanup: %r returned %d' % (self.argv, rv)) -def _main(listener, fw, use_server, remotename, seed_hosts, auto_nets): +def _main(listener, fw, use_server, remotename, python, seed_hosts, auto_nets): handlers = [] if use_server: if helpers.verbose >= 1: @@ -100,7 +100,7 @@ def _main(listener, fw, use_server, remotename, seed_hosts, auto_nets): else: helpers.logprefix = 'client: ' debug1('connecting to server...\n') - (serverproc, serversock) = ssh.connect(remotename) + (serverproc, serversock) = ssh.connect(remotename, python) mux = Mux(serversock, serversock) handlers.append(mux) @@ -188,7 +188,7 @@ def _main(listener, fw, use_server, remotename, seed_hosts, auto_nets): mux.check_fullness() -def main(listenip, use_server, remotename, seed_hosts, auto_nets, +def main(listenip, use_server, remotename, python, seed_hosts, auto_nets, subnets_include, subnets_exclude): debug1('Starting sshuttle proxy.\n') listener = socket.socket() @@ -220,6 +220,6 @@ def main(listenip, use_server, remotename, seed_hosts, auto_nets, try: return _main(listener, fw, use_server, remotename, - seed_hosts, auto_nets) + python, seed_hosts, auto_nets) finally: fw.done() @@ -52,6 +52,7 @@ sshuttle --server l,listen= transproxy to this ip address and port number [0.0.0.0:0] H,auto-hosts scan for remote hostnames and update local /etc/hosts N,auto-nets automatically determine subnets to route +python= specify the name/path of the python interpreter on the remote server [python] r,remote= ssh hostname (and optional username) of remote sshuttle server x,exclude= exclude this subnet (can be used more than once) v,verbose increase debug message verbosity @@ -99,6 +100,7 @@ try: sys.exit(client.main(parse_ipport(opt.listen or '0.0.0.0:0'), not opt.noserver, remotename, + (opt.python or "python"), sh, opt.auto_nets, parse_subnets(includes), @@ -19,7 +19,7 @@ def empackage(z, filename): return '%s\n%d\n%s' % (filename,len(content), content) -def connect(rhostport): +def connect(rhostport, python): main_exe = sys.argv[0] l = (rhostport or '').split(':', 1) rhost = l[0] @@ -48,9 +48,9 @@ def connect(rhostport): if not rhost: - argv = ['python', '-c', pyscript] + argv = [python, '-c', pyscript] else: - argv = ['ssh'] + portl + [rhost, '--', "python -c '%s'" % pyscript] + argv = ['ssh'] + portl + [rhost, '--', "'%s' -c '%s'" % (python, pyscript)] (s1,s2) = socket.socketpair() def setup(): # runs in the child process |