open-ssh-tunnel.sh (464B)
1 #!/usr/bin/env bash 2 3 PORTS="9051 4444 4447 1080" 4 5 # 9051 = TOR Control Port 6 # 4444 = HTTP Proxy 7 # 4447 = SOCKS5 Proxy 8 # 1080 = other local service 9 10 # -L [bind_address:]port:host:hostport 11 # connections to the given TCP port or Unix socket on the local (client) host are to be forwarded to the given host and port, or Unix socket, on the remote side. 12 13 ssh -i ~/.ssh/private_key -v -N $(for P in $PORTS ; do printf " -L 127.0.0.1:$P:127.0.0.1:$P " ; done) user@host 14