line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package HTTP::MobileAgent::Plugin::CIDR; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
80880
|
use warnings; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
111
|
|
4
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
65
|
|
5
|
2
|
|
|
2
|
|
9
|
use Carp; |
|
2
|
|
|
|
|
7
|
|
|
2
|
|
|
|
|
169
|
|
6
|
2
|
|
|
2
|
|
2008
|
use HTTP::MobileAgent; |
|
2
|
|
|
|
|
59038
|
|
|
2
|
|
|
|
|
66
|
|
7
|
2
|
|
|
2
|
|
1368
|
use HTTP::MobileAgent::Plugin::CIDR::RegEx; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
92
|
|
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
1888
|
use version; our $VERSION = qv('0.0.1'); |
|
2
|
|
|
|
|
4614
|
|
|
2
|
|
|
|
|
13
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
package # hide from PAUSE |
12
|
|
|
|
|
|
|
HTTP::MobileAgent; |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub check_network { |
15
|
640
|
|
|
640
|
0
|
734376
|
my ($self,$ip) = @_; |
16
|
|
|
|
|
|
|
|
17
|
640
|
|
|
|
|
1496
|
my $ipbit = masked_ipbit($ip,32); |
18
|
|
|
|
|
|
|
|
19
|
640
|
100
|
|
|
|
2859
|
$ipbit =~ $self->__network_regex ? 1 : 0; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
128
|
|
|
128
|
|
1176
|
sub __network_regex{ qr(^[01]{32}$) } |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub masked_ipbit { |
25
|
640
|
|
|
640
|
0
|
973
|
my ($ip,$snm,$setrest) = @_; |
26
|
640
|
|
|
|
|
1241
|
$snm =~ s|/||g; |
27
|
|
|
|
|
|
|
|
28
|
640
|
50
|
|
|
|
3988
|
my $ret = $snm ? substr(join("", map { unpack("B8", pack("C", $_)) } split(/\./,$ip)),0,$snm) : |
|
2560
|
|
|
|
|
9779
|
|
29
|
|
|
|
|
|
|
""; |
30
|
640
|
50
|
|
|
|
2260
|
if ($setrest) { |
31
|
0
|
0
|
|
|
|
0
|
$ret .= sprintf("[01]{%d}",32-$snm) if (32-$snm); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
640
|
|
|
|
|
1475
|
return $ret; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; # Magic true value required at end of module |
38
|
|
|
|
|
|
|
__END__ |