Guest User

Untitled

a guest
Jun 18th, 2018
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. <?php
  2. /*
  3. host_resolve.php
  4.  
  5. 10.12.2010 created.
  6. Script to check if hosts are resolving to the correct ip address.
  7. Dumps results to file for stats later.
  8. This is quick and messy :)
  9.  
  10. Example out:
  11.  
  12. 10-12-2010 18:18:00|posterous.com|1.2.3.4|1 # means good resolve
  13. 10-12-2010 18:18:01|wikipedia.com|1.2.3.4|0 # means bad resolve (matches pacnames.com)
  14. __
  15. 10.14.2010 revision
  16.  
  17. Added google.com to sites checked.
  18. Adapted script to use an array of bad hosts instead of just one bad host.
  19. */
  20.  
  21. date_default_timezone_set('America/Los_Angeles');
  22.  
  23. $badhosts = array();
  24. $badhosts[] = '208.70.79.51'; // pacnames.com
  25. //$badhosts[] = '69.147.125.65'; // domdex.com? (yahoo.com)
  26. $badhosts[] = '74.125.19.103'; // domdex.com? (google.com)
  27. $badhosts[] = '64.95.64.197'; // (google.com) (cnn.com)
  28.  
  29. $hosts = array();
  30. $hosts[] = 'posterous.com';
  31. $hosts[] = 'wikipedia.org';
  32. $hosts[] = 'yahoo.com';
  33. $hosts[] = 'cnn.com';
  34. $hosts[] = 'google.com';
  35. $hosts[] = 'delicious.com';
  36.  
  37. while (1) {
  38. foreach ( $hosts as $host ) {
  39. $ip = gethostbyname($host);
  40. echo date('m-d-Y H:i:s') . "|";
  41. echo "$host|$ip|";
  42. if ( in_array($ip, $badhosts) ) { echo "0"; } else { echo "1"; }
  43. echo "\n";
  44. }
  45.  
  46. sleep(60);
  47. }
  48.  
  49. exit;
  50. ?>
Add Comment
Please, Sign In to add comment