| 1 | package WebService::AbuseIPDB::BlacklistMember; | ||
| 2 | # | ||
| 3 | #=============================================================================== | ||
| 4 | # FILE: BlacklistMember.pm | ||
| 5 | # DESCRIPTION: Member of blacklist response | ||
| 6 | # AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk | ||
| 7 | # ORGANIZATION: Openstrike | ||
| 8 | # CREATED: 11/02/20 14:05:32 | ||
| 9 | #=============================================================================== | ||
| 10 | |||
| 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 | 1 | ▶ | use WebService::AbuseIPDB::Response; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | our $VERSION = $WebService::AbuseIPDB::Response::VERSION; | |
| 16 | |||
| 17 | sub new { | ||
| 18 | 6 | ▶ | my ($class, $data) = @_; |
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||
| 19 | 6 | bless $data, $class; | |
| 20 | 6 | return $data; | |
| 21 | } | ||
| 22 | |||
| 23 | 1 | ▶ | sub score { return shift->{abuseConfidenceScore} } |
|
Subroutine
score: called CC=1 SCAR=0.0
Pod
documented
| |||
| 24 | 1 | ▶ | sub ip { return shift->{ipAddress} } |
|
Subroutine
ip: called CC=1 SCAR=0.0
Pod
documented
| |||
| 25 | |||
| 26 | 1 | 1; | |
| 27 | |||
| 28 | __END__ | ||
| 29 | |||
| 30 | =pod | ||
| 31 | |||
| 32 | =encoding utf8 | ||
| 33 | |||
| 34 | =head1 NAME | ||
| 35 | |||
| 36 | WebService::AbuseIPDB::BlacklistMember - Class for one item of the | ||
| 37 | returned blacklist | ||
| 38 | |||
| 39 | =head1 SYNOPSIS | ||
| 40 | |||
| 41 | The C<blacklist> API endpoint is designed to return a list of bad | ||
| 42 | addresses. Each address is represeted by this class. | ||
| 43 | |||
| 44 | use WebService::AbuseIPDB; | ||
| 45 | |||
| 46 | my $ipdb = WebService::AbuseIPDB->new (key => 'abc123...'); | ||
| 47 | my $res = $ipdb->blacklist (limit => 5); | ||
| 48 | for my $member ($res->list) { | ||
| 49 | printf "%s has a score of %i\n", | ||
| 50 | $member->ip, $member->score; | ||
| 51 | |||
| 52 | =head1 METHODS | ||
| 53 | |||
| 54 | =head2 new | ||
| 55 | |||
| 56 | Takes one hashref and returns the object from it. Does no validation because | ||
| 57 | it is only called internally. | ||
| 58 | |||
| 59 | =head2 ip | ||
| 60 | |||
| 61 | A getter which returns the ip address as a scalar string. | ||
| 62 | |||
| 63 | =head2 score | ||
| 64 | |||
| 65 | A getter which returns the abuse confidence score as an integer between | ||
| 66 | 0 and 100 inclusive. | ||
| 67 | |||
| 68 | =head1 SEE ALSO | ||
| 69 | |||
| 70 | L<WebService::AbuseIPDB> for general use of the client, | ||
| 71 | L<WebService::AbuseIPDB::BlacklistResponse> for the calling code and | ||
| 72 | L<Version 2 of the AbuseIPDB API|https://docs.abuseipdb.com/> for API | ||
| 73 | details/restrictions. | ||
| 74 | |||
| 75 | =head1 LICENCE AND COPYRIGHT | ||
| 76 | |||
| 77 | Copyright © 2020 Pete Houston | ||
| 78 | |||
| 79 | This program is free software; you can redistribute it and/or modify | ||
| 80 | it under the terms of the GNU General Public License as published by | ||
| 81 | the Free Software Foundation; version 2 dated June, 1991 or at your option | ||
| 82 | any later version. | ||
| 83 | |||
| 84 | This program is distributed in the hope that it will be useful, | ||
| 85 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 86 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 87 | GNU General Public License for more details. | ||
| 88 | |||
| 89 | A copy of the GNU General Public License is available in the source tree; | ||
| 90 | if not, write to the Free Software Foundation, Inc., | ||
| 91 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | ||
| 92 | |||
| 93 | =cut | ||