#!/usr/bin/perl # cPlicensing.net - scripts Copyright(c) 2003 cPlicensing.net. # All rights Reserved. # support@cPlicensing.net http://cPlicensing.net # Unauthorized copying is prohibited #Version: 0.01 use Socket; $|++; $ENV{'REMOTE_USER'} = 'root'; $acctsdb = '/var/cpanel/root.accts'; $chkuser = 'root'; if (!-e "/usr/local/cpanel") { print "CPanel not found, Are you sure this is a CPanel box?\n"; exit; } print "Checking /etc/resolv.conf..."; open(RESOLVCONF,"/etc/resolv.conf") or die("Failed, Where is your resolv.conf?\n"); while() { chomp; if(/127.0.0.1/) { print "Found 127.0.0.1 in the resolv.conf, this is a no no! Change it to the base ip of the server\n"; exit; } } close(RESOLVCONF); print "Check Complete\n"; print "Rebuilding $acctsdb..."; system("/usr/local/cpanel/whostmgr/bin/whostmgr fetchcsv > /dev/null"); if (!-e "$acctsdb") { print "$acctsdb Not found\n"; exit; } print "Done\n"; print "Opening $acctsdb..."; open(DATA,"$acctsdb") or die("failed\n"); print "done\nScanning Domains...."; while() { print "."; $totaldom++; ($UNDEF,$domain,$ip,$UNDEF,$UNDEF,$UNDEF,$UNDEF,$UNDEF,$UNDEF,$UNDEF,$UNDEF,$UNDEF,$owner) = split(/,/, $_, 28); chomp($domain,$ip,$owner); $ip=~ s/:443//; if ($owner ne $chkuser) { next; } $iaddr = gethostbyname($domain); if (!$iaddr){ push @failedresolve, "$domain"; next; } $domainip = inet_ntoa($iaddr); if ($domainip ne $ip) { push @wrongip, "$domain($ip) ---Resolves-to--> $domainip"; } } close(DATA); print "done\n\n"; print "-------------------------------------\n"; print "- LIST OF DOMAINS THAT DONT RESOLVE -\n"; print "=====================================\n"; foreach $failedresolve (@failedresolve) { print "-->$failedresolve\n"; } print "\n\n"; print "-------------------------------------\n"; print "- LIST OF DOMAINS THAT POINT WRONG -\n"; print "=====================================\n"; foreach $wrongip (@wrongip) { print "-->$wrongip\n"; } print "\n\n"; print "-------------------------------------\n"; print "- SUMMERY -\n"; print "=====================================\n"; print "-->TOTAL DOMAINS IN THE DB FILE..........$totaldom\n"; print "-->TOTAL DOMAINS THAT DONT RESOLVE.......".@failedresolve."\n"; print "-->TOTAL DOMAINS THAT POINT ELSE WHERE...".@wrongip."\n"; print "\n\n";