Guest User

ss-tor-menu.sh

a guest
May 5th, 2016
284
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.16 KB | None | 0 0
  1. #! /bin/bash
  2. # $Author: twfcc@twitter
  3. # $PROG ss-tor-menu.sh
  4. # $description: start or stop redirecting traffic to TOR on remote vps
  5. # Public domain use as your own risk!
  6. # /root/toriptables2/toriptables2.py must be exist.  
  7.  
  8. if ! which zenity > /dev/null 2>&1
  9.     then
  10.         echo "Zenity is needed for this script" >&2 ;
  11.         echo "Input: 'sudo apt-get install zenity' first." >&2
  12.         exit 1
  13. fi
  14. host="My_VPS" # change to your vps IP or hostname
  15. rport=22   # change to vps sshd's port if not 22
  16. ans=$(zenity  --list  --text "TOR Traffic Menu" \
  17.       --radiolist  --column "Pick" \
  18.       --column "Action" \
  19.       TRUE "Shadowsocks via TOR" FALSE "Use Shadowsocks Only")
  20.  
  21. case "$ans" in
  22.     Shadowsocks*) ssh root@"$host" -p $rport '/root/toriptables2/toriptables2.py -l' ;
  23.                   if [ $? -eq 0 ] ; then
  24.                   zenity --info --text \
  25.                   "Redirect traffic to TOR success."
  26.                   fi
  27.                   ;;
  28.                *) ssh root@"$host" -p $rport '/root/toriptables2/toriptables2.py -f' ;
  29.                   if [ $? -eq 0 ] ; then
  30.                   zenity --error --text \
  31.                   "Stop redirect traffic to TOR success."
  32.                   fi
  33.                   ;;
  34. esac
  35. exit 0
Advertisement
Add Comment
Please, Sign In to add comment