Created
July 10, 2015 20:45
-
-
Save mpge/269196c0e3547795dd3a to your computer and use it in GitHub Desktop.
Scan all files for eval base64 decode string
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
$config = array( | |
'dir' => dirname(__FILENAME__), | |
); | |
// DO NOT EDIT BELOW THIS LINE! | |
function output() { | |
flush(); | |
ob_flush(); | |
} | |
echo '<h1>EVALBASE64DECODE Malware Detector</h1><p>Please wait, we are currently searching for possible infected files...</p><br /><hr /><br />'; | |
output(); | |
$string = 'eval(base64_decode('; | |
$dir = new DirectoryIterator($config['dir']); | |
foreach ($dir as $file) { | |
$content = file_get_contents($file->getPathname()); | |
if (strpos($content, $string) !== false) { | |
echo '<p>Possible Infection Found: '.$file->getPathname().'</p>'; | |
output(); | |
} | |
} | |
$dir = $config['dir']; | |
foreach (glob("$dir/*") as $file) { | |
$content = file_get_contents("$dir/$file"); | |
if (strpos($content, $string) !== false) { | |
echo '<p>Possible Infection Found: '."$dir/$file".'</p>'; | |
output(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment