Tunnel prevent message when Ctrl+C

This commit is contained in:
Geoffrey Frogeye 2016-02-25 17:17:03 +01:00
parent 758576532b
commit 0e96c7c615

View file

@ -1,13 +1,14 @@
#!/usr/bin/env python3
import sys
import os
from subprocess import call
try:
import sys
import os
from subprocess import call
host, port = sys.argv[1:3]
proxy = os.environ.get('HTTP_PROXY')
host, port = sys.argv[1:3]
proxy = os.environ.get('HTTP_PROXY')
if proxy:
if proxy:
proxy = proxy.strip('/')
if proxy[:7] == 'http://':
proxy = proxy[7:]
@ -22,8 +23,10 @@ if proxy:
args += ['-P', user]
call(args)
else:
else:
call(['nc', host, port])
except KeyboardInterrupt:
pass
# #!/usr/bin/env bash