File: afpd

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 (48 lines) | stat: -rwxr-xr-x 1,519 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
#!/usr/bin/perl
##########################################################################
# $Id: afpd,v 1.3 2003/12/15 18:09:23 kirk Exp $
##########################################################################

$Detail = $ENV{'LOGWATCH_DETAIL_LEVEL'} || 0;

while (defined($ThisLine = <STDIN>)) {
   if ( ( $ThisLine =~ /^FTP session closed./ ) or
         ( $ThisLine =~ /^(ANONYMOUS )?FTP login as \'.*\' from [^ ]+ \[.*\] to .*/ ) or
         ( $ThisLine =~ /^FTP no transfer time out, disconnected\./ ) or
         ( $ThisLine =~ /^PAM\(.*\): Authentication failure/ ) or
         ( $ThisLine =~ /^data_sendfile/ ) or
         ( $ThisLine =~ /^FTP no transfer timeout, disconnected\./ ) or
         ( $ThisLine =~ /^FTP login timed out, disconnected\./ ) or 
         ( $ThisLine =~ /done/ ) or 
         ( $ThisLine =~ /server_child/ ) or 
         ( $ThisLine =~ /session from/ ) or 
         ( $ThisLine =~ /ASIP session/ ) or 
         ( $ThisLine =~ /logout/ )
      ) {
      # We don't care about these
   }
   elsif ( ($Login) = ( $ThisLine =~ /login ([^ ]+)/) ) {
      $UserLogin{$Login}++;
   }
   else {
      # Report any unmatched entries...
      push @OtherList,$ThisLine;
   }
}

if (keys %UserLogin) {
   print "\nUsers Logged In:\n";
   foreach $Line (keys %UserLogin) {
      print "   $Line : $UserLogin{$Line} Time(s)\n";
   }
}

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

exit(0);

# vi: shiftwidth=3 tabstop=3 et