X-Git-Url: https://src.twobees.de/?a=blobdiff_plain;f=stow%2Foh-my-zsh%2F.oh-my-zsh%2Fplugins%2Fshell-proxy%2Fssh-proxy.py;fp=stow%2Foh-my-zsh%2F.oh-my-zsh%2Fplugins%2Fshell-proxy%2Fssh-proxy.py;h=0000000000000000000000000000000000000000;hb=1a8e170bbe5c6641a26ab1ce2e6ce6c5c1faa4cd;hp=a498c84bc8c8fc643a65f65df206f698180eb112;hpb=475ba35502579302593f4735c853c49ef1845dcb;p=dotfiles.git diff --git a/stow/oh-my-zsh/.oh-my-zsh/plugins/shell-proxy/ssh-proxy.py b/stow/oh-my-zsh/.oh-my-zsh/plugins/shell-proxy/ssh-proxy.py deleted file mode 100755 index a498c84..0000000 --- a/stow/oh-my-zsh/.oh-my-zsh/plugins/shell-proxy/ssh-proxy.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 -import os -import subprocess -import sys -from urllib.parse import urlparse - -proxy = next(os.environ[_] for _ in ("HTTP_PROXY", "HTTPS_PROXY") if _ in os.environ) - -parsed = urlparse(proxy) - -proxy_protocols = { - "http": "connect", - "https": "connect", - "socks": "5", - "socks5": "5", - "socks4": "4", - "socks4a": "4", -} - -if parsed.scheme not in proxy_protocols: - raise TypeError('unsupported proxy protocol: "{}"'.format(parsed.scheme)) - -def make_argv(): - yield "nc" - if sys.platform == 'linux': - # caveats: macOS built-in netcat command not supported proxy-type - yield "-X" # --proxy-type - # Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy). - # Default SOCKS v5 is used. - yield proxy_protocols[parsed.scheme] - yield "-x" # --proxy - yield parsed.netloc # proxy-host:proxy-port - yield sys.argv[1] # host - yield sys.argv[2] # port - -subprocess.call(make_argv())