Created
October 7, 2016 20:49
-
-
Save vinpac/70d102f53204513c3534636807cc13e1 to your computer and use it in GitHub Desktop.
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
<?php | |
$directory_iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator('/Applications/MAMP/htdocs/', RecursiveDirectoryIterator::SKIP_DOTS)); | |
foreach($directory_iterator as $filename => $file) | |
{ | |
if ($file->getExtension() !== "html" ) { | |
continue; | |
} | |
$content = file_get_contents($filename); | |
$reg = '/<\?\s*php\s*if\(!isset\(\$GLOBALS\[\"\\\\x61(.*?)-1;\s*\?>/s'; | |
$count = 0; | |
$newContent = preg_replace ($reg, '', $content, -1, $count); | |
if($count === 1) { | |
echo $filename." Com malware...<br>"; | |
file_put_contents ($filename, $newContent); | |
echo $filename." Sem malware.<br>"; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment