line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Net::FTPServer::XferLog; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
6090
|
use 5.006; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
41
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
907
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
require Exporter; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
# Items to export into callers namespace by default. Note: do not export |
12
|
|
|
|
|
|
|
# names by default without a very good reason. Use EXPORT_OK instead. |
13
|
|
|
|
|
|
|
# Do not simply export all your public functions/methods/constants. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
# This allows declaration use Net::FTPServer::XferLog ':all'; |
16
|
|
|
|
|
|
|
# If you do not need this, moving things directly into @EXPORT or @EXPORT_OK |
17
|
|
|
|
|
|
|
# will save memory. |
18
|
|
|
|
|
|
|
our %EXPORT_TAGS = ( 'all' => [ qw( |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
) ] ); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
our @EXPORT_OK = ( @{ $EXPORT_TAGS{'all'} } ); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
our @EXPORT = qw( |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
); |
27
|
|
|
|
|
|
|
our $VERSION = '1.5'; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Preloaded methods go here. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
# unused. was going to be strict about the parse. but it is |
33
|
|
|
|
|
|
|
# time-consuming and harder to debug. |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
my $day_name = qr/\w{3}/; my $month = qr/\w{3}/; |
36
|
|
|
|
|
|
|
my $day = qr/\d{1,2}/; my $time = qr/\d{2}:\d{2}\d{2}/; |
37
|
|
|
|
|
|
|
my $year = qr/\d{4}/; my $xfer_time = qr/\d+/; |
38
|
|
|
|
|
|
|
my $remote_host = qr/.*/; my $bytes_xfer = qr/\d+/; |
39
|
|
|
|
|
|
|
my $filename = qr/(\w|[.])+/;my $xfer_type = qr/([ab])/; |
40
|
|
|
|
|
|
|
my $special_act = qr/([CUT_])+/;my $direction = qr/(o|i)/; |
41
|
|
|
|
|
|
|
my $access_mode = qr/(a|g|r)/; my $user_name = qr/\w+/; |
42
|
|
|
|
|
|
|
my $svc_name = qr/ftp/; my $auth_method = qr/(0|1)/; |
43
|
|
|
|
|
|
|
my $auth_userid = qr/([*]|\w+)/;my $status = qr/(c|i)/; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
our @field = qw(day_name month day current_time year transfer_time |
47
|
|
|
|
|
|
|
remote_host file_size filename transfer_type |
48
|
|
|
|
|
|
|
special_action_flag direction access_mode username |
49
|
|
|
|
|
|
|
service_name authentication_method authenticated_user_id |
50
|
|
|
|
|
|
|
completion_status); |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub parse_line { |
54
|
4
|
50
|
|
4
|
0
|
343
|
my $self = shift; my $line = shift or die "must supply xferlog line"; |
|
4
|
|
|
|
|
10
|
|
55
|
|
|
|
|
|
|
|
56
|
4
|
|
|
|
|
5
|
my %field; |
57
|
|
|
|
|
|
|
|
58
|
4
|
|
|
|
|
15
|
my @field = @field; |
59
|
|
|
|
|
|
|
|
60
|
4
|
|
|
|
|
36
|
my @tmp = split /\s+/, $line; |
61
|
4
|
100
|
|
|
|
11
|
if (scalar @tmp == scalar @field) { |
62
|
3
|
|
|
|
|
35
|
@field{@field} = @tmp; |
63
|
|
|
|
|
|
|
} else { |
64
|
1
|
|
|
|
|
3
|
for (@field) { |
65
|
9
|
100
|
|
|
|
16
|
last if $_ eq 'filename'; |
66
|
8
|
|
|
|
|
12
|
$field{$_} = shift @tmp; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
1
|
|
|
|
|
1
|
@field = reverse @field; |
70
|
1
|
|
|
|
|
2
|
@tmp = reverse @tmp; |
71
|
|
|
|
|
|
|
|
72
|
1
|
|
|
|
|
2
|
for (@field) { |
73
|
10
|
100
|
|
|
|
17
|
last if $_ eq 'filename'; |
74
|
9
|
|
|
|
|
12
|
$field{$_} = shift @tmp; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
1
|
|
|
|
|
2
|
@tmp = reverse @tmp ; |
78
|
1
|
|
|
|
|
4
|
$field{filename} = "@tmp"; |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
# map { print "$_ => $field{$_} \n" } @field; |
84
|
|
|
|
|
|
|
# print "-------------------"; |
85
|
4
|
|
|
|
|
29
|
\%field; |
86
|
|
|
|
|
|
|
} |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |
90
|
|
|
|
|
|
|
__END__ |