Advertisement
rg443

dip.php - cli search domainbigdata domains by ip

May 21st, 2017
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.83 KB | None | 0 0
  1. <?php
  2. $q = "192.0.78.24";
  3.  
  4. if ($argv[1])
  5.     $q = $argv[1];
  6.  
  7. if (!filter_var($q, FILTER_VALIDATE_IP)) {
  8.     $ip = gethostbyname($q);
  9.    
  10.     if (!filter_var($ip, FILTER_VALIDATE_IP))
  11.         die("ip required: " . $q);
  12.     $q = $ip;
  13. }
  14.  
  15. $result = file_get_contents('http://domainbigdata.com/' . $q);
  16.  
  17.  
  18.  
  19. preg_match_all('/(?:<a rel="nofollow".*>)(.*)(?:<\/a>)/', $result, $matches);
  20. //print_r($matches);
  21.  
  22. //echo json_encode($matches[1],JSON_PRETTY_PRINT);
  23.  
  24.  
  25.  
  26. $list = $matches[1];
  27. sort($list);
  28. echo (count($list) . "\n");
  29. for ($i = 0; $i < count($list); $i++) {
  30.     // print ($list[$i]);
  31.     $x = gethostbynamel($list[$i]);
  32.     if ($x) {
  33.         //print_r($x);
  34.         natsort($x);
  35.         echo ($list[$i] . "\t" . implode(", ", $x) . "\n");
  36.     } else {
  37.         echo ($list[$i] . "\t" . "no results\n");
  38.     }
  39. }
  40.  
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement