Created
October 14, 2021 07:44
-
-
Save anglinb/8c2b43833f3791fa69a92249d77f4cfb to your computer and use it in GitHub Desktop.
Hacky VPN-like setup to quickly start a browsing session with an different IP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
cd "$(dirname "$0")/.." | |
set +ex | |
# Setup tunnel | |
ssh -D 9090 -N -f <user>@somehostintheus.com | |
# Open chrome | |
/Applications/Chromium.app/Contents/MacOS/Chromium --proxy-server="socks5://localhost:9090" --host-resolver-rules="MAP * ~NOTFOUND , EXCLUDE localhost" | |
( trap exit SIGINT ; read -r -d '' _ </dev/tty ) ## wait for Ctrl-C | |
# Find tunnel & quit | |
PID=$(lsof -i :9090 | head -n +2 | tail -n 1 | awk '{print $2}') | |
kill -9 $PID |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment