The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

chkcpaccts script (check cpanel accounts)

Discussion in 'General Discussion' started by Snowman30, Nov 27, 2004.

  1. Snowman30

    Snowman30 Well-Known Member
    PartnerNOC

    Joined:
    Apr 7, 2002
    Messages:
    681
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    I found this script at cpanelfaq.org its a few months old but i thought id give it a try. Unfortunately it didnt seem to work. Anyone use it or know of a fix?

    Code:
    #!/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.02
    #
    #+CHANGE LOG
    #-v0.2 :: 2004-22-02 :: Now will show a catagory for domains that point to the correct ip as well. 
    
    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(<RESOLVCONF>) {
            chomp;
            if((/127.0.0.1/) and ($ARGV[0] ne "--allowlocalhost")) {
                    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(<DATA>) {
    	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";
    	} else {
    		push @rightip, "$domain($ip) ---Resolves-to--> $domainip";
    	}
    }
    close(DATA);
    print "done\n\n";
    
    print "\n\n";
    print "-------------------------------------\n";
    print "- LIST OF DOMAINS THAT POINT RIGHT  -\n";
    print "=====================================\n";
    foreach (@rightip) {
            print "-->$_\n";
    }
    print "-------------------------------------\n";
    print "- LIST OF DOMAINS THAT DONT RESOLVE -\n";
    print "=====================================\n";
    foreach (@failedresolve) {
    	print "-->$_\n";
    }
    print "\n\n";
    print "-------------------------------------\n";
    print "- LIST OF DOMAINS THAT POINT WRONG  -\n";
    print "=====================================\n";
    foreach (@wrongip) {
    	print "-->$_\n";
    }
    print "\n\n";
    print "-------------------------------------\n";
    print "-               SUMMARY             -\n";
    print "=====================================\n";
    print "-->TOTAL DOMAINS IN THE DB FILE...................$totaldom\n";
    print "-->TOTAL DOMAINS THAT RESOLVE TO THE CORRECT IP...".@rightip."\n";
    print "-->TOTAL DOMAINS THAT DONT RESOLVE................".@failedresolve."\n";
    print "-->TOTAL DOMAINS THAT POINT ELSE WHERE............".@wrongip."\n";
    print "\n\n";
    
     
  2. Snowman30

    Snowman30 Well-Known Member
    PartnerNOC

    Joined:
    Apr 7, 2002
    Messages:
    681
    Likes Received:
    0
    Trophy Points:
    16
    cPanel Access Level:
    DataCenter Provider
    anyone know of a fix or an update to this script???
     
Loading...

Share This Page