cek-vless.sh 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. echo -n > /tmp/other.txt
  8. data=( `cat /etc/v2ray/vless.json | grep '^###' | cut -d ' ' -f 2`);
  9. echo "-------------------------------";
  10. echo "-----=[ Vless User Login ]=-----";
  11. echo "-------------------------------";
  12. for akun in "${data[@]}"
  13. do
  14. if [[ -z "$akun" ]]; then
  15. akun="tidakada"
  16. fi
  17. echo -n > /tmp/ipvless.txt
  18. data2=( `netstat -anp | grep ESTABLISHED | grep tcp6 | grep v2ray | awk '{print $5}' | cut -d: -f1 | sort | uniq`);
  19. for ip in "${data2[@]}"
  20. do
  21. jum=$(cat /var/log/v2ray/access2.log | grep -w $akun | awk '{print $3}' | cut -d: -f1 | grep -w $ip | sort | uniq)
  22. if [[ "$jum" = "$ip" ]]; then
  23. echo "$jum" >> /tmp/ipvless.txt
  24. else
  25. echo "$ip" >> /tmp/other.txt
  26. fi
  27. jum2=$(cat /tmp/ipvless.txt)
  28. sed -i "/$jum2/d" /tmp/other.txt > /dev/null 2>&1
  29. done
  30. jum=$(cat /tmp/ipvless.txt)
  31. if [[ -z "$jum" ]]; then
  32. echo > /dev/null
  33. else
  34. jum2=$(cat /tmp/ipvless.txt | nl)
  35. echo "user : $akun";
  36. echo "$jum2";
  37. echo "-------------------------------"
  38. fi
  39. rm -rf /tmp/ipvmess.txt
  40. done
  41. oth=$(cat /tmp/other.txt | sort | uniq | nl)
  42. echo "other";
  43. echo "$oth";
  44. echo "-------------------------------"
  45. rm -rf /tmp/other.txt