Created
February 16, 2016 14:27
-
-
Save lackneets/9165b8dbfc80d8ae8528 to your computer and use it in GitHub Desktop.
Wordpress Backdoor Cleanup
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
<?php | |
/* | |
Wordpress Backdoor Cleanup | |
Put this under upload folder | |
*/ | |
ini_set('display_errors', true); | |
function clenup($path) { | |
$dir = new DirectoryIterator($path); | |
foreach ($dir as $item) { | |
if(pathinfo($item->getPathname(), PATHINFO_EXTENSION) == 'php'){ | |
if(realpath($item->getPathname()) == realpath(__FILE__)){ | |
continue; | |
} | |
echo "unlink " . $item->getPathname() . "<br>"; | |
unlink($item->getPathname()); | |
} | |
if ($item->isDir() && !$item->isDot()) { | |
clenup($item->getPathname()); | |
} | |
} | |
} | |
clenup('./'); | |
echo "All Clean!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment