This file is indexed.

/usr/share/logwatch/scripts/services/ftpd-xferlog is in logwatch 7.4.1-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

  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
#!/usr/bin/perl
##########################################################################
# $Id: ftpd-xferlog 164 2013-08-19 10:22:38Z stefjakobs $
##########################################################################

########################################################
## Copyright (c) 2008 Kirk Bauer
## 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 File::Basename qw(dirname);

sub remove_dups {
   my(@info)=sort @_;

   my(%count,@out,$i);
   foreach $i (@info) {
      $count{$i}++;
   }

   foreach $i (keys %count) {
      my($j)=$i;
      $j =~ s/\n//;
      if ($count{$i} > 1) {
         push @out, $j . " (".$count{$i}." Times)\n";
      } else {
         push @out, "$j\n";
      }
   }
   return @out;
}

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

$TotalBytesOut = 0;
$TotalBytesIn = 0;

while (defined($ThisLine = <STDIN>)) {
   # Remove transfer time if it is there
   if ( ($RemoteHost,$Size,$FileName,$Direction,$AccessMode,$UserName) =
         ( $ThisLine =~ /^([^ ]+) (\d+) (.*) . . (.) (.) (.*) ftps? . .*$/ ) ) {
      if ($Detail < 15) {
         $FileName = dirname($FileName);
      }
      if ( $AccessMode eq 'a' ) {
         # Anonymous transfers
         if ( $Direction eq 'o' ) {
            # File was outgoing
            $TotalBytesOut += $Size;
            if ($Detail >= 15) {
               $Temp = '   ' . $FileName . ' -> ' . $RemoteHost . ' (Email: ' . $UserName . ")\n";
            }
            else {
               $Temp = '   ' . $FileName . ' -> ' . $RemoteHost . "\n";
            }
            push @AnonOut, $Temp;
            $FilesOut{$FileName}++;
         } elsif ( $Direction eq 'd' ) {
            $Temp = '   ' . $FileName . ' Deleted ' . $RemoteHost . ' (Email: ' . $UserName . ")\n";
            push @DeletedFiles, $Temp;
         } else {
            # File was incoming
            $TotalBytesIn += $Size;
            if ($Detail >= 15) {
               $Temp = '   ' . $RemoteHost . ' -> ' . $FileName . ' (User: ' . $UserName . ")\n";
            }
            else {
               $Temp = '   ' . $RemoteHost . ' -> ' . $FileName . "\n";
            }
            push @AnonIn, $Temp;
         }
      } elsif ( $AccessMode eq 'g' ) {
        # Guest transfers
         if ( $Direction eq 'o' ) {
            # File was outgoing
            $TotalBytesOut += $Size;
            $Temp = '   ' . $FileName . ' -> ' . $RemoteHost . ' (User: ' . $UserName . ")\n";
            push @GuestOut, $Temp;
         } elsif ( $Direction eq 'd' ) {
            $Temp = '   ' . $FileName . ' Deleted ' . $RemoteHost . ' (User: ' . $UserName . ")\n";
            push @DeletedFiles, $Temp;
         } else {
            # File was incoming
            $TotalBytesIn += $Size;
            $Temp = '   ' . $RemoteHost . ' -> ' . $FileName . ' (User: ' . $UserName . ")\n";
            push @GuestIn, $Temp;
         }
      } elsif ( $AccessMode eq 'r' ) {
         # User transfers
         if ( $Direction eq 'o' ) {
            # File was outgoing
            $TotalBytesOut += $Size;
            $Temp = '   ' . $FileName . ' -> ' . $RemoteHost . ' (User: ' . $UserName . ")\n";
            push @UserOut, $Temp;
         } elsif ( $Direction eq 'd' ) {
            $Temp = '   ' . $FileName . ' Deleted ' . $RemoteHost . ' (User: ' . $UserName . ")\n";
            push @DeletedFiles, $Temp;
         } else {
            # File was incoming
            $TotalBytesIn += $Size;
            $Temp = '   ' . $RemoteHost . ' -> ' . $FileName . ' (User: ' . $UserName . ")\n";
            push @UserIn, $Temp;
         }
      }
   } else {
      # Report any unmatched entries...
      push @OtherList, $ThisLine;
   }
}

@AnonOut=&remove_dups(@AnonOut);
@AnonIn=&remove_dups(@AnonIn);
@GuestOut=&remove_dups(@GuestOut);
@GuestIn=&remove_dups(@GuestIn);
@UserOut=&remove_dups(@UserOut);
@UserIn=&remove_dups(@UserIn);
@OtherList=&remove_dups(@OtherList);
@DeletedFiles=&remove_dups(@DeletedFiles);


$TotalKBytesOut = int $TotalBytesOut/1000;
$TotalKBytesIn = int $TotalBytesIn/1000;
$TotalMBytesOut = int $TotalKBytesOut/1000;
$TotalMBytesIn = int $TotalKBytesIn/1000;
($TotalKBytesOut > 0) and print "TOTAL KB OUT: " . $TotalKBytesOut . "KB (" . $TotalMBytesOut . "MB)\n";
($TotalKBytesIn  > 0) and print "TOTAL KB IN: " . $TotalKBytesIn . "KB (" . $TotalMBytesIn . "MB)\n";

if (@AnonIn) {
   print "\nIncoming Anonymous FTP Transfers:\n";
   print sort @AnonIn;
}

if ( (keys %FilesOut) and ($Detail >= 5) and ($Detail < 10) ) {
   print "\nOutgoing Anonymous FTP Transfers (By File):\n";
   foreach (sort keys %FilesOut) {
      print "   $_: $FilesOut{$_} Time(s)\n";
   }
}

if ( (@GuestIn) and ($Detail >= 10) and ($FTPDetail > 0)) {
   print "\nIncoming Guest FTP Transfers:\n";
   print sort @GuestIn;
}

if ( (@GuestOut) and ($Detail >= 10) and ($FTPDetail > 0)) {
   print "\nOutgoing Guest FTP Transfers:\n";
   print sort @GuestOut;
}

if ( (@AnonOut) and ($Detail >= 10) ) {
   print "\nOutgoing Anonymous FTP Transfers:\n";
   print sort @AnonOut;
}

if ( (@UserIn) and ($Detail >= 10) and ($FTPDetail > 0)) {
   print "\nIncoming User FTP Transfers:\n";
   print sort @UserIn;
}

if ( (@UserOut) and ($Detail >= 10) and ($FTPDetail > 0)) {
   print "\nOutgoing User FTP Transfers:\n";
   print sort @UserOut;
}

if ( (@DeletedFiles) and ($Detail >= 10) and ($FTPDetail > 0)) {
   print "\nDeleted Files:\n";
   print sort @DeletedFiles;
}

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

exit(0);

# vi: shiftwidth=3 tabstop=3 syntax=perl et
# Local Variables:
# mode: perl
# perl-indent-level: 3
# indent-tabs-mode: nil
# End: