Last active
November 26, 2017 06:33
-
-
Save mgeeky/cfd5dfc1ff10e613090eb9a99a250c24 to your computer and use it in GitHub Desktop.
Quick & dirty cleaner for PHP malware: 'php.brute.bf1lic.1??.UNOFFICIAL'
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/bash | |
echo "Quick & dirty cleaner for PHP malware: 'php.brute.bf1lic.187.UNOFFICIAL'" | |
echo | |
function disinfect { | |
infected=$1 | |
echo "Disinfected file: ($infected)" | |
sed -i -r -e 's/<\?php if\(\!isset\(\$GLOBALS\["[\\x0-9a-fA-F]+"\]\)\) \{ \$ua=strtolower\(\$_SERVER\["[\\x0-9a-fA-F]+.+ \?><\?php/<?php/g' $infected | |
} | |
IFS=$'\n' | |
count=0 | |
for infected in $(grep -Elr '<\?php if\(\!isset\(\$GLOBALS\["[\\x0-9a-fA-F]+"\]\)\) { \$ua=strtolower\(\$_SERVER\["[\\x0-9a-fA-F]+' .) | |
do | |
disinfect $infected | |
count=$((count + 1)) | |
done | |
echo "[+] Disinfected: $count" | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment