File indexing completed on 2024-09-27 07:02:31
0001
0002 set -o nounset
0003 set -o errexit
0004
0005 PROXY_PROFILE=$USER
0006 PROXY_PORT=8020
0007 SSH_HOST="sodium"
0008
0009 function print_the_help {
0010 echo "USAGE: ${0} [-p <PROXY_PORT>] [-n <PROFILE_NAME>] [-s SSH_HOST] "
0011 echo " OPTIONS: "
0012 echo " -s,--host ssh host. Default: sodium"
0013 echo " -p,--port Proxy port number. Default: 8020"
0014 echo " -n,--profile Profile name to use. Sets profile directory to ~/.proxy-profiles/PROFILE_NAME"
0015 echo " "
0016 echo " EXAMPLE: "
0017 echo " ${0} -p 8920 -n sodium sodium "
0018 exit
0019 }
0020
0021 function yes_or_no {
0022 while true; do
0023 read -p "$* [y/n]: " yn
0024 case $yn in
0025 [Yy]*) return 0 ;;
0026 [Nn]*) echo "No entered" ; return 1 ;;
0027 esac
0028 done
0029 }
0030 if [[ $
0031 print_the_help
0032 exit
0033 fi
0034
0035 POSITIONAL=()
0036 while [[ $
0037 do
0038 key="$1"
0039
0040 case $key in
0041 -h|--help)
0042 shift
0043 print_the_help
0044 exit
0045 ;;
0046 -p|--port)
0047 PROXY_PORT="$2"
0048 shift
0049 shift
0050 ;;
0051 -n|--profile)
0052 PROXY_PROFILE="$2"
0053 shift
0054 shift
0055 ;;
0056 -s|--host)
0057 SSH_HOST="$2"
0058 shift
0059 shift
0060 ;;
0061 *)
0062
0063 echo "unknown option $1"
0064 print_the_help
0065 exit
0066 shift
0067 ;;
0068 esac
0069 done
0070 set -- "${POSITIONAL[@]}"
0071
0072
0073
0074 echo " "
0075 echo "ssh -n -D ${PROXY_PORT} ${SSH_HOST}"
0076 echo " "
0077
0078 ssh -n -D ${PROXY_PORT} ${SSH_HOST} &
0079
0080 chromium-browser \
0081 --user-data-dir="$HOME/.proxy-profiles/${PROXY_PROFILE}" \
0082 --proxy-server="socks5://localhost:${PROXY_PORT}" &> /dev/null &
0083
0084 echo " "
0085 echo "You are now tunneling all traffic through proxy ${SSH_HOST} on port ${PROXY_PORT}"
0086 echo " "
0087
0088