cek-xws.sh 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. #!/bin/bash
  2. red='\e[1;31m'
  3. green='\e[0;32m'
  4. NC='\e[0m'
  5. MYIP=$(wget -qO- ifconfig.me/ip);
  6. echo "Checking VPS"
  7. #EDIT IZIN
  8. clear
  9. echo -n > /tmp/other.txt
  10. data=( `cat /etc/xray/vmesstls.json | grep '^###' | cut -d ' ' -f 2`);
  11. echo "-------------------------------";
  12. echo " XRAY Vmess User Login";
  13. echo "-------------------------------";
  14. for akun in "${data[@]}"
  15. do
  16. if [[ -z "$akun" ]]; then
  17. akun="tidakada"
  18. fi
  19. echo -n > /tmp/ipvmess.txt
  20. data2=( `netstat -anp | grep ESTABLISHED | grep tcp6 | grep xray | awk '{print $5}' | cut -d: -f1 | sort | uniq`);
  21. for ip in "${data2[@]}"
  22. do
  23. jum=$(cat /var/log/xray/access.log | grep -w $akun | awk '{print $3}' | cut -d: -f1 | grep -w $ip | sort | uniq)
  24. if [[ "$jum" = "$ip" ]]; then
  25. echo "$jum" >> /tmp/ipvmess.txt
  26. else
  27. echo "$ip" >> /tmp/other.txt
  28. fi
  29. jum2=$(cat /tmp/ipvmess.txt)
  30. sed -i "/$jum2/d" /tmp/other.txt > /dev/null 2>&1
  31. done
  32. jum=$(cat /tmp/ipvmess.txt)
  33. if [[ -z "$jum" ]]; then
  34. echo > /dev/null
  35. else
  36. jum2=$(cat /tmp/ipvmess.txt | nl)
  37. echo "user : $akun";
  38. echo "$jum2";
  39. echo "-------------------------------"
  40. fi
  41. rm -rf /tmp/ipvmess.txt
  42. done
  43. oth=$(cat /tmp/other.txt | sort | uniq | nl)
  44. echo "other";
  45. echo "$oth";
  46. echo "-------------------------------"
  47. rm -rf /tmp/other.txt