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 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688
|
########################################################
# Please file all bug reports, patches, and feature
# requests under:
# https://sourceforge.net/p/logwatch/_list/tickets
# and copy:
# Mike Tremaine <mgt \@\ stellarcore.net>
# Help requests and discusion can be filed under:
# https://sourceforge.net/p/logwatch/discussion/
########################################################
########################################################
# This was written and is maintained by:
# Mike Tremaine <mgt \@\ stellarcore.net>
#
# Sophos Support and other improvements by Mark W. Nienberg
# MailScan_Spam_Act contributed by Kev Green
#
# Some more clean up rules based on extensive use of some MailScanner
# settings and F-Prot and ClamAV as dual scanners by Hugo van der Kooij
#
# More F-Prot code from John Wilcock
#
########################################################
#####################################################
## Copyright (c) 2008 Mike Tremaine
## Covered under the included MIT/X-Consortium License:
## http://www.opensource.org/licenses/mit-license.php
## All modifications and contributions by other persons to
## this script are assumed to have been donated to the
## Logwatch project and thus assume the above copyright
## and licensing terms. If you want to make contributions
## under your own copyright or a different license this
## must be explicitly stated in the contribution an the
## Logwatch project reserves the right to not accept such
## contributions. If you have made significant
## contributions to this script and want to claim
## copyright please contact logwatch-devel@lists.sourceforge.net.
#########################################################
#use diagnostics;
use strict;
my $Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;
my $phishing_detail = $ENV{'mailscanner_phishing_detail'} || 0;
my $mailscanner_phishingthreshold = $ENV{'mailscanner_phishingthreshold'} || 0;
#Init Counters
my $MailScan_bytes = my $MailScan_Content = my $MailScan_Delivered =
my $MailScan_Other = my $MailScan_RBL = my $MailScan_Received =
my $MailScan_Spam = my $MailScan_Unscanned = my $MailScan_Virus =
my $SA_timeout = my $MailScan_ScannerTimeout = my $MailScan_GoodWatermark =
my $MailScan_BadWatermark = my $MailScan_SkipWatermark = my $SpamAssassin_Rule_Actions =
my $MailScan_Deleted_pdb = my $MailScan_Found_pdb = my $MailScan_Spam_Virus =
my $MailScan_VirtualHost= my $MailScan_Virus_Antivir= my $MailScan_Virus_BitDefender=
my $MailScan_Virus_ClamAv= my $MailScan_Virus_Clamd= my $MailScan_Virus_ClamAVModule=
my $MailScan_Virus_Fprot= my $MailScan_Virus_McAfee= my $MailScan_Virus_Kaspersky=
my $MailScan_Virus_Sophos= my $MailScan_Virus_SophosSavi= my $MailScan_FilenameAllow=
my $MailScan_FilenameBanned= my $MailScan_FiletypeAllow= my $MailScan_FiletypeBanned=
my $MailScan_Whitelisted= my $MailScan_Blacklisted= my $MailScan_Phishing=
my $MailScan_FormTag= my $MailScan_ScriptTag= my $MailScan_IframeTag=
my $MailScan_ObjectTag= my $MailScan_ImgTag= my $MailWatchSQL=
my $DisarmedQuarantined= my $SACacheHit= my $MailScan_Skipwatermark=
0;
#Initalize hashes
my (
%Spam_Virus_Found, %OtherList, %SpamAssassin_Action,
%SpamAssassin_Message, %ImgTagSource, %ObjectTagSource,
%SpamAssassin_Rule, %IframeTagSource, %FormTagSource,
%ScriptTagSource, %PhishingSourceDest, %PhishingSource,
%FilenameAllow, %FiletypeAllow, %FilenameType,
%FiletypeType, %ContentType, %RBLType,
%Blacklisted_Host, %Whitelisted_Host, %Hostlist,
%VirusType_Antivir, %VirusType_BitDefender, %VirusType_ClamAv,
%VirusType_Clamd, %VirusType_Fprot, %VirusType_ClamAVModule,
%VirusType_McAfee, %VirusType_Kaspersky, %VirusType_Sophos,
%MailScan_Spam_Act, %VirusScannerTimeout, %VirusType_SophosSavi,
);
while (defined(my $ThisLine = <STDIN>)) {
#($QueueID) = ($ThisLine =~ m/^([a-zA-Z0-9]+): / );
$ThisLine =~ s/^[a-zA-Z0-9]+: //;
if ( ( $ThisLine =~ m/^Saved infected/ ) or
( $ThisLine =~ m/^Expanding TNEF archive/ ) or
#TNEF Noise remove for now. IF anyone wants this counted just speak up -mgt
( $ThisLine =~ m/has had TNEF winmail.dat removed/ ) or
( $ThisLine =~ m/added TNEF contents/ ) or
( $ThisLine =~ m/^Warned about/ ) or
( $ThisLine =~ m/^Sender Warnings:/ ) or
( $ThisLine =~ m/X-Spam/ ) or
( $ThisLine =~ m/Using locktype = (flock|posix)/ ) or
( $ThisLine =~ m/Creating hardcoded struct_flock subroutine for / ) or
( $ThisLine =~ m/New Batch: Found/ ) or
( $ThisLine =~ m/Attempting to disinfect/ ) or
( $ThisLine =~ m/Rescan found/ ) or
( $ThisLine =~ m/Virus Re-scanning:/ ) or
( $ThisLine =~ m/Content Checks: Fixed awkward MIME boundary for Cyrus IMAP/ ) or
( $ThisLine =~ m/Delete bayes lockfile/ ) or
( $ThisLine =~ m/MailScanner E-Mail Virus Scanner version/ ) or
( $ThisLine =~ m/MailScanner child dying of old age/ ) or
( $ThisLine =~ m/MailScanner child caught a SIGHUP/ ) or
( $ThisLine =~ m/Virus and Content Scanning/ ) or
( $ThisLine =~ m/Virus Scanning: [\w]+ found/ ) or
( $ThisLine =~ m/Found spam based virus Sanesecurity\./ ) or
( $ThisLine =~ m/Virus Scanning: ClamAV Module found [\d]+ infections/ ) or
( $ThisLine =~ m/^ClamAV virus database has been updated/ ) or
( $ThisLine =~ m/^ClamAV update of/ ) or
( $ThisLine =~ m/^ClamAV scanner using unrar command / ) or
( $ThisLine =~ m/Saved entire message to/ ) or
( $ThisLine =~ m/Spam Checks: Starting/ ) or
( $ThisLine =~ m/SophosSAVI .+ recognizing [0-9]+ viruses/ ) or
( $ThisLine =~ m/SophosSAVI using [0-9]+ IDE files/ ) or
( $ThisLine =~ m/Sophos SAVI library has been updated/ ) or
( $ThisLine =~ m/Sophos.*update.* detected, resetting SAVI/ ) or
#( $ThisLine =~ m/RBL checks: .+ found in RFC-IGNORANT-POSTMASTER/ ) or
( $ThisLine =~ m/F-Prot found/ ) or
( $ThisLine =~ m/SpamAssassin Bayes database rebuild starting|preparing|completed/ ) or
( $ThisLine =~ m/Rebuilding SpamAssassin Bayes database/ ) or
( $ThisLine =~ m/Skipping SpamAssassin while waiting for Bayes/ ) or
( $ThisLine =~ m/Enabling SpamAssassin auto-whitelist functionality/ ) or
( $ThisLine =~ m/Bayes database rebuild is due/ ) or
( $ThisLine =~ m/Content Checks: Detected and will convert|disarm HTML/ ) or
( $ThisLine =~ m/Content Checks: Detected and have disarmed HTML message/ ) or
( $ThisLine =~ m/Content Checks: Found [0-9]+ problems/ ) or
( $ThisLine =~ m/Read [0-9]+ hostnames from the phishing whitelist/ ) or
( $ThisLine =~ m/completed at [0-9]+ bytes per second/ ) or
( $ThisLine =~ m/Message .+ from .+ to .+ is/ ) or
( $ThisLine =~ m/^[A-F0-9]+\.[A-F0-9]{5} to/ ) or #for postfix Requeue:
( $ThisLine =~ m/^calling custom .* function/ ) or
( $ThisLine =~ m/^Initialising database connection/ ) or
( $ThisLine =~ m/^Finished initialising database connection/ ) or
( $ThisLine =~ m/^Disconnected from the database/ ) or
( $ThisLine =~ m/^<A> tag found in message/ ) or
( $ThisLine =~ m/^Viruses marked as silent:/ ) or
( $ThisLine =~ m/^Saved archive copies of/ ) or
( $ThisLine =~ m/^Logging message .+ to SQL/ ) or
( $ThisLine =~ m/^Started SQL Logging child/ ) or
( $ThisLine =~ m/^Starting up SQL Whitelist|Blacklist/ ) or
( $ThisLine =~ m/^Read .+ whitelist|blacklist entries/ ) or
( $ThisLine =~ m/^Closing down by-domain spam whitelist|blacklist/ ) or
( $ThisLine =~ m/^Connected to SpamAssassin cache database/ ) or
( $ThisLine =~ m/^Using SpamAssassin results cache/ ) or
( $ThisLine =~ m/^Expired .+ records from the SpamAssassin cache/ ) or
( $ThisLine =~ m/^Batch (\([0-9]+ messages?\) )?processed in .+ seconds/ ) or
( $ThisLine =~ m/^\"Always Looked Up Last\" took .+ seconds/ ) or
( $ThisLine =~ m/^MailScanner child dying after Bayes rebuild/ ) or
( $ThisLine =~ m/^Files hidden in very deeply nested archive/ ) or
#IPBlocking -mgt
( $ThisLine =~ m/^Initialising IP blocking/ ) or
( $ThisLine =~ m/^Closing down IP blocking/ ) or
( $ThisLine =~ m/Whitelist refresh time reached/ ) or
( $ThisLine =~ m/Skipping sender of precedence list/ ) or
( $ThisLine =~ m/^Read \d+ IP blocking entries from/ ) or
#This for Kaspersky I guess it is duplicated by Content checks, remove if not -mgt
( $ThisLine =~ m/^\/var\/spool\/MailScanner\/incoming\/.+SUSPICION/ ) or
# New processing database
( $ThisLine =~ m/Connected to [Pp]rocessing(?:-messages| Attempts) [Dd]atabase/ ) or
( $ThisLine =~ m/Found 0 messages in the [Pp]rocessing(?:-messages| Attempts) [Dd]atabase/ ) or
( $ThisLine =~ m/Reading configuration file/ ) or
( $ThisLine =~ m/^SpamAssassin temporary working directory is/ ) or
( $ThisLine =~ m/ignored whitelist, had .+ recipients/ )
) {
# We don't care about these
} elsif ( $ThisLine =~ m/New Batch: Scanning ([0-9]+) messages, ([0-9]+) bytes/i) {
$MailScan_Received = $MailScan_Received + $1;
$MailScan_bytes = $MailScan_bytes + $2;
} elsif ( $ThisLine =~ m/New Batch: Forwarding ([0-9]+) unscanned messages, ([0-9]+) bytes/i) {
$MailScan_Received = $MailScan_Received + $1;
$MailScan_Unscanned = $MailScan_Unscanned + $1;
$MailScan_bytes = $MailScan_bytes + $2;
} elsif ( $ThisLine =~ m/Delivered ([0-9]+)( cleaned)? messages/) {
$MailScan_Delivered = $MailScan_Delivered + $1;
} elsif ( $ThisLine =~ m/Spam Checks: Found ([0-9]+) spam messages/) {
$MailScan_Spam = $MailScan_Spam + $1;
} elsif ( $ThisLine =~ m/Virus Scanning: Found ([0-9]+) viruses/) {
$MailScan_Virus = $MailScan_Virus + $1;
} elsif ( $ThisLine =~ m/Found spam-virus (\S+) in/i) {
$MailScan_Spam_Virus++;
$Spam_Virus_Found{$1}++;
} elsif ( $ThisLine =~ m/infected message .+ came from (.*)/i) {
$MailScan_VirtualHost = $MailScan_VirtualHost + 1;
$Hostlist{$1}++;
} elsif ( $ThisLine =~ m/Other Checks: Found ([0-9]+) problems/) {
$MailScan_Other = $MailScan_Other + $1;
} elsif ($ThisLine =~ m/Contains signature of the worm (.+)/) {
$VirusType_Antivir{$1}++;
$MailScan_Virus_Antivir++;
} elsif ($ThisLine =~ m/:infected: (.+)/i) {
#without the leading : this would match Fprot so error on the side of matching to much -mgt
$VirusType_BitDefender{$1}++;
$MailScan_Virus_BitDefender++;
} elsif ( ($ThisLine =~ m/^\/var\/spool\/MailScanner\/incoming\/.+: ([\w\_\-\.\/]+) FOUND/i) or
($ThisLine =~ m/Clamd::INFECTED:: ?(\S+) ::/i) ) {
$VirusType_ClamAv{$1}++;
$MailScan_Virus_ClamAv++;
} elsif ($ThisLine =~ m/ClamAVModule::INFECTED:: ?(.+)::/) {
$VirusType_ClamAVModule{$1}++;
$MailScan_Virus_ClamAVModule++;
} elsif ($ThisLine =~ m/INFECTED:: ?(.+) (FOUND )?::/) {
$VirusType_Clamd{$1}++;
$MailScan_Virus_Clamd++;
} elsif ($ThisLine =~ m/\/.+ Infection: (.+)/i) {
$VirusType_Fprot{$1}++;
$MailScan_Virus_Fprot++;
} elsif ($ThisLine =~ m/\/.+ is a security risk named (.+)/i) {
$VirusType_Fprot{$1}++;
$MailScan_Virus_Fprot++;
} elsif ($ThisLine =~ m/\/.+ is a dropper for (.+)/i) {
$VirusType_Fprot{$1}++;
$MailScan_Virus_Fprot++;
} elsif ($ThisLine =~ m/\/.+ contains (.+)/i) {
$VirusType_Fprot{$1}++;
$MailScan_Virus_Fprot++;
} elsif ($ThisLine =~ m/\/.+ could be/i) {
$MailScan_Virus_Fprot++;
} elsif ($ThisLine =~ m/Found the (.+) virus !!!/) {
$VirusType_McAfee{$1}++;
$MailScan_Virus_McAfee++;
} elsif ($ThisLine =~ m/^\/var\/spool\/MailScanner\/incoming\/.+INFECTED\s+([\w\_\-\.\/]+)/i) {
$VirusType_Kaspersky{$1}++;
$MailScan_Virus_Kaspersky++;
} elsif ($ThisLine =~ m/infected:\s+([\w\_\-\.\/]+)\^M/i) {
$VirusType_Kaspersky{$1}++;
$MailScan_Virus_Kaspersky++;
} elsif ($ThisLine =~ m/>>> Virus \'(.+)\' found/) {
$VirusType_Sophos{$1}++;
$MailScan_Virus_Sophos++;
} elsif ($ThisLine =~ m/SophosSAVI::INFECTED:: ?(.+)::/) {
$VirusType_SophosSavi{$1}++;
$MailScan_Virus_SophosSavi++;
} elsif ($ThisLine =~ m/Commercial scanner (.+) timed out!/){
$VirusScannerTimeout{$1}++;
$MailScan_ScannerTimeout++;
} elsif ($ThisLine =~ m/Content Checks: Detected and have disarmed (.+) in HTML message in [\w]+/i) {
$ContentType{$1}++;
$MailScan_Content++;
} elsif ($ThisLine =~ m/Content Checks: Detected (.+) in [\w]+/i) {
$ContentType{$1}++;
$MailScan_Content++;
} elsif ($ThisLine =~ m/Filename Checks: Allowing (.+)/i) {
if ($ThisLine =~ m/Allowing.*msg\-[0-9]*\-[0-9]*\.[txt|dat|html]/) {
# we don't care about these, regular messages
} else {
#filter sendmail or postfix tag and "(no rule matched)"
my $temp_fc = $1;
$temp_fc =~ s/[a-z0-9]{14}\s//i;
$temp_fc =~ s/[a-z0-9]{9,12}\.[a-z0-9]{5}\s//i;
$temp_fc =~ s/\(no rule matched\)//i;
$FilenameAllow{$temp_fc}++;
$MailScan_FilenameAllow++;
}
} elsif ($ThisLine =~ m/Filename Checks: (.+)/i) {
#filter sendmail or postfix tag
my $temp_fc = lc($1);
$temp_fc =~ s/\([a-z0-9]{14}\s/\(/i;
$temp_fc =~ s/\([a-z0-9]{9,12}\.[a-z0-9]{5}\s/\(/i;
$temp_fc =~ s/\s{10,}/ -space- /;
$FilenameType{$temp_fc}++;
$MailScan_FilenameBanned++;
} elsif ($ThisLine =~ m/Filetype Checks: Allowing (.+)/i) {
if ($ThisLine =~ m/Allowing.*msg\-[0-9]*\-[0-9]*\.[txt|dat|html]/) {
# we don't care about these, regular messages
} else {
#filter sendmail or postfix tag and "(no match found)"
my $temp_fc = $1;
$temp_fc =~ s/[a-z0-9]{14}\s//i;
$temp_fc =~ s/[a-z0-9]{9,12}\.[a-z0-9]{5}\s//i;
$temp_fc =~ s/\(no match found\)//i;
$FiletypeAllow{$temp_fc}++;
$MailScan_FiletypeAllow++;
}
} elsif ($ThisLine =~ m/Filetype Checks: (.+)/i) {
#filter sendmail or postfix tag
my $temp_fc = lc($1);
$temp_fc =~ s/\([a-z0-9]{14}\s/\(/i;
$temp_fc =~ s/\([a-z0-9]{9,12}\.[a-z0-9]{5}\s/\(/i;
$temp_fc =~ s/\s{10,}/ -space- /;
$FiletypeType{$temp_fc}++;
$MailScan_FiletypeBanned++;
} elsif ($ThisLine =~ m/(Password\-protected archive \(.+\)) in \w+/i) {
$MailScan_Other = $MailScan_Other + 1;
$FilenameType{$1}++;
$MailScan_FilenameBanned++;
} elsif ($ThisLine =~ /Spam Actions: .+ actions are (.*)/) {
$MailScan_Spam_Act{$1}++;
} elsif ($ThisLine =~ /SpamAssassin timed out and was killed/) {
$SA_timeout++;
} elsif ( $ThisLine =~ m/Message .+ from (.+ \(.+\)) is whitelisted/ ) {
$MailScan_Whitelisted++;
$Whitelisted_Host{$1}++;
} elsif ( $ThisLine =~ m/Message .+ from (.+ \(.+\)) to .+ is spam \(blacklisted\)/ ) {
$MailScan_Blacklisted++;
$Blacklisted_Host{$1}++;
} elsif ($ThisLine =~ m/^Found phishing fraud from (.+) claiming to be (.+) in (.+)/) {
$MailScan_Phishing++;
#Detailed phishing output set in mailscanner.conf
#With variable mailscanner_phishing_detail = 1
if ($phishing_detail) {
$PhishingSourceDest{"$1 claiming to be $2 in $3"}++;
} else {
$PhishingSourceDest{"$1 claiming to be $2"}++;
}
my $temp_ph = $1;
if ($temp_ph =~ m/^https?:\/\/([^\/\? ]+)/i) {
$PhishingSource{$1}++;
} else {
$PhishingSource{$temp_ph}++;
}
} elsif ($ThisLine =~ m/^Found ip-based phishing fraud from (.+) in/) {
$MailScan_Phishing++;
my $temp_ph = $1;
if ($temp_ph =~ m/^https?:\/\/([\d\.]+)/i) {
$PhishingSource{$1}++;
} else {
$PhishingSource{$temp_ph}++;
}
$PhishingSource{$1}++;
} elsif ($ThisLine =~ m/^Found definite phishing fraud from (.+) in/) {
$MailScan_Phishing++;
my $temp_ph = $1;
if ($temp_ph =~ m/^https?:\/\/([^\/\? ]+)/i) {
$PhishingSource{$1}++;
} else {
$PhishingSource{$temp_ph}++;
}
} elsif ($ThisLine =~ m/^HTML-Form tag found in message .+ from (.+)/) {
$MailScan_FormTag++;
$FormTagSource{$1}++;
} elsif ($ThisLine =~ m/^HTML-Script tag found in message .+ from (.+)/) {
$MailScan_ScriptTag++;
$ScriptTagSource{$1}++;
} elsif ($ThisLine =~ m/^HTML-IFrame tag found in message .+ from (.+)/) {
$MailScan_IframeTag++;
$IframeTagSource{$1}++;
} elsif ($ThisLine =~ m/^HTML-Object tag found in message .+ from (.+)/) {
$MailScan_ObjectTag++;
$ObjectTagSource{$1}++;
} elsif ($ThisLine =~ m/^HTML Img tag found in message .+ from (.+)/) {
$MailScan_ImgTag++;
$ImgTagSource{$1}++;
} elsif ($ThisLine =~ m/Logged to MailWatch SQL/) {
$MailWatchSQL++;
} elsif ($ThisLine =~ m/Quarantining modified message for/) {
$DisarmedQuarantined++;
} elsif ($ThisLine =~ m/SpamAssassin cache hit for message/) {
$SACacheHit++;
} elsif ($ThisLine =~ m/RBL checks: .+ found in (.+)/i) {
$RBLType{$1}++;
$MailScan_RBL++;
} elsif ($ThisLine =~ m/Valid Watermark HASH found in Message/) {
$MailScan_Skipwatermark++;
} elsif ($ThisLine =~ m/Message .+ from .+ has valid watermark/) {
$MailScan_GoodWatermark++;
} elsif ( ($ThisLine =~ m/Message .+ had bad watermark/) ||
($ThisLine =~ m/Message .+ from .+ has no \(or invalid\) watermark or sender address/) ) {
$MailScan_BadWatermark++;
} elsif ($ThisLine =~ m/SpamAssassin Rule Actions: rule ([^ ]*) caused action ([^ ]*) .*in message ([0-9a-f.]*)/i) {
$SpamAssassin_Rule_Actions++;
$SpamAssassin_Rule{$1}++;
$SpamAssassin_Action{$2}++;
$SpamAssassin_Message{$3}++;
} elsif ($ThisLine =~ m/Deleted (\d+) messages from processing-database/) { $MailScan_Deleted_pdb += $1;
} elsif ($ThisLine =~ m/Found (\d+) messages in the [Pp]rocessing(?:-messages| Attempts) [Dd]atabase/) {
$MailScan_Found_pdb += $1;
} else {
chomp($ThisLine);
# Report any unmatched entries...
$OtherList{$ThisLine}++;
}
}
if ($MailScan_Received > 0) {
print "\nMailScanner Status:";
print "\n\t" . $MailScan_Received . ' messages Scanned by MailScanner';
my $size_total = 1 ;
if ($MailScan_bytes < 1024) {
$size_total = $MailScan_bytes . ' Total Bytes';
} elsif ($MailScan_bytes < 1048576) {
$size_total = sprintf("%.1f", ($MailScan_bytes / 1024)) . ' Total KB';
} else {
$size_total = sprintf("%.1f", ($MailScan_bytes / 1048576)) . ' Total MB';
}
print "\n\t" . $size_total ;
}
if ($MailScan_Spam > 0) {
print "\n\t" . $MailScan_Spam . ' Spam messages detected by MailScanner';
}
if (keys %MailScan_Spam_Act) {
foreach my $ThisOne (sort keys %MailScan_Spam_Act) {
if ($MailScan_Spam_Act{$ThisOne} > 0) {
print "\n\t\t" . $MailScan_Spam_Act{$ThisOne} . ' Spam messages with action(s) ' .$ThisOne ;
}
}
}
if ($SACacheHit > 0) {
print "\n\t\t" . $SACacheHit . ' hits from MailScanner SpamAssassin cache';
}
#if ($MailScan_Spam_Virus > 0) {
# print "\n\t" . $MailScan_Spam_Virus . ' Spam messages detected by Virus signatures';
#}
if ($MailScan_Unscanned > 0) {
print "\n\t" . $MailScan_Unscanned . ' Messages forwarded unscanned by MailScanner';
}
if ($MailScan_Virus > 0) {
print "\n\t" . $MailScan_Virus . ' Viruses found by MailScanner';
}
if ($MailScan_Other > 0) {
print "\n\t" . $MailScan_Other . ' Banned attachments found by MailScanner';
}
if ($MailScan_Content > 0) {
print "\n\t" . $MailScan_Content . ' Content Problems found by MailScanner';
}
if ($MailScan_Deleted_pdb > 0) {
print "\n\t" . $MailScan_Deleted_pdb . " Messages deleted from processing-database";
}
if ($MailScan_Found_pdb > 0) {
print "\n\t" . $MailScan_Found_pdb . " Messages found in processing-database";
}
if ($MailScan_Delivered > 0) {
print "\n\t" . $MailScan_Delivered . " Messages delivered by MailScanner\n";
}
if ($MailWatchSQL > 0) {
print "\n\t" . $MailWatchSQL . " Messages logged to MailWatch database\n";
}
if ($SA_timeout > 0) {
print "\n\t" . $SA_timeout . " SpamAssassin timeout(s)\n";
}
if (keys %VirusScannerTimeout) {
print "\n\t" . $MailScan_ScannerTimeout . " virus scanner timeout(s)\n";
foreach my $ThisOne (sort keys %VirusScannerTimeout) {
print "\t " . $ThisOne . ": " . $VirusScannerTimeout{$ThisOne} . " Time(s)\n";
}
}
if (keys %VirusType_Antivir) {
print "\nAntivir Virus Report: (Total Seen = $MailScan_Virus_Antivir)\n";
foreach my $ThisOne (sort keys %VirusType_Antivir) {
print ' ' . $ThisOne . ': ' . $VirusType_Antivir{$ThisOne} . " Times(s)\n";
}
}
if (keys %VirusType_BitDefender) {
print "\nBitDefender Virus Report: (Total Seen = $MailScan_Virus_BitDefender)\n";
foreach my $ThisOne (sort keys %VirusType_BitDefender) {
print ' ' . $ThisOne . ': ' . $VirusType_BitDefender{$ThisOne} . " Times(s)\n";
}
}
if (keys %VirusType_ClamAv) {
print "\nClamAV Virus Report: (Total Seen = $MailScan_Virus_ClamAv)\n";
foreach my $ThisOne (sort keys %VirusType_ClamAv) {
print ' ' . $ThisOne . ': ' . $VirusType_ClamAv{$ThisOne} . " Time(s)\n";
}
}
if (keys %VirusType_ClamAVModule) {
print "\nClamAVModule Virus Report: (Total Seen = $MailScan_Virus_ClamAVModule)\n";
foreach my $ThisOne (sort keys %VirusType_ClamAVModule) {
print ' ' . $ThisOne . ': ' . $VirusType_ClamAVModule{$ThisOne} . " Time(s)\n";
}
}
if (keys %VirusType_Clamd) {
print "\nClamd Virus Report: (Total Seen = $MailScan_Virus_Clamd)\n";
foreach my $ThisOne (sort keys %VirusType_Clamd) {
print ' ' . $ThisOne . ': ' . $VirusType_Clamd{$ThisOne} . " Time(s)\n";
}
}
if (keys %VirusType_Fprot) {
print "\nF-Prot Virus Report: (Total Seen = $MailScan_Virus_Fprot)\n";
foreach my $ThisOne (sort keys %VirusType_Fprot) {
print ' ' . $ThisOne . ': ' . $VirusType_Fprot{$ThisOne} . " Time(s)\n";
}
}
if (keys %VirusType_Kaspersky) {
print "\nKaspersky Virus Report: (Total Seen = $MailScan_Virus_Kaspersky)\n";
foreach my $ThisOne (sort keys %VirusType_Kaspersky) {
print ' ' . $ThisOne . ': ' . $VirusType_Kaspersky{$ThisOne} . " Time(s)\n";
}
}
if (keys %VirusType_McAfee) {
print "\nMcAfee Virus Report: (Total Seen = $MailScan_Virus_McAfee)\n";
foreach my $ThisOne (sort keys %VirusType_McAfee) {
print ' ' . $ThisOne . ': ' . $VirusType_McAfee{$ThisOne} . " Time(s)\n";
}
}
if (keys %VirusType_Sophos) {
print "\nSophos Virus Report: (Total Seen = $MailScan_Virus_Sophos)\n";
foreach my $ThisOne (sort keys %VirusType_Sophos) {
print ' ' . $ThisOne . ': ' . $VirusType_Sophos{$ThisOne} . " Time(s)\n";
}
}
if (keys %VirusType_SophosSavi) {
print "\nSophosSavi Virus Report: (Total Seen = $MailScan_Virus_SophosSavi)\n";
foreach my $ThisOne (sort keys %VirusType_SophosSavi) {
print ' ' . $ThisOne . ': ' . $VirusType_SophosSavi{$ThisOne} . " Time(s)\n";
}
}
if (keys %Spam_Virus_Found) {
print "\nSpam Virus Report: (Total Seen = $MailScan_Spam_Virus)\n";
foreach my $ThisOne (sort keys %Spam_Virus_Found) {
print ' ' . $ThisOne . ': ' . $Spam_Virus_Found{$ThisOne} . " Time(s)\n";
}
}
if (keys %Hostlist) {
print "\nVirus Sender Report: (Total Seen = $MailScan_VirtualHost)\n";
foreach my $ThisOne (sort keys %Hostlist) {
print ' ' . $ThisOne . ': ' . $Hostlist{$ThisOne} . " Time(s)\n";
}
}
if (keys %Whitelisted_Host) {
print "\nSpam Whitelisted Host Report: (Total Seen = $MailScan_Whitelisted)\n";
foreach my $ThisOne (sort keys %Whitelisted_Host) {
print ' ' . $ThisOne . ': ' . $Whitelisted_Host{$ThisOne} . " Time(s)\n";
}
}
if (keys %Blacklisted_Host) {
print "\nSpam Blacklisted Host Report: (Total Seen = $MailScan_Blacklisted)\n";
foreach my $ThisOne (sort keys %Blacklisted_Host) {
print ' ' . $ThisOne . ': ' . $Blacklisted_Host{$ThisOne} . " Time(s)\n";
}
}
if (keys %RBLType) {
print "\nRBL Report: (Total Seen = $MailScan_RBL)\n";
foreach my $ThisOne (sort keys %RBLType) {
print ' ' . $ThisOne . ': ' . $RBLType{$ThisOne} . " Time(s)\n";
}
}
if (keys %ContentType) {
print "\nContent Report: (Total Seen = $MailScan_Content)";
if ($DisarmedQuarantined > 0) { print " (Quarantined = $DisarmedQuarantined)"; }
print "\n";
foreach my $ThisOne (sort keys %ContentType) {
print ' ' . $ThisOne . ': ' . $ContentType{$ThisOne} . " Time(s)\n";
}
}
if (keys %FilenameAllow) {
print "\nAllowed Filename Report: (Total Seen = $MailScan_FilenameAllow)\n";
if ($Detail >= 10) {
foreach my $ThisOne (sort keys %FilenameAllow) {
print ' ' . $ThisOne . ': ' . $FilenameAllow{$ThisOne} . " Time(s)\n";
}
} else {
print ' ' . "Details Suppressed at level $Detail. Level 10 required.\n";
}
}
if (keys %FilenameType) {
print "\nBanned Filename Report: (Total Seen = $MailScan_FilenameBanned)\n";
foreach my $ThisOne (sort keys %FilenameType) {
print ' ' . $ThisOne . ': ' . $FilenameType{$ThisOne} . " Time(s)\n";
}
}
if (keys %FiletypeAllow) {
print "\nAllowed Filetype Report: (Total Seen = $MailScan_FiletypeAllow)\n";
if ($Detail >= 10) {
foreach my $ThisOne (sort keys %FiletypeAllow) {
print ' ' . $ThisOne . ': ' . $FiletypeAllow{$ThisOne} . " Time(s)\n";
}
} else {
print ' ' . "Details Suppressed at level $Detail. Level 10 required.\n";
}
}
if (keys %FiletypeType) {
print "\nBanned Filetype Report: (Total Seen = $MailScan_FiletypeBanned)\n";
foreach my $ThisOne (sort keys %FiletypeType) {
print ' ' . $ThisOne . ': ' . $FiletypeType{$ThisOne} . " Time(s)\n";
}
}
if ( (keys %PhishingSource) && ($mailscanner_phishingthreshold > 0) ) {
print "\nPhishing Report: (Total Seen = $MailScan_Phishing)\n";
foreach my $ThisOne (sort keys %PhishingSource) {
if ( $PhishingSource{$ThisOne} >= $mailscanner_phishingthreshold ) {
print ' ' . $ThisOne . ': ' . $PhishingSource{$ThisOne} . " Time(s)\n";
}
};
if ($Detail >= 10) {
print "\n Detail:\n";
foreach my $ThisOne (sort keys %PhishingSourceDest) {
if ( $PhishingSourceDest{$ThisOne} >= $mailscanner_phishingthreshold ) {
print ' ' . $ThisOne . ': ' . $PhishingSourceDest{$ThisOne} . " Time(s)\n";
}
}
}
}
if (keys %FormTagSource) {
print "\nHTML <FORM> tag report: (Total Seen = $MailScan_FormTag)\n";
foreach my $ThisOne (sort keys %FormTagSource) {
print ' ' . $ThisOne . ': ' . $FormTagSource{$ThisOne} . " Time(s)\n";
}
}
if (keys %ScriptTagSource) {
print "\nHTML <SCRIPT> tag report: (Total Seen = $MailScan_ScriptTag)\n";
foreach my $ThisOne (sort keys %ScriptTagSource) {
print ' ' . $ThisOne . ': ' . $ScriptTagSource{$ThisOne} . " Time(s)\n";
}
}
if (keys %IframeTagSource) {
print "\nHTML <IFRAME> tag report: (Total Seen = $MailScan_IframeTag)\n";
foreach my $ThisOne (sort keys %IframeTagSource) {
print ' ' . $ThisOne . ': ' . $IframeTagSource{$ThisOne} . " Time(s)\n";
}
}
if (keys %ObjectTagSource) {
print "\nHTML <OBJECT> tag report: (Total Seen = $MailScan_ObjectTag)\n";
foreach my $ThisOne (sort keys %ObjectTagSource) {
print ' ' . $ThisOne . ': ' . $ObjectTagSource{$ThisOne} . " Time(s)\n";
}
}
if (keys %ImgTagSource) {
print "\nHTML <IMG> tag report: (Total Seen = $MailScan_ImgTag)\n";
if ($Detail >= 10) {
foreach my $ThisOne (sort keys %ImgTagSource) {
print ' ' . $ThisOne . ': ' . $ImgTagSource{$ThisOne} . " Time(s)\n";
}
} else {
print ' ' . "Details Suppressed at level $Detail. Level 10 required.\n";
}
}
if ($SpamAssassin_Rule_Actions > 0) {
print "\nSpamAssassin Rule Actions: (Total Seen = $SpamAssassin_Rule_Actions)\n";
foreach my $ThisOne (sort keys %SpamAssassin_Rule) {
print ' ' . 'Rule - ' . $ThisOne . ': ' . $SpamAssassin_Rule{$ThisOne} . " Time(s)\n";
}
foreach my $ThisOne (sort keys %SpamAssassin_Action) {
print ' ' . 'Action - ' . $ThisOne . ': ' . $SpamAssassin_Action{$ThisOne} . " Time(s)\n";
}
foreach my $ThisOne (sort keys %SpamAssassin_Message) {
print ' ' . 'Message - ' . $ThisOne . ': ' . $SpamAssassin_Message{$ThisOne} . " Time(s)\n";
}
}
if ( ($MailScan_GoodWatermark > 0) || ($MailScan_BadWatermark > 0) || ($MailScan_Skipwatermark > 0) ) {
print "\nWatermark report:\n";
print " Messages with null sender and valid watermark: $MailScan_GoodWatermark\n";
print " Messages with null sender and bad or no watermark: $MailScan_BadWatermark\n";
print " Messages with valid watermark skipping spam checks: $MailScan_Skipwatermark\n";
}
if (keys %OtherList) {
print "\n**Unmatched Entries**\n";
foreach my $line (sort {$OtherList{$b}<=>$OtherList{$a} } keys %OtherList) {
print " $line: $OtherList{$line} Time(s)\n";
}
}
exit(0);
# vi: shiftwidth=3 tabstop=3 syntax=perl et
# Local Variables:
# mode: perl
# perl-indent-level: 3
# indent-tabs-mode: nil
# End:
|