Advertisement
imKobz

Untitled

Nov 27th, 2023 (edited)
874
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.73 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Run as root
  4. [[ "$(whoami)" != "root" ]] && {
  5.     echo -e "\033[1;33m[\033[1;31mErro\033[1;33m] \033[1;37m- \033[1;33myou need to run as root\033[0m"
  6.     rm /home/ubuntu/install.sh &>/dev/null
  7.     exit 0
  8. }
  9.  
  10. #=== setup ===
  11. cd
  12. rm -rf /root/udp
  13. mkdir -p /root/udp
  14. rm -rf /etc/UDPCustom
  15. mkdir -p /etc/UDPCustom
  16. sudo touch /etc/UDPCustom/udp-custom
  17. udp_dir='/etc/UDPCustom'
  18. udp_file='/etc/UDPCustom/udp-custom'
  19.  
  20. sudo apt update -y
  21. sudo apt upgrade -y
  22. sudo apt install -y wget
  23. sudo apt install -y curl
  24. sudo apt install -y dos2unix
  25. sudo apt install -y neofetch figlet
  26.  
  27. source <(curl -sSL 'https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/module/module')
  28.  
  29. time_reboot() {
  30.   print_center -ama "${a92:-System/Server Reboot In} $1 ${a93:-Seconds}"
  31.   REBOOT_TIMEOUT="$1"
  32.  
  33.   while [ $REBOOT_TIMEOUT -gt 0 ]; do
  34.     print_center -ne "-$REBOOT_TIMEOUT-\r"
  35.     sleep 1
  36.     : $((REBOOT_TIMEOUT--))
  37.   done
  38.   rm /home/ubuntu/install.sh
  39.   echo -e "\033[01;31m\033[1;33m More Updates, Follow Us On \033[1;31m(\033[1;36mTelegram\033[1;31m): \033[1;37m@voltssh\033[0m"
  40.   reboot
  41. }
  42.  
  43. # Check Ubuntu version
  44. if [ "$(lsb_release -rs)" = "8*|9*|10*|11*|16.04*|18.04*" ]; then
  45.   clear
  46.   print_center -ama -e "\e[1m\e[31m=====================================================\e[0m"
  47.   print_center -ama -e "\e[1m\e[33m${a94:-this script is not compatible with your operating system}\e[0m"
  48.   print_center -ama -e "\e[1m\e[33m ${a95:-Use Ubuntu 20 or higher}\e[0m"
  49.   print_center -ama -e "\e[1m\e[31m=====================================================\e[0m"
  50.   rm /home/ubuntu/install.sh
  51.   exit 1
  52. else
  53.   clear
  54.   echo ""
  55.   print_center -ama "A Compatible OS/Environment Found"
  56.   print_center -ama " ⇢ Installation begins...! <"
  57.   sleep 3
  58.  
  59.     # [change timezone to UTC +0]
  60.   echo ""
  61.   echo " ⇢ Change timezone to UTC +0"
  62.   echo " ⇢ for Asia/Jakarta [GH] GMT +00:00"
  63.   ln -fs /usr/share/zoneinfo/Asia/Jakarta /etc/localtime
  64.   sleep 3
  65.  
  66.   # [+clean up+]
  67.   rm -rf $udp_file &>/dev/null
  68.   # rm -rf /etc/UDPCustom/udp-request &>/dev/null
  69.   rm -rf /usr/bin/udp-request &>/dev/null
  70.   rm -rf /etc/limiter.sh &>/dev/null
  71.   rm -rf /etc/UDPCustom/limiter.sh &>/dev/null
  72.   rm -rf /etc/UDPCustom/module &>/dev/null
  73.   rm -rf /usr/bin/udp &>/dev/null
  74.   rm -rf /etc/UDPCustom/udpgw.service &>/dev/null
  75.   rm -rf /etc/udpgw.service &>/dev/null
  76.   systemctl stop udpgw &>/dev/null
  77.   # systemctl stop udp-custom &>/dev/null
  78.   systemctl stop udp-request &>/dev/null
  79.  
  80.  # [+get files ⇣⇣⇣+]
  81.   source <(curl -sSL 'https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/module/module') &>/dev/null
  82.   wget -O /etc/UDPCustom/module 'https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/module/module' &>/dev/null
  83.   chmod +x /etc/UDPCustom/module
  84.  
  85.   # wget "https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/bin/udp-custom-linux-amd64" -O /root/udp/udp-custom &>/dev/null
  86.   wget "https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/bin/udp-request-linux-amd64" -O /usr/bin/udp-request &>/dev/null
  87.   chmod +x /root/udp/udp-custom
  88.   # chmod +x /usr/bin/udp-request
  89.  
  90.   wget -O /etc/limiter.sh 'https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/module/limiter.sh'
  91.   cp /etc/limiter.sh /etc/UDPCustom
  92.   chmod +x /etc/limiter.sh
  93.   chmod +x /etc/UDPCustom
  94.  
  95.   # [+udpgw+]
  96.   wget -O /etc/udpgw 'https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/module/udpgw'
  97.   mv /etc/udpgw /bin
  98.   chmod +x /bin/udpgw
  99.  
  100.   # [+service+]
  101.   wget -O /etc/udpgw.service 'https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/config/udpgw.service'
  102.   wget -O /etc/udp-request.service 'https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/config/udp-request.service'
  103.  
  104.   mv /etc/udpgw.service /etc/systemd/system
  105.   mv /etc/udp-request.service /etc/systemd/system
  106.  
  107.   chmod 640 /etc/systemd/system/udpgw.service
  108.   chmod 640 /etc/systemd/system/udp-custom.service
  109.  
  110.   systemctl daemon-reload &>/dev/null
  111.   systemctl enable udpgw &>/dev/null
  112.   systemctl start udpgw &>/dev/null
  113.   systemctl enable udp-request &>/dev/null
  114.   systemctl start udp-request &>/dev/null
  115.  
  116.   # [+config+]
  117.   wget "https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/config/config.json" -O /root/udp/config.json &>/dev/null
  118.   chmod +x /root/udp/config.json
  119.  
  120.   # [+menu+]
  121.   wget -O /usr/bin/udp 'https://raw.githubusercontent.com/ndhet/MULTI-PORT/main/udp/module/udp'
  122.   chmod +x /usr/bin/udp
  123.   ufw disable &>/dev/null
  124.   sudo apt-get remove --purge ufw firewalld -y
  125.   apt remove netfilter-persistent -y
  126.   clear
  127.   echo ""
  128.   echo ""
  129.   print_center -ama "${a103:-setting up, please wait...}"
  130.   sleep 3
  131.   title "${a102:-Installation Successful}"
  132.   print_center -ama "${a103:-  To show menu type: \nudp\n}"
  133.   msg -bar
  134.   time_reboot 5
  135. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement