Last active
June 21, 2019 12:53
-
-
Save realtebo/76033e65c95c49c2d267fefbca19e646 to your computer and use it in GitHub Desktop.
Search corrupted php file and fake icons
This file contains 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/bash | |
EXIT_CODE=0 | |
for cartella in $( ls -l /var/www | grep -e "^d" | awk '{ print $9 }'); do | |
echo "Scansione /var/www/$cartella ...." | |
for phpfile in $(find /var/www/$cartella -type f -iname '*.php'); do | |
if [ -f $phpfile ]; then | |
grep '@include "\\057' $phpfile > /dev/null | |
if [ $? -eq 0 ]; then | |
EXIT_CODE=$((EXIT_CODE+1)) | |
echo | |
echo "******* $phpfile INFETTO ******" | |
grep -n '@include "\\057' $phpfile | |
sed -i 's/.*@include "\\057.*//' $phpfile | |
echo "******* $phpfile RIPULITO ******" | |
echo "*******************************" | |
fi | |
fi | |
done; | |
for icon in $(find /var/www/$cartella -type f -name "*.ico" -exec file {} \; | grep "PHP" | awk -F ":" '{ print $1 }' ); do | |
echo | |
echo "***************** FINTA ICONA RILEVATA ********" | |
echo $icon | |
if [ -f $icon ]; then | |
EXIT_CODE=$((EXIT_CODE+1)) | |
rm $icon | |
echo " --------------- BRASATA ----- " | |
fi | |
echo "***********************************************" | |
done; | |
done; | |
exit $EXIT_CODE; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment