Created
February 19, 2015 00:12
-
-
Save bungard/c5545d6142b8540273b5 to your computer and use it in GitHub Desktop.
Shell script to try and detect and clean common WP infections
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
grep -lr --include \*.php --exclude \*id3v2.php "%x[0-9]" . | tee infected-files.txt | |
while read -r filename ; do | |
cp -v "$filename" "$filename.dirty" | |
sed -i "s/<?php \$\w\+ = '.*%x[0-9].*?>//g" "$filename" | |
done < infected-files.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment