Subversion Repositories sysadmin_scripts

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
156 rodolico 1
#! /usr/bin/perl -w
2
 
3
sub getWhois {
4
   my $domain = shift;
5
   my @results;
6
   my $filename = "cache/$domain.whois";
7
   if ( -e $filename ) {
8
      print STDERR "Looking up $domain from cache\n";
9
      open WHOIS,"<$filename" or die "Could not read $filename: $!";
10
      @results = <WHOIS>;
11
      close WHOIS;
12
   } else {
13
      @results = `whois $domain`;
14
      print STDERR "Retrieving $domain from whois\n";
15
      sleep(15);
16
      open WHOIS,">$filename" or die "Could not write to $filename: $!";
17
      print WHOIS @results;
18
      close WHOIS;
19
   }
20
   return @results;
21
}
22
 
23
sub checkDomain {
24
   my $domain = shift;
25
   my @results = getWhois( $domain );
26
   my $good = 0;
27
   while ( ! $good and ($line = shift @results)) {
28
      $good = 1 if ($line =~ m/ns.dailydata/i)
29
   }
30
   print "$domain\t" . ($good ? 'ok' : 'BAD') . "\n";
31
}
32
 
33
#open DOMAINS, '<domainlist' or die "Could not open domainlist: $!";
34
my $i = 0;
35
while ( my $domain = <> ) {
36
   chomp $domain;
37
   next unless $domain;
38
   &checkDomain( $domain );
39
}
40
#close DOMAINS;
41
1;