Advertisement
alfaisalvpn

badvpn

Jun 15th, 2020
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.19 KB | None | 0 0
  1. #!/bin/bash
  2. clear
  3. fun_bar () {
  4. comando[0]="$1"
  5. comando[1]="$2"
  6.  (
  7. [[ -e $HOME/fim ]] && rm $HOME/fim
  8. ${comando[0]} -y > /dev/null 2>&1
  9. ${comando[1]} -y > /dev/null 2>&1
  10. touch $HOME/fim
  11.  ) > /dev/null 2>&1 &
  12.  tput civis
  13. echo -ne "\033[1;33m["
  14. while true; do
  15.    for((i=0; i<18; i++)); do
  16.    echo -ne "\033[1;31m#"
  17.    sleep 0.1s
  18.    done
  19.    [[ -e $HOME/fim ]] && rm $HOME/fim && break
  20.    echo -e "\033[1;33m]"
  21.    sleep 1s
  22.    tput cuu1
  23.    tput dl1
  24.    echo -ne "\033[1;33m["
  25. done
  26. echo -e "\033[1;33m]\033[1;37m -\033[1;32m OK !\033[1;37m"
  27. tput cnorm
  28. }
  29.  
  30. fun_udp1 () {
  31.     [[ -e "/bin/badvpn-udpgw" ]] && {
  32.     clear
  33.     echo -e "\033[1;32mSTARTING BADVPN... \033[0m\n"
  34.     fun_udpon () {
  35.         screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 2000 --max-connections-for-client 50
  36.         [[ $(grep -wc "udpvpn" /etc/autostart) = '0' ]] && {
  37.             echo -e "ps x | grep 'udpvpn' | grep -v 'grep' && echo 'ON' || screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 2000 --max-connections-for-client 50" >> /etc/autostart
  38.         } || {
  39.             sed -i '/udpvpn/d' /etc/autostart
  40.             echo -e "ps x | grep 'udpvpn' | grep -v 'grep' && echo 'ON' || screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 1000 --max-connections-for-client 10" >> /etc/autostart
  41.         }
  42.         sleep 1
  43.     }
  44.     fun_bar 'fun_udpon'
  45.     echo -e "\n  \033[1;32mACTIVE BADVPN !\033[0m"
  46.     sleep 3
  47.     menu
  48.     } || {
  49.         clear
  50.         echo -e "\033[1;32mINSTALLING BADVPN !\033[0m\n"
  51.         inst_udp () {
  52.             cd $HOME
  53.             wget https://www.dropbox.com/s/tgkxdwb03r7w59r/badvpn-udpgw -o /dev/null
  54.             mv -f $HOME/badvpn-udpgw /bin/badvpn-udpgw
  55.             chmod 777 /bin/badvpn-udpgw
  56.        }
  57.        fun_bar 'inst_udp'
  58.        echo -e "\n\033[1;32mSTARTING BADVPN... \033[0m\n"
  59.        fun_udpon2 () {
  60.            screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 2000 --max-connections-for-client 50
  61.            [[ $(grep -wc "udpvpn" /etc/autostart) = '0' ]] && {
  62.                echo -e "ps x | grep 'udpvpn' | grep -v 'grep' && echo 'ON' || screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 2000 --max-connections-for-client 50" >> /etc/autostart
  63.            } || {
  64.                sed -i '/udpvpn/d' /etc/autostart
  65.                echo -e "ps x | grep 'udpvpn' | grep -v 'grep' && echo 'ON' || screen -dmS udpvpn /bin/badvpn-udpgw --listen-addr 127.0.0.1:7300 --max-clients 2000 --max-connections-for-client 50" >> /etc/autostart
  66.            }
  67.            sleep 1
  68.        }
  69.        fun_bar 'fun_udpon2'
  70.        echo -e "\n\033[1;32mACTIVE BADVPN !\033[0m"
  71.        sleep 3
  72.        menu
  73.     }
  74. }
  75.  
  76. fun_udp2 () {
  77.     clear
  78.     echo -e "\n\033[1;32mSTOPPING BADVPN...\033[0m\n"
  79.     fun_stopbad () {
  80.         sleep 1
  81.         screen -r -S "udpvpn" -X quit
  82.         screen -wipe 1>/dev/null 2>/dev/null
  83.         [[ $(grep -wc "udpvpn" /etc/autostart) != '0' ]] && {
  84.             sed -i '/udpvpn/d' /etc/autostart
  85.         }
  86.         sleep 1
  87.     }
  88.     fun_bar 'fun_stopbad'
  89.     echo -e "\n  \033[1;31mBADVPN STOPPED !\033[0m"
  90.     sleep 3
  91.     menu
  92. }
  93. [[ $(ps x | grep "udpvpn"|grep -v grep |wc -l) = '0' ]] &&  fun_udp1 || fun_udp2
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement