add-vless.sh 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. source /var/lib/premium-script/ipvps.conf
  9. if [[ "$IP" = "" ]]; then
  10. domain=$(cat /etc/v2ray/domain)
  11. else
  12. domain=$IP
  13. fi
  14. tls="$(cat ~/log-install.txt | grep -w "Vless TLS" | cut -d: -f2|sed 's/ //g')"
  15. none="$(cat ~/log-install.txt | grep -w "Vless None TLS" | cut -d: -f2|sed 's/ //g')"
  16. until [[ $user =~ ^[a-zA-Z0-9_]+$ && ${CLIENT_EXISTS} == '0' ]]; do
  17. read -rp "User: " -e user
  18. CLIENT_EXISTS=$(grep -w $user /etc/v2ray/vless.json | wc -l)
  19. if [[ ${CLIENT_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. uuid=$(cat /proc/sys/kernel/random/uuid)
  26. read -p "Expired (days): " masaaktif
  27. exp=`date -d "$masaaktif days" +"%Y-%m-%d"`
  28. sed -i '/#tls$/a\### '"$user $exp"'\
  29. },{"id": "'""$uuid""'","email": "'""$user""'"' /etc/v2ray/vless.json
  30. sed -i '/#none$/a\### '"$user $exp"'\
  31. },{"id": "'""$uuid""'","email": "'""$user""'"' /etc/v2ray/vnone.json
  32. vlesslink1="vless://${uuid}@${domain}:$tls?path=/v2ray&security=tls&encryption=none&type=ws#${user}"
  33. vlesslink2="vless://${uuid}@${domain}:$none?path=/v2ray&encryption=none&type=ws#${user}"
  34. systemctl restart v2ray@vless
  35. systemctl restart v2ray@vnone
  36. clear
  37. echo -e ""
  38. echo -e "==============================="
  39. echo -e "V2RAY/VLESS Information Account"
  40. echo -e "==============================="
  41. echo -e "Remarks : ${user}"
  42. echo -e "Domain : ${domain}"
  43. echo -e "port TLS : $tls"
  44. echo -e "port none TLS : $none"
  45. echo -e "id : ${uuid}"
  46. echo -e "Encryption : none"
  47. echo -e "network : ws"
  48. echo -e "path : /v2ray"
  49. echo -e "==============================="
  50. echo -e "link TLS : ${vlesslink1}"
  51. echo -e ""
  52. echo -e "link none TLS : ${vlesslink2}"
  53. echo -e "==============================="
  54. echo -e "Expired On : $exp"
  55. echo -e "Create By EvoTeamMalaysia"
  56. echo -e ""