Skip to content

Instantly share code, notes, and snippets.

@lackneets
Created February 16, 2016 14:27
Show Gist options
  • Save lackneets/9165b8dbfc80d8ae8528 to your computer and use it in GitHub Desktop.
Save lackneets/9165b8dbfc80d8ae8528 to your computer and use it in GitHub Desktop.
Wordpress Backdoor Cleanup
<?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