Villain

[PHP] Header Finder

May 6th, 2018
242
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.16 KB | None | 0 0
  1. <?php
  2. # upload to /var/www/html
  3. # made by drought and jester, dont be a meme plz
  4.     $apiKey = "DR0UGH7";
  5.  
  6.     if(empty($_GET['key'])){
  7.         die('API Key cannot be empty!');
  8.     }else{
  9.         if(isset($_GET['key'])){
  10.             if(empty($_GET['rIP']) || empty($_GET['rPort'])){
  11.                 die('Remote IP and/or Remote Port fields cannot be empty!');
  12.             }else{ 
  13.                 if($_GET['key'] == $apiKey)
  14.                 {
  15.                     if(isset($_GET['rIP']) && isset($_GET['rPort'])){
  16.                         $rIP  = $_GET['rIP'];
  17.                         $rPort = $_GET['rPort'];
  18.                        
  19.                         if (filter_var($rIP, FILTER_VALIDATE_IP)) {
  20.                             if(is_numeric($rPort)){
  21.                                 $url = "http://".$rIP.":".$rPort."/";  
  22.  
  23.                                 $ch = curl_init($url);
  24.                                 curl_setopt($ch, CURLOPT_HEADER, 1);
  25.                                 curl_setopt($ch, CURLOPT_NOBODY, 1);
  26.                                 curl_setopt($ch, CURLOPT_TIMEOUT, 10);
  27.                                 $ch = curl_exec($ch);
  28.                             }else{
  29.                                 die("$rPort is not numeric!");
  30.                             }
  31.                        
  32.                         } else {
  33.                             die("$rIP is not a valid IP!");
  34.                         }
  35.                     }else{
  36.                         die('Remote IP and/or Remote Port fields cannot be empty!');
  37.                     }                  
  38.                 }else{
  39.                     die('Wrong API Key!');
  40.                 }          
  41.             }
  42.         }else{
  43.             die('API Key not set!');
  44.         }      
  45.     }  
  46. ?>
Advertisement
Add Comment
Please, Sign In to add comment