File: clamav

package info (click to toggle)
logwatch 5.2.2-5
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,112 kB
  • ctags: 42
  • sloc: perl: 9,032; sh: 65; makefile: 54
file content (93 lines) | stat: -rwxr-xr-x 3,375 bytes parent folder | download
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
#!/usr/bin/perl
##################################################################
#
# clamav script ver. 0.31 for Logwatch.
#
# Written by S. Schimkat <www.schimkat.dk>.
#
# Find latest version here: www.schimkat.dk/clamav
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
##################################################################
$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'};

while (defined($ThisLine = <STDIN>)) {
   if ( ( $ThisLine =~ /^Reading databases from/ ) or  
        ( $ThisLine =~ /^Socket file/ ) or
        ( $ThisLine =~ /^Pid file/ ) or
        ( $ThisLine =~ /^Log file/ ) or
        ( $ThisLine =~ /^Protecting against/ ) or
        ( $ThisLine =~ /^Unix socket file/ ) or
        ( $ThisLine =~ /^Setting connection queue length to/ ) or
        ( $ThisLine =~ /^Maximal number of threads:/ ) or
        ( $ThisLine =~ /^Archive/ ) or
        ( $ThisLine =~ /^RAR support/ ) or
        ( $ThisLine =~ /^Mail files support/ ) or
        ( $ThisLine =~ /^Self checking every/ ) or
        ( $ThisLine =~ /^Timeout set to/ ) or
        ( $ThisLine =~ /^Running as user \w+ \(UID \d+, GID \d+\)/ ) or 
        ( $ThisLine =~ /^Exiting \(clean\)/ ) or
        ( $ThisLine =~ /^OLE2 support enabled./ ) or
        ( $ThisLine =~ /^No stats for Database check/ )) {
      # We do not care about these.
   } elsif (($Check) = ($ThisLine =~ /^SelfCheck: (.*?)\.?\s?\n/i)) {
      $SelfCheck{$Check}++;
   } elsif (($Virus) = ($ThisLine =~ /^.+?: (.*?) FOUND/i )) {
      $VirusList{$Virus}++;
   } elsif (($Viruses) = ($ThisLine =~ /^Database correctly reloaded \((\d+) viruses\)/i )) {
      $DatabaseReloads{$Viruses}++;
   } elsif (($ThisLine =~ /Stopped at/)) {
      $DaemonStop++;
   } elsif (($ThisLine =~ /Daemon started/)) {
      $DaemonStart++;
   } else {
      # Comment the following line if using verbose logging.
      # Note that doing that will result in not displaying the extra log.
      push @OtherList,$ThisLine;
   }
}

if (($DaemonStop) and ($Detail >= 5)) {
   print "\nDaemon stopped: ". $DaemonStop." Time(s)\n";
}

if (($DaemonStart) and ($Detail >= 5)) {
   print "\nDaemon started: ". $DaemonStart." Time(s)\n";
}

if (keys %VirusList) {
   print "\nViruses detected:\n";
   foreach $Virus (sort {$a cmp $b} keys %VirusList) {
      print '   ' . $Virus . ": ". $VirusList{$Virus} . " Time(s)\n";
   }
}

if (keys %SelfCheck) {
   print "\nDaemon check list:\n";
   foreach $Check (sort {$a cmp $b} keys %SelfCheck) {
      print '   ' . $Check . ": ". $SelfCheck{$Check} . " Time(s)\n";
   }
}

if (keys %DatabaseReloads) {
   print "\nVirus database reloads:\n";
   foreach $VirusCount (sort {$a cmp $b} keys %DatabaseReloads) {
      print '   Now protecting against ' . $VirusCount . ' viruses: ' . $DatabaseReloads{$VirusCount} . " Time(s)\n";
   }
}

if (($#OtherList >= 0) and (not $IngoreUnmatched)){
   print "\n**Unmatched Entries**\n";
   print @OtherList;
}

exit(0);