| 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 | use 5.008; | ||
| 11 | use strict; | ||
| 12 | use warnings; | ||
| 13 | |||
| 14 | package Net::IP::Identifier::Plugin::Facebook; | ||
| 15 | |||
| 16 | use Role::Tiny::With; | ||
| 17 | with qw( Net::IP::Identifier_Role ); | ||
| 18 | |||
| 19 | our $VERSION = '0.106'; # VERSION | ||
| 20 | |||
| 21 | sub new { | ||
| 22 | my ($class, %opts) = @_; | ||
| 23 | |||
| 24 | my $self = {}; | ||
| 25 | bless $self, (ref $class || $class); | ||
| 26 | |||
| 27 | # List of known Facebook (AS32934) IP blocks as of May 2015 | ||
| 28 | $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 | return $self; | ||
| 46 | } | ||
| 47 | |||
| 48 | sub name { | ||
| 49 | return 'Facebook'; | ||
| 50 | } | ||
| 51 | |||
| 52 | sub refresh { | ||
| 53 | my ($self) = @_; | ||
| 54 | |||
| 55 | my @fb = system `whois -h whois.radb.net '!gAS32934'`; | ||
| 56 | my @cidrs = split(/\s+/, join('', map { m|/| } @fb)); | ||
| 57 | |||
| 58 | delete $self->{ips}; | ||
| 59 | $self->ips(@cidrs); | ||
| 60 | } | ||
| 61 | |||
| 62 | 1; | ||
| 63 | |||
| 64 | __END__ |