add-vless.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- icanhazip.com);
  6. echo "Script By Senovpn"
  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 with the specified name was already created, please choose another name."
  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" +"%d-%m-%Y"`
  28. created=`date -d "0 days" +"%d-%m-%Y"`
  29. sed -i '/#tls$/a\### '"$user $exp"'\
  30. },{"id": "'""$uuid""'","email": "'""$user""'"' /etc/v2ray/vless.json
  31. sed -i '/#none$/a\### '"$user $exp"'\
  32. },{"id": "'""$uuid""'","email": "'""$user""'"' /etc/v2ray/vnone.json
  33. vlesslink1="vless://${uuid}@${domain}:$tls?path=https://t.me/sampiiiiu&security=tls&encryption=none&type=ws#${user}"
  34. vlesslink2="vless://${uuid}@${domain}:$none?path=https://t.me/sampiiiiu&encryption=none&type=ws#${user}"
  35. systemctl restart v2ray@vless
  36. systemctl restart v2ray@vnone
  37. clear
  38. echo -e ""
  39. echo -e "==========-V2RAY/VLESS-=========="
  40. echo -e "Remarks : ${user}"
  41. echo -e "Domain : ${domain}"
  42. echo -e "port TLS : $tls"
  43. echo -e "port none TLS : $none"
  44. echo -e "id : ${uuid}"
  45. echo -e "Encryption : none"
  46. echo -e "network : ws"
  47. echo -e "path : https://t.me/sampiiiiu"
  48. echo -e "Created : $created"
  49. echo -e "Expired : $exp"
  50. echo -e "================================="
  51. echo -e "link TLS : ${vlesslink1}"
  52. echo -e "================================="
  53. echo -e "link none TLS : ${vlesslink2}"
  54. echo -e "================================="
  55. echo -e ""
  56. echo -e "Script By Senovpn"
  57. echo -e ""