Created
October 11, 2012 08:03
-
-
Save zerowebcorp/3870892 to your computer and use it in GitHub Desktop.
Find c99 Shell Scripts Hosted On a cPanel Server
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
cd /root | |
echo >> c99result.txt | |
for j in `ls /var/cpanel/users` | |
do | |
echo "Scanning user: $j" | |
cd /home/$j | |
find /home/$j -iname '*.php' > /root/c99list | |
for i in `cat /root/c99list` | |
do | |
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------') | |
if [ $? -eq 0 ]; then | |
echo "Possible Shell Script found on $i" >> /root/c99result.txt | |
fi | |
done | |
echo "Completed processing $j" >> /root/c99result.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment