Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > 1016044c9520e60a9acb42730d9c7adf > files > 7

dnswalk-2.0.2-8mdv2010.0.noarch.rpm

#!/usr/bin/perl
# This takes output from dnswalk and makes a "rep.orts" directory
# with one file per contact.  Great for sending mail to all the admins.

mkdir("rep.orts",0777);

while (<>) {
	if (/^Checking (.*).$/) {
		$zone=$1;
		next;
	}
	if (/^warning: .* has /) {  # ugly
		$warning=$_;
		next;
	}
	if (/^SOA.*contact=(.*)$/) {
		close(REPORT);
		$contact=$1;
		$contact=~ tr/A-Z/a-z/;
		print "writing report for $contact\n";
		open(REPORT,">>rep.orts/$contact") || die "cannot write to rep.orts/$1: $!\n";
		print REPORT "Potential errors for zone: $zone\n";
		if ($warning) {
			print REPORT $warning;
			undef $warning;
		}
	}
	print REPORT;
}
close(REPORT);