Merge branch 'master' of github.com:GeoffreyFrogeye/dotfiles

This commit is contained in:
Geoffrey Frogeye 2016-02-25 20:21:49 +01:00
commit 00ea69a4d3

View file

@ -1,29 +1,32 @@
#!/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:
proxy = proxy.strip('/')
if proxy[:7] == 'http://':
proxy = proxy[7:]
elif proxy[:8] == 'https://':
proxy = proxy[8:]
s = proxy.split('@')
user = None
if len(s) == 2:
user, proxy = s
args = ['proxytunnel', '-p', proxy, '-d', host + ':' + port]
if user:
args += ['-P', user]
call(args)
if proxy:
proxy = proxy.strip('/')
if proxy[:7] == 'http://':
proxy = proxy[7:]
elif proxy[:8] == 'https://':
proxy = proxy[8:]
s = proxy.split('@')
user = None
if len(s) == 2:
user, proxy = s
args = ['proxytunnel', '-p', proxy, '-d', host + ':' + port]
if user:
args += ['-P', user]
call(args)
else:
call(['nc', host, port])
else:
call(['nc', host, port])
except KeyboardInterrupt:
pass
# #!/usr/bin/env bash