diff --git a/client.py b/client.py index b6d32f9..dd29909 100644 --- a/client.py +++ b/client.py @@ -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() diff --git a/main.py b/main.py index 6d6b528..d1b3f12 100755 --- a/main.py +++ b/main.py @@ -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), diff --git a/ssh.py b/ssh.py index 7a37c36..d790d4a 100644 --- a/ssh.py +++ b/ssh.py @@ -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