cek-tr.sh 899 B

1234567891011121314151617181920212223242526272829
  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. data=( `cat /var/log/trojan.log | grep -w 'authenticated as' | awk '{print $7}' | sort | uniq`);
  8. echo "-------------------------------";
  9. echo "-----=[ Trojan User Login ]=-----";
  10. echo "-------------------------------";
  11. for akun in "${data[@]}"
  12. do
  13. data2=( `lsof -n | grep -i ESTABLISHED | grep trojan | awk '{print $9}' | cut -d':' -f2 | grep -w 445 | cut -d- -f2 | grep -v '>127.0.0.1' | sort | uniq | cut -d'>' -f2`);
  14. echo -n > /tmp/iptrojan.txt
  15. for ip in "${data2[@]}"
  16. do
  17. jum=$(cat /var/log/trojan.log | grep -w $akun | awk '{print $4}' | cut -d: -f1 | grep -w $ip | sort | uniq)
  18. if [[ -z "$jum" ]]; then
  19. echo > /dev/null
  20. else
  21. echo "$jum" > /tmp/iptrojan.txt
  22. fi
  23. done
  24. jum2=$(cat /tmp/iptrojan.txt | nl)
  25. echo "user : $akun";
  26. echo "$jum2";
  27. echo "-------------------------------"
  28. done