File: makereports

package info (click to toggle)
dnswalk 2.0.2-2
  • links: PTS
  • area: main
  • in suites: potato
  • size: 196 kB
  • ctags: 14
  • sloc: perl: 353; sh: 143; makefile: 41
file content (30 lines) | stat: -rwxr-xr-x 670 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/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);