ajones

CF Resolver

Sep 15th, 2012
406
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. <?php
  2. // Cloudflare IP resolver API by Down from HF(ajones)
  3.  
  4. function is_ipv4($ip)
  5. {
  6. return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ? $ip : '(Null)';
  7. }
  8.  
  9. $me = $_SERVER['REMOTE_ADDR'];
  10. $url = $_GET['url'];
  11. $headers = get_headers($url, 1);
  12. $server = $headers['Server'];
  13. $key = array('aSd0Rla23-OWNER');
  14. $key_count = count($key);
  15. $sdom = array('cpanel.', 'ftp.', 'mail.', 'webmail.', 'direct.', 'direct-connect.', 'record.', 'ssl.', 'dns.', 'help.', 'blog.', 'forum.');
  16.  
  17. if(!isset($url))
  18. {
  19. die("\n[Notice] Usage: api_cf.php?url=http://example.tld&api_key=api_key_here");
  20. }
  21. if(!isset($key_count))
  22. {
  23. die("Key not set");
  24. }
  25. $gKey = $_GET['api_key'];
  26. if(!in_array($gKey, $key))
  27. {
  28. die("Key not found in list");
  29. }
  30. // asumes true
  31. if(preg_match('/^(https?):\/\/(w{3}|w3)\./i', $url, $matches))
  32. {
  33. if($mathces[2] != 'www')
  34. {
  35. $url = preg_replace('/^(https?):\/\//', '', $url);
  36. }
  37. else
  38. {
  39. $url = explode($matches[0], $url);
  40. $url = $url[1];
  41. }
  42. }
  43. if(is_array($server))
  44. $server = $server[0];
  45.  
  46. if(preg_match('/cloudflare/i', $server))
  47. {
  48. echo "\n[Notice] CloudFlare detected: ".$server."\n";
  49. }
  50. else
  51. {
  52. echo "\n[Notice] CloudFlare not detected.";
  53. }
  54. echo "[Scanner] IP: " . is_ipv4(gethostbyname($url)) . "\n\n";
  55. echo "[Scanner] Searching for more IP Addresses\n\n";
  56.  
  57. for ($x = 0; $x < $count; $x++)
  58. {
  59. $site = $sdom[$x] . $url;
  60. $ip = is_ipv4(gethostbyname($site));
  61.  
  62. echo "Trying ".$site.": ".$ip."\n";
  63. }
  64. echo "\n[Notice] Finished.";
  65. ?>
Advertisement
Add Comment
Please, Sign In to add comment