summaryrefslogtreecommitdiffstats
path: root/zsh/oh-my-zsh/plugins/shell-proxy/ssh-proxy.py
diff options
context:
space:
mode:
authorLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-03-25 16:43:09 +0530
committerLibravatarLibravatar Biswakalyan Bhuyan <biswa@surgot.in> 2024-03-25 16:43:09 +0530
commita62114c91f2070c8c8453d117f3d81dc113e41ff (patch)
treef266e87af29a08c01f82bc32dd7d463d8ec4441a /zsh/oh-my-zsh/plugins/shell-proxy/ssh-proxy.py
parentaf120ab348f2e1a5a39dec035ed9dcf84189a64e (diff)
downloaddotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.tar.gz
dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.tar.bz2
dotfiles-a62114c91f2070c8c8453d117f3d81dc113e41ff.zip
dotfile update
Diffstat (limited to 'zsh/oh-my-zsh/plugins/shell-proxy/ssh-proxy.py')
-rwxr-xr-xzsh/oh-my-zsh/plugins/shell-proxy/ssh-proxy.py36
1 files changed, 0 insertions, 36 deletions
diff --git a/zsh/oh-my-zsh/plugins/shell-proxy/ssh-proxy.py b/zsh/oh-my-zsh/plugins/shell-proxy/ssh-proxy.py
deleted file mode 100755
index a498c84..0000000
--- a/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())