line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::AbuseIPDB::Category; |
2
|
|
|
|
|
|
|
# |
3
|
|
|
|
|
|
|
#=============================================================================== |
4
|
|
|
|
|
|
|
# |
5
|
|
|
|
|
|
|
# FILE: Category.pm |
6
|
|
|
|
|
|
|
# |
7
|
|
|
|
|
|
|
# DESCRIPTION: Category class |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# AUTHOR: Pete Houston (pete), cpan@openstrike.co.uk |
10
|
|
|
|
|
|
|
# ORGANIZATION: Openstrike |
11
|
|
|
|
|
|
|
# CREATED: 16/08/19 17:02:49 |
12
|
|
|
|
|
|
|
#=============================================================================== |
13
|
|
|
|
|
|
|
|
14
|
3
|
|
|
3
|
|
70781
|
use strict; |
|
3
|
|
|
|
|
22
|
|
|
3
|
|
|
|
|
88
|
|
15
|
3
|
|
|
3
|
|
17
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
80
|
|
16
|
|
|
|
|
|
|
|
17
|
3
|
|
|
3
|
|
15
|
use Carp; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
186
|
|
18
|
3
|
|
|
3
|
|
31
|
use Scalar::Util 'blessed'; |
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
139
|
|
19
|
3
|
|
|
3
|
|
504
|
use WebService::AbuseIPDB; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
1037
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = $WebService::AbuseIPDB::VERSION; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my %by_id = ( |
24
|
|
|
|
|
|
|
1 => 'DNS Compromise', |
25
|
|
|
|
|
|
|
2 => 'DNS Poisoning', |
26
|
|
|
|
|
|
|
3 => 'Fraud Orders', |
27
|
|
|
|
|
|
|
4 => 'DDoS Attack', |
28
|
|
|
|
|
|
|
5 => 'FTP Brute-Force', |
29
|
|
|
|
|
|
|
6 => 'Ping of Death', |
30
|
|
|
|
|
|
|
7 => 'Phishing', |
31
|
|
|
|
|
|
|
8 => 'Fraud VoIP', |
32
|
|
|
|
|
|
|
9 => 'Open Proxy', |
33
|
|
|
|
|
|
|
10 => 'Web Spam', |
34
|
|
|
|
|
|
|
11 => 'Email Spam', |
35
|
|
|
|
|
|
|
12 => 'Blog Spam', |
36
|
|
|
|
|
|
|
13 => 'VPN IP', |
37
|
|
|
|
|
|
|
14 => 'Port Scan', |
38
|
|
|
|
|
|
|
15 => 'Hacking', |
39
|
|
|
|
|
|
|
16 => 'SQL Injection', |
40
|
|
|
|
|
|
|
17 => 'Spoofing', |
41
|
|
|
|
|
|
|
18 => 'Brute-Force', |
42
|
|
|
|
|
|
|
19 => 'Bad Web Bot', |
43
|
|
|
|
|
|
|
20 => 'Exploited Host', |
44
|
|
|
|
|
|
|
21 => 'Web App Attack', |
45
|
|
|
|
|
|
|
22 => 'SSH', |
46
|
|
|
|
|
|
|
23 => 'IoT Targeted', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
my %by_name; |
50
|
|
|
|
|
|
|
$by_name{$by_id{$_}} = $_ for keys %by_id; |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub new { |
53
|
78
|
|
|
78
|
1
|
18891
|
my ($class, $cat) = @_; |
54
|
78
|
|
|
|
|
125
|
my $self; |
55
|
78
|
100
|
|
|
|
193
|
unless (defined $cat) { |
56
|
1
|
|
|
|
|
242
|
carp "'new' requires an argument"; |
57
|
1
|
|
|
|
|
8
|
return; |
58
|
|
|
|
|
|
|
} |
59
|
77
|
100
|
100
|
|
|
432
|
if ($by_id{$cat}) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
60
|
27
|
|
|
|
|
82
|
$self = { id => $cat, name => $by_id{$cat} }; |
61
|
|
|
|
|
|
|
} elsif ($by_name{$cat}) { |
62
|
23
|
|
|
|
|
78
|
$self = { id => $by_name{$cat}, name => $cat }; |
63
|
|
|
|
|
|
|
} elsif (blessed ($cat) && $cat->isa ($class)) { |
64
|
23
|
|
|
|
|
84
|
return $cat; |
65
|
|
|
|
|
|
|
} else { |
66
|
4
|
|
|
|
|
433
|
carp "'$cat' is not a valid category identifier"; |
67
|
4
|
|
|
|
|
88
|
return; |
68
|
|
|
|
|
|
|
} |
69
|
50
|
|
|
|
|
108
|
bless ($self, $class); |
70
|
50
|
|
|
|
|
129
|
return $self; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
# Accessors |
74
|
|
|
|
|
|
|
|
75
|
50
|
|
|
50
|
1
|
28853
|
sub id { return shift->{id} }; |
76
|
92
|
|
|
92
|
1
|
307
|
sub name { return shift->{name} }; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
1; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
__END__ |