Skip to content

Instantly share code, notes, and snippets.

@necenzurat
Created December 23, 2014 16:15
Show Gist options
  • Save necenzurat/314a905ba02f4bf0cd5d to your computer and use it in GitHub Desktop.
Save necenzurat/314a905ba02f4bf0cd5d to your computer and use it in GitHub Desktop.
Wordpressez fuckedz
<?php
$meh = array(
"/example.com/public/wp-content/plugins/revslider/inc_php/framework/settings_advances.class.php",
);
function clean($filename) {
$file = file($filename);
$output = $file[0];
$file[0] = "<?php /* cleaned */ \n";
file_put_contents($filename, $file);
return $output;
}
foreach($meh as $file){
clean($file);
}
<?php
// ini_set('max_execution_time', '0');
// ini_set('set_time_limit', '0');
find_files('.');
function find_files($seed) {
if(! is_dir($seed)) return false;
$files = array();
$dirs = array($seed);
while(NULL !== ($dir = array_pop($dirs)))
{
if($dh = opendir($dir))
{
while( false !== ($file = readdir($dh)))
{
if($file == '.' || $file == '..') continue;
$path = $dir . '/' . $file;
if(is_dir($path)) { $dirs[] = $path; }
else { if(preg_match('/^.*\.(php[\d]?|txt|js|htaccess)$/i', $path)) { check_files($path); }}
}
closedir($dh);
}
}
}
function check_files($this_file){
$str_to_find[]='eval(';
$str_to_find[]='timthumb'; // base64_decode reversed
$str_to_find[]='eval(base64_decode(gzunc';
$str_to_find[]='gzuncompress';
$str_to_find[]='PCT4BA6ODSE_';
if(!($content = file_get_contents($this_file)))
{ echo("<p>Could not check $this_file You should check the contents manually!</p>\n"); }
else
{
while(list(,$value)=each($str_to_find))
{
if (stripos($content, $value) !== false)
{
echo("<p>$this_file -> contains $value</p>\n");
}
}
}
unset($content);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment