Advertisement
Guest User

Untitled

a guest
May 8th, 2013
389
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.60 KB | None | 0 0
  1. <?php
  2.  
  3. # CloudFlare IP Resolver
  4.  
  5. # Coded By Hug.
  6. # http://www.se7ensins.com/forums/members/hug.466748/
  7. # hosted 4 u by www.inforge.net
  8.  
  9. function is_ipv4($ip)
  10. {
  11. return filter_var($ip, FILTER_VALIDATE_IP, FILTER_FLAG_IPV4) ? $ip : '(Null)';
  12. }
  13.  
  14. $me = $argv[0];
  15. $url = @$argv[1];
  16.  
  17. if(!isset($url))
  18. die("\n[+] Usage: php {$me} <url>\n[+] Example: php {$me} http://www.imgur.com\n");
  19.  
  20. if(!preg_match('/^(https?):\/\/(w{3}|w3)\./i', $url))
  21. die("\nURL is invalid.\nURL must be formatted as: http(s)://www." . preg_replace('/^(https?):\/\//', '', $url) . "\n(for compatibility reasons)\n");
  22.  
  23. $headers = get_headers($url, 1);
  24. $server = $headers['Server'];
  25.  
  26. $sdom = array('cpanel.', 'ftp.', 'mail.', 'webmail.', 'direct.', 'direct-connect.', 'record.', 'ssl.', 'dns.', 'help.', 'blog.', 'forum.');
  27. $count = count($sdom);
  28.  
  29. if(preg_match('/^(https?):\/\/(w{3}|w3)\./i', $url, $matches))
  30. {
  31. if($matches[2] != 'www')
  32. {
  33. $url = preg_replace('/^(https?):\/\//', '', $url);
  34. }
  35. else
  36. {
  37. $url = explode($matches[0], $url);
  38. $url = $url[1];
  39. }
  40. }
  41.  
  42. if(is_array($server))
  43. $server = $server[0];
  44.  
  45. if(preg_match('/cloudflare/i', $server))
  46. echo "\n[+] CloudFlare detected: {$server}\n";
  47. else
  48. echo "\n[+] CloudFlare wasn't detected, proceeding anyway.\n";
  49.  
  50. echo '[+] IP: ' . is_ipv4(gethostbyname($url)) . "\n\n";
  51. echo "[+] Searching for more IP addresses.\n\n";
  52.  
  53. for($x = 0; $x < $count; $x++)
  54. {
  55. $site = $sdom[$x] . $url;
  56. $ip = is_ipv4(gethostbyname($site));
  57.  
  58. echo "Trying {$site}: {$ip}\n";
  59. }
  60.  
  61. echo "\n[+] Finished.\n";
  62.  
  63. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement