line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Filter::Finger; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
53459
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
80
|
|
4
|
2
|
|
|
2
|
|
10
|
use warnings; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
70
|
|
5
|
2
|
|
|
2
|
|
10
|
use vars qw($VERSION); |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
100
|
|
6
|
2
|
|
|
2
|
|
11
|
use base qw(POE::Filter); |
|
2
|
|
|
|
|
109
|
|
|
2
|
|
|
|
|
2685
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
$VERSION = '0.08'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
# {Q1} ::= [{W}|{W}{S}{U}]{C} |
11
|
|
|
|
|
|
|
# {Q2} ::= [{W}{S}][{U}]{H}{C} |
12
|
|
|
|
|
|
|
# {U} ::= username |
13
|
|
|
|
|
|
|
# {H} ::= @hostname | @hostname{H} |
14
|
|
|
|
|
|
|
# {W} ::= /W |
15
|
|
|
|
|
|
|
# {S} ::= | {S} |
16
|
|
|
|
|
|
|
# {C} ::= |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
my $u_regex = qr{[a-z0-9.]+}i; |
19
|
|
|
|
|
|
|
my $h_regex = qr{[-_a-z0-9.]+}i; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new { |
22
|
1
|
|
|
1
|
1
|
467
|
my $class = shift; |
23
|
1
|
|
|
|
|
3
|
my $self = {@_}; |
24
|
1
|
|
|
|
|
3
|
$self->{BUFFER} = []; |
25
|
1
|
|
|
|
|
5
|
bless $self, $class; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
sub get_one_start { |
29
|
1
|
|
|
1
|
1
|
724
|
my ($self, $raw) = @_; |
30
|
1
|
|
|
|
|
2
|
push @{ $self->{BUFFER} }, $_ for @$raw; |
|
4
|
|
|
|
|
17
|
|
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub get_one { |
34
|
5
|
|
|
5
|
1
|
30
|
my $self = shift; |
35
|
5
|
|
|
|
|
9
|
my $events = []; |
36
|
|
|
|
|
|
|
|
37
|
5
|
|
|
|
|
8
|
my $query = shift @{ $self->{BUFFER} }; |
|
5
|
|
|
|
|
13
|
|
38
|
|
|
|
|
|
|
|
39
|
5
|
100
|
|
|
|
15
|
return $events unless defined $query; |
40
|
|
|
|
|
|
|
|
41
|
4
|
|
|
|
|
5
|
my $original = $query; |
42
|
4
|
|
|
|
|
9
|
my $verbose = $query =~ s{\A/W\s*}{}; |
43
|
4
|
|
33
|
|
|
18
|
my $user_regex = $self->{username_regex} || $u_regex; |
44
|
4
|
|
33
|
|
|
20
|
my $host_regex = $self->{hostname_regex} || $h_regex; |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
SWITCH: { |
47
|
4
|
100
|
|
|
|
5
|
if ($query eq '') { |
|
4
|
|
|
|
|
10
|
|
48
|
1
|
|
|
|
|
7
|
push @$events, { listing => { verbose => $verbose } }; |
49
|
1
|
|
|
|
|
3
|
last SWITCH; |
50
|
|
|
|
|
|
|
} |
51
|
3
|
100
|
|
|
|
91
|
if ($query =~ /\A$user_regex\z/) { |
52
|
1
|
|
|
|
|
6
|
push @$events, { user => { username => $query, verbose => $verbose } }; |
53
|
1
|
|
|
|
|
2
|
last SWITCH; |
54
|
|
|
|
|
|
|
} |
55
|
2
|
100
|
|
|
|
119
|
if ($query =~ /\A($user_regex)?((?:\@$host_regex)+)\z/) { |
56
|
1
|
|
|
|
|
6
|
my ($username, $host_string) = ($1, $2); |
57
|
1
|
|
|
|
|
7
|
my @hosts = split /@/, $host_string; |
58
|
1
|
|
|
|
|
3
|
shift @hosts; |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
6
|
push @$events, { forward => |
61
|
|
|
|
|
|
|
{ username => $username, |
62
|
|
|
|
|
|
|
hosts => \@hosts, |
63
|
|
|
|
|
|
|
verbose => $verbose, } |
64
|
|
|
|
|
|
|
}; |
65
|
1
|
|
|
|
|
4
|
last SWITCH; |
66
|
|
|
|
|
|
|
} |
67
|
1
|
|
|
|
|
5
|
push @$events, { unknown => $original }; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
|
70
|
4
|
|
|
|
|
31
|
return $events; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
sub get_pending { |
74
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
75
|
0
|
|
|
|
|
|
return $self->{BUFFER}; |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub put { |
79
|
0
|
|
|
0
|
1
|
|
my ($self, $chunks) = @_; |
80
|
0
|
|
|
|
|
|
[ @$chunks ]; |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
sub clone { |
84
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
85
|
0
|
|
|
|
|
|
my $nself = { }; |
86
|
0
|
|
|
|
|
|
$nself->{$_} = $self->{$_} for keys %{ $self }; |
|
0
|
|
|
|
|
|
|
87
|
0
|
|
|
|
|
|
$nself->{BUFFER} = [ ]; |
88
|
0
|
|
|
|
|
|
return bless $nself, ref $self; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
'Finger meh!'; |
92
|
|
|
|
|
|
|
__END__ |