add-xtrgo.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- ipinfo.io/ip);
  6. echo "Checking VPS"
  7. clear
  8. uuid=$(cat /etc/trojan-go/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. trojango="$(cat ~/log-install.txt | grep -i Trojan GO | cut -d: -f2|sed 's/ //g')"
  16. trojango="$(cat ~/log-install.txt | grep -w "Trojan GO" | cut -d: -f2|sed 's/ //g')"
  17. until [[ $user =~ ^[a-zA-Z0-9_]+$ && ${user_EXISTS} == '0' ]]; do
  18. echo "Name : Create Trojan GO Account"
  19. echo "=================================="
  20. read -rp "Password : " -e user
  21. user_EXISTS=$(grep -w $user /etc/trojan-go/akun.conf | wc -l)
  22. if [[ ${user_EXISTS} == '1' ]]; then
  23. echo ""
  24. echo "A client with the specified name was already created, please choose another name."
  25. exit 1
  26. fi
  27. done
  28. read -p "Expired (days) : " masaaktif
  29. sed -i '/"'""$uuid""'"$/a\,"'""$user""'"' /etc/trojan-go/config.json
  30. exp=`date -d "$masaaktif days" +"%Y-%m-%d"`
  31. echo -e "### $user $exp" >> /etc/trojan-go/akun.conf
  32. systemctl restart trojan-go.service
  33. trojangolink="trojan-go://${uuid}@${domain}:${trojango}/?sni=${domain}&type=ws&host=${domain}&path=/brody&encryption=none#${user}"
  34. clear
  35. echo -e "Name : Trojan-GO"
  36. echo -e "===================================" | lolcat
  37. echo -e "Remarks = ${user}"
  38. echo -e "IP / Host = ${domain}"
  39. echo -e "Port = ${trojango}"
  40. echo -e "Path = /brody"
  41. echo -e "Expired = $exp"
  42. echo -e "===================================" | lolcat
  43. echo -e "Link TROJAN-GO : ${trojangolink}"
  44. echo -e "===================================" | lolcat