#!/usr/bin/perl # # Quick run through the maillog to see how each DNSBL performed. # By: David A. Flanigan # No Warrnety provided or implied, use at your own risk. # Free for any use. Please send improvements back to dave@flanigan.net # E-mail dave@flanigan.net with questions on modifying this script. # http://www.flanigan.net/scripts # #Load Nifty Number::Format mod use Number::Format qw(:subs); # init varables $ordb = 0; $dsbl = 0; $najbl = 0; $total =0; # Get Maillog and let grep do some quick pre-processing for us. # I match on spammer.cgi - as it is returned in the error message as # stated in my sendmail.mc - you will need to change this. $maillog = `/bin/grep spammer.cgi /var/log/maillog`; # Loop though maillog and do the counts. @inlog = split(/\n/, $maillog); foreach $line(@inlog) { if ($line =~ /ordb/) { $ordb = $ordb +1; } if ($line =~ /dsbl/) { $dsbl = $dsbl +1; } if ($line =~ /njabl/) { $njabl = $njabl +1; } } $total = $ordb + $dsbl + $njabl; #format before printing $ordb = format_number($ordb, 2); $dsbl = format_number($dsbl, 2); $njabl = format_number($njabl, 2); $total = format_number($total, 2); #Print Output #print "Content-Type: text/html\n\n"; print "