Skip to content

Instantly share code, notes, and snippets.

@vinpac
Created October 7, 2016 20:49
Show Gist options
  • Save vinpac/70d102f53204513c3534636807cc13e1 to your computer and use it in GitHub Desktop.
Save vinpac/70d102f53204513c3534636807cc13e1 to your computer and use it in GitHub Desktop.
<?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