1#!/usr/local/bin/perl
2# This takes output from dnswalk and makes a "rep.orts" directory
3# with one file per contact.  Great for sending mail to all the admins.
4
5mkdir("rep.orts",0777);
6
7while (<>) {
8	if (/^Checking (.*).$/) {
9		$zone=$1;
10		next;
11	}
12	if (/^warning: .* has /) {  # ugly
13		$warning=$_;
14		next;
15	}
16	if (/^SOA.*contact=(.*)$/) {
17		close(REPORT);
18		$contact=$1;
19		$contact=~ tr/A-Z/a-z/;
20		print "writing report for $contact\n";
21		open(REPORT,">>rep.orts/$contact") || die "cannot write to rep.orts/$1: $!\n";
22		print REPORT "Potential errors for zone: $zone\n";
23		if ($warning) {
24			print REPORT $warning;
25			undef $warning;
26		}
27	}
28	print REPORT;
29}
30close(REPORT);
31