Skip to content

Instantly share code, notes, and snippets.

@chiro-hiro
Last active November 22, 2023 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chiro-hiro/694868279b419a12e27d86e068b2eac7 to your computer and use it in GitHub Desktop.
Save chiro-hiro/694868279b419a12e27d86e068b2eac7 to your computer and use it in GitHub Desktop.
SSH Tunneling + SOCKS
#!/usr/bin/env bash
# (C) 2023 Chiro & Mary
echo "Turning IPv6 off..."
networksetup -setv6off "Wi-Fi"
echo "Checking proxy configuration..."
networksetup -getsocksfirewallproxy "Wi-Fi"
echo "Setting proxy configuration..."
networksetup -setsocksfirewallproxy "Wi-Fi" 127.0.0.1 31337 off
echo "Turning proxy on..."
networksetup -setsocksfirewallproxystate "Wi-Fi" on
echo "Checking proxy configuration..."
networksetup -getsocksfirewallproxy "Wi-Fi"
echo "Starting ssh tunnel..."
ssh -ND 127.0.0.1:31337 chiro@xx.xx.xx.xx
echo "Turning proxy off..."
networksetup -setsocksfirewallproxystate "Wi-Fi" off
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment