summaryrefslogtreecommitdiff
path: root/plugins/shell-proxy
diff options
context:
space:
mode:
authorTuowen Zhao <ztuowen@gmail.com>2022-05-23 12:25:11 -0600
committerTuowen Zhao <ztuowen@gmail.com>2022-05-23 12:25:11 -0600
commit901674e84756d64024cdc70f9590c3557c6d92d6 (patch)
treed3b90c50a39f4a7f220b0a19718dc305fe1c7af4 /plugins/shell-proxy
parent2023d3ab658fe8ed4dd4ca33cd5974ab8f0ad945 (diff)
parent39b600e9e564db3dec265fcf2e3db4b5568dd93a (diff)
downloadzsh-901674e84756d64024cdc70f9590c3557c6d92d6.tar.gz
zsh-901674e84756d64024cdc70f9590c3557c6d92d6.tar.bz2
zsh-901674e84756d64024cdc70f9590c3557c6d92d6.zip
Merge remote-tracking branch 'github/master'
Diffstat (limited to 'plugins/shell-proxy')
-rw-r--r--plugins/shell-proxy/.editorconfig3
-rwxr-xr-xplugins/shell-proxy/ssh-proxy.py23
2 files changed, 16 insertions, 10 deletions
diff --git a/plugins/shell-proxy/.editorconfig b/plugins/shell-proxy/.editorconfig
new file mode 100644
index 000000000..b7c70d16d
--- /dev/null
+++ b/plugins/shell-proxy/.editorconfig
@@ -0,0 +1,3 @@
+[*.py]
+indent_size = 4
+indent_style = space
diff --git a/plugins/shell-proxy/ssh-proxy.py b/plugins/shell-proxy/ssh-proxy.py
index 6773a77bc..a498c84bc 100755
--- a/plugins/shell-proxy/ssh-proxy.py
+++ b/plugins/shell-proxy/ssh-proxy.py
@@ -20,14 +20,17 @@ proxy_protocols = {
if parsed.scheme not in proxy_protocols:
raise TypeError('unsupported proxy protocol: "{}"'.format(parsed.scheme))
-argv = [
- "nc",
- "-X",
- proxy_protocols[parsed.scheme], # Supported protocols are 4 (SOCKS v4), 5 (SOCKS v5) and connect (HTTP proxy). Default SOCKS v5 is used.
- "-x",
- parsed.netloc, # proxy-host:proxy-port
- sys.argv[1], # host
- sys.argv[2], # port
-]
+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(argv)
+subprocess.call(make_argv())