dimaslanjaka

cpanel hacked files scanner

Dec 9th, 2015
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #!/bin/sh
  2. cd /root
  3. echo >> c99result.txt
  4. for j in `ls /var/cpanel/users`
  5. do
  6. echo "Scanning user: $j"
  7. cd /home/$j
  8. find /home/$j -iname '*.php' > /root/c99list
  9. for i in `cat /root/c99list`
  10. do
  11. result=$( perl -e 'alarm shift @ARGV; exec @ARGV' 10 php -q $i | grep -Eie '-rw-r--r--|drwxr-xr-x|drwxrwxrwx|-rw-r-xr-x|-rwxrwxrwx|-rw-rw-rw-|-rwx------')
  12. if [ $? -eq 0 ]; then
  13. echo "Possible Shell Script found on $i" >> /root/c99result.txt
  14. fi
  15. done
  16.  
  17. echo "Completed processing $j" >> /root/c99result.txt
  18. done
  19. Save and Exit.
  20.  
  21. Run this shell script to scan hacked files.
  22.  
  23. root@server1 [~]# ./scanfiles.sh
  24.  
  25.  
  26.  
  27. Once scanning process completed, check report file /root/c99result.txt.
Add Comment
Please, Sign In to add comment