Identifier/Plugin/Facebook.pm

filter: Statementstmt 76.9% 20 / 26 Branchbran n/a Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 85.7% 6 / 7 Podpod 33.3% 1 / 3 totaltotal 68.2% 28 / 41 CC 2 SCAR 3.3
CC
2
Cov
72%
new
2.1
refresh
2.0
BEGIN
1.0
CRAP 1.4
« Identifier/Plugin/Google.pm ↑ Summary Identifier/Plugin/Hotmail.pm »
1 #===============================================================================
2 # PODNAME: Net::IP::Identifier::Plugin::Facebook
3 # ABSTRACT: identify Facebook (AS32934) owned IP addresses
4 #
5 # AUTHOR: Reid Augustin (REID)
6 # EMAIL: reid@hellosix.com
7 # CREATED: Thu Oct 30 14:28:30 PDT 2014
8 #===============================================================================
9  
10 1 ▶use 5.008;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 package Net::IP::Identifier::Plugin::Facebook;
15  
16 1 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 with qw( Net::IP::Identifier_Role );
18  
19 1 our $VERSION = '0.111'; # VERSION
20  
21 1 ▶sub new {
Subroutine new: called CC=2 SCAR=7.2
Pod documented
22 1 my ($class, %opts) = @_;
23  
24 1 my $self = {};
25 1 ▶ bless $self, (ref $class || $class);
Condition33%1/3
ref $class || $class
l!l&&r!l&&!r
010
MC/DC0%0/2
ref $class || $class
ref $class $class
Truth table33%1/3
A || B
A= ref $classB= $class
ABresult
1X1
011
000
26  
27 # List of known Facebook (AS32934) IP blocks as of May 2015
28 1 $self->ips(
29 # 14 Network Blocks
30 '31.13.24.0/21',
31 '31.13.64.0/18',
32 '66.220.144.0/20',
33 '69.63.176.0/20',
34 '69.171.224.0/19',
35 '74.119.76.0/22',
36 '173.252.64.0/18',
37 '185.60.216.0/22',
38 '199.201.64.0/22',
39 '204.15.20.0/22',
40 '2401:db00::/32',
41 '2620:0:1c00::/40',
42 '2620:10d:c000::/40',
43 '2a03:2880::/32',
44 );
45 1 return $self;
46 }
47  
48 1 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod undocumented
49 1 return 'Facebook';
50 }
51  
52 0 ▶sub refresh {
Subroutine refresh: not called CC=1 SCAR=6.9
Pod undocumented
53 0 my ($self) = @_;
54  
55 0 my @fb = system `whois -h whois.radb.net '!gAS32934'`;
56 0 my @cidrs = split(/\s+/, join('', map { m|/| } @fb));
57  
58 0 delete $self->{ips};
59 0 $self->ips(@cidrs);
60 }
61  
62 1 1;
63  
64 __END__
« Identifier/Plugin/Google.pm ↑ Summary Identifier/Plugin/Hotmail.pm »