mirror of
https://github.com/sshuttle/sshuttle.git
synced 2025-01-05 21:48:54 +01:00
8fe3592be3
Instead, grab our source code, send it over the link, and have python eval it and then start the server.py main() function. Strangely, there's now *less* horrible stuff in ssh.py, because we no longer have to munge around with the PATH environment variable. And this significantly reduces the setup required to get sshuttle going. Based on a suggestion from Wayne Scott.
27 lines
763 B
Python
27 lines
763 B
Python
import sys, zlib
|
|
|
|
z = zlib.decompressobj()
|
|
mainmod = sys.modules[__name__]
|
|
while 1:
|
|
name = sys.stdin.readline().strip()
|
|
if name:
|
|
nbytes = int(sys.stdin.readline())
|
|
if verbosity >= 2:
|
|
sys.stderr.write('remote assembling %r (%d bytes)\n'
|
|
% (name, nbytes))
|
|
content = z.decompress(sys.stdin.read(nbytes))
|
|
exec compile(content, name, "exec")
|
|
|
|
# FIXME: this crushes everything into a single module namespace,
|
|
# then makes each of the module names point at this one. Gross.
|
|
assert(name.endswith('.py'))
|
|
modname = name[:-3]
|
|
mainmod.__dict__[modname] = mainmod
|
|
else:
|
|
break
|
|
|
|
verbose = verbosity
|
|
sys.stderr.flush()
|
|
sys.stdout.flush()
|
|
main()
|