add-tr.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- https://icanhazip.com);
  6. echo "Checking VPS"
  7. clear
  8. uuid=$(cat /etc/trojan/uuid.txt)
  9. source /var/lib/premium-script/ipvps.conf
  10. if [[ "$IP" = "" ]]; then
  11. domain=$(cat /etc/v2ray/domain)
  12. else
  13. domain=$IP
  14. fi
  15. tr="$(cat ~/log-install.txt | grep -i Trojan | cut -d: -f2|sed 's/ //g')"
  16. until [[ $user =~ ^[a-zA-Z0-9_]+$ && ${user_EXISTS} == '0' ]]; do
  17. read -rp "Password: " -e user
  18. user_EXISTS=$(grep -w $user /etc/trojan/akun.conf | wc -l)
  19. if [[ ${user_EXISTS} == '1' ]]; then
  20. echo ""
  21. echo "A Client Username Was Already Created, Please Enter New Username"
  22. exit 1
  23. fi
  24. done
  25. read -p "Expired (days): " masaaktif
  26. sed -i '/"'""$uuid""'"$/a\,"'""$user""'"' /etc/trojan/config.json
  27. exp=`date -d "$masaaktif days" +"%Y-%m-%d"`
  28. echo -e "### $user $exp" >> /etc/trojan/akun.conf
  29. systemctl restart trojan
  30. trojanlink="trojan://${user}@${domain}:${tr}"
  31. clear
  32. echo -e ""
  33. echo -e "=========================="
  34. echo -e "Trojan Information Account"
  35. echo -e "=========================="
  36. echo -e "Remarks : ${user}"
  37. echo -e "Host/IP : ${domain}"
  38. echo -e "port : ${tr}"
  39. echo -e "Key : ${user}"
  40. echo -e "link : ${trojanlink}"
  41. echo -e "=========================="
  42. echo -e "Expired On : $exp"
  43. echo -e "Create By EvoTeamMalaysia"
  44. echo -e ""