Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- host_resolve.php
- 10.12.2010 created.
- Script to check if hosts are resolving to the correct ip address.
- Dumps results to file for stats later.
- This is quick and messy :)
- Example out:
- 10-12-2010 18:18:00|posterous.com|1.2.3.4|1 # means good resolve
- 10-12-2010 18:18:01|wikipedia.com|1.2.3.4|0 # means bad resolve (matches pacnames.com)
- __
- 10.14.2010 revision
- Added google.com to sites checked.
- Adapted script to use an array of bad hosts instead of just one bad host.
- */
- date_default_timezone_set('America/Los_Angeles');
- $badhosts = array();
- $badhosts[] = '208.70.79.51'; // pacnames.com
- //$badhosts[] = '69.147.125.65'; // domdex.com? (yahoo.com)
- $badhosts[] = '74.125.19.103'; // domdex.com? (google.com)
- $badhosts[] = '64.95.64.197'; // (google.com) (cnn.com)
- $hosts = array();
- $hosts[] = 'posterous.com';
- $hosts[] = 'wikipedia.org';
- $hosts[] = 'yahoo.com';
- $hosts[] = 'cnn.com';
- $hosts[] = 'google.com';
- $hosts[] = 'delicious.com';
- while (1) {
- foreach ( $hosts as $host ) {
- $ip = gethostbyname($host);
- echo date('m-d-Y H:i:s') . "|";
- echo "$host|$ip|";
- if ( in_array($ip, $badhosts) ) { echo "0"; } else { echo "1"; }
- echo "\n";
- }
- sleep(60);
- }
- exit;
- ?>
Add Comment
Please, Sign In to add comment