Skip to content

Instantly share code, notes, and snippets.

@hntrmrrs
Created June 20, 2012 16:30
Show Gist options
  • Save hntrmrrs/2960792 to your computer and use it in GitHub Desktop.
Save hntrmrrs/2960792 to your computer and use it in GitHub Desktop.
chrome+ssh proxy
#!/bin/bash
SSH=/usr/bin/ssh
CHROME=/usr/bin/google-chrome
if [ -z "$1" ] && [ -z "$2" ]; then
echo usage: $0 "<hostname> <port>"
exit
fi
HOSTNAME=$1
PORT=$2
${SSH} -D127.0.0.1:${PORT} -C -q -N ${HOSTNAME} &
SSH_PID=$!
# Give SSH approximately enough time to connect
sleep 2
${CHROME} --user-data-dir=${HOME}/.chrome-${HOSTNAME}-${PORT} --proxy-server=socks5://127.0.0.1:${PORT} ${@:3}
kill ${SSH_PID}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment