line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package POE::Component::Client::Whois::IPBlks; |
2
|
|
|
|
|
|
|
$POE::Component::Client::Whois::IPBlks::VERSION = '1.38'; |
3
|
|
|
|
|
|
|
#ABSTRACT: Determine which whois server is responsible for a network address. |
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
842
|
use strict; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
157
|
|
6
|
5
|
|
|
5
|
|
26
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
133
|
|
7
|
5
|
|
|
5
|
|
3083
|
use Net::Netmask; |
|
5
|
|
|
|
|
1023159
|
|
|
5
|
|
|
|
|
5825
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
3
|
|
|
3
|
1
|
842
|
my $self = bless { }, shift; |
11
|
|
|
|
|
|
|
$self->{data} = { |
12
|
3
|
|
|
|
|
336
|
'1.0.0.0/8' => 'whois.apnic.net', |
13
|
|
|
|
|
|
|
'2.0.0.0/8' => 'whois.ripe.net', |
14
|
|
|
|
|
|
|
'3.0.0.0/8' => 'whois.arin.net', |
15
|
|
|
|
|
|
|
'4.0.0.0/8' => 'whois.arin.net', |
16
|
|
|
|
|
|
|
'5.0.0.0/8' => 'whois.ripe.net', |
17
|
|
|
|
|
|
|
'7.0.0.0/8' => 'whois.arin.net', |
18
|
|
|
|
|
|
|
'8.0.0.0/8' => 'whois.arin.net', |
19
|
|
|
|
|
|
|
'9.0.0.0/8' => 'whois.arin.net', |
20
|
|
|
|
|
|
|
'12.0.0.0/8' => 'whois.arin.net', |
21
|
|
|
|
|
|
|
'13.0.0.0/8' => 'whois.arin.net', |
22
|
|
|
|
|
|
|
'14.0.0.0/8' => 'whois.apnic.net', |
23
|
|
|
|
|
|
|
'15.0.0.0/8' => 'whois.arin.net', |
24
|
|
|
|
|
|
|
'16.0.0.0/8' => 'whois.arin.net', |
25
|
|
|
|
|
|
|
'17.0.0.0/8' => 'whois.arin.net', |
26
|
|
|
|
|
|
|
'18.0.0.0/8' => 'whois.arin.net', |
27
|
|
|
|
|
|
|
'19.0.0.0/8' => 'whois.arin.net', |
28
|
|
|
|
|
|
|
'20.0.0.0/8' => 'whois.arin.net', |
29
|
|
|
|
|
|
|
'23.0.0.0/8' => 'whois.arin.net', |
30
|
|
|
|
|
|
|
'24.0.0.0/8' => 'whois.arin.net', |
31
|
|
|
|
|
|
|
'25.0.0.0/8' => 'whois.ripe.net', |
32
|
|
|
|
|
|
|
'27.0.0.0/8' => 'whois.apnic.net', |
33
|
|
|
|
|
|
|
'31.0.0.0/8' => 'whois.ripe.net', |
34
|
|
|
|
|
|
|
'32.0.0.0/8' => 'whois.arin.net', |
35
|
|
|
|
|
|
|
'34.0.0.0/8' => 'whois.arin.net', |
36
|
|
|
|
|
|
|
'35.0.0.0/8' => 'whois.arin.net', |
37
|
|
|
|
|
|
|
'36.0.0.0/8' => 'whois.apnic.net', |
38
|
|
|
|
|
|
|
'37.0.0.0/8' => 'whois.ripe.net', |
39
|
|
|
|
|
|
|
'38.0.0.0/8' => 'whois.arin.net', |
40
|
|
|
|
|
|
|
'39.0.0.0/8' => 'whois.apnic.net', |
41
|
|
|
|
|
|
|
'40.0.0.0/8' => 'whois.arin.net', |
42
|
|
|
|
|
|
|
'41.0.0.0/8' => 'whois.afrinic.net', |
43
|
|
|
|
|
|
|
'42.0.0.0/8' => 'whois.apnic.net', |
44
|
|
|
|
|
|
|
'43.0.0.0/8' => 'whois.apnic.net', |
45
|
|
|
|
|
|
|
'44.0.0.0/8' => 'whois.arin.net', |
46
|
|
|
|
|
|
|
'45.0.0.0/8' => 'whois.arin.net', |
47
|
|
|
|
|
|
|
'46.0.0.0/8' => 'whois.ripe.net', |
48
|
|
|
|
|
|
|
'47.0.0.0/8' => 'whois.arin.net', |
49
|
|
|
|
|
|
|
'48.0.0.0/8' => 'whois.arin.net', |
50
|
|
|
|
|
|
|
'49.0.0.0/8' => 'whois.apnic.net', |
51
|
|
|
|
|
|
|
'50.0.0.0/8' => 'whois.arin.net', |
52
|
|
|
|
|
|
|
'51.0.0.0/8' => 'whois.ripe.net', |
53
|
|
|
|
|
|
|
'52.0.0.0/8' => 'whois.arin.net', |
54
|
|
|
|
|
|
|
'54.0.0.0/8' => 'whois.arin.net', |
55
|
|
|
|
|
|
|
'56.0.0.0/8' => 'whois.arin.net', |
56
|
|
|
|
|
|
|
'58.0.0.0/8' => 'whois.apnic.net', |
57
|
|
|
|
|
|
|
'59.0.0.0/8' => 'whois.apnic.net', |
58
|
|
|
|
|
|
|
'60.0.0.0/8' => 'whois.apnic.net', |
59
|
|
|
|
|
|
|
'61.0.0.0/8' => 'whois.apnic.net', |
60
|
|
|
|
|
|
|
'62.0.0.0/8' => 'whois.ripe.net', |
61
|
|
|
|
|
|
|
'63.0.0.0/8' => 'whois.arin.net', |
62
|
|
|
|
|
|
|
'64.0.0.0/8' => 'whois.arin.net', |
63
|
|
|
|
|
|
|
'65.0.0.0/8' => 'whois.arin.net', |
64
|
|
|
|
|
|
|
'66.0.0.0/8' => 'whois.arin.net', |
65
|
|
|
|
|
|
|
'67.0.0.0/8' => 'whois.arin.net', |
66
|
|
|
|
|
|
|
'68.0.0.0/8' => 'whois.arin.net', |
67
|
|
|
|
|
|
|
'69.0.0.0/8' => 'whois.arin.net', |
68
|
|
|
|
|
|
|
'70.0.0.0/8' => 'whois.arin.net', |
69
|
|
|
|
|
|
|
'71.0.0.0/8' => 'whois.arin.net', |
70
|
|
|
|
|
|
|
'72.0.0.0/8' => 'whois.arin.net', |
71
|
|
|
|
|
|
|
'73.0.0.0/8' => 'whois.arin.net', |
72
|
|
|
|
|
|
|
'74.0.0.0/8' => 'whois.arin.net', |
73
|
|
|
|
|
|
|
'75.0.0.0/8' => 'whois.arin.net', |
74
|
|
|
|
|
|
|
'76.0.0.0/8' => 'whois.arin.net', |
75
|
|
|
|
|
|
|
'77.0.0.0/8' => 'whois.ripe.net', |
76
|
|
|
|
|
|
|
'78.0.0.0/8' => 'whois.ripe.net', |
77
|
|
|
|
|
|
|
'79.0.0.0/8' => 'whois.ripe.net', |
78
|
|
|
|
|
|
|
'80.0.0.0/8' => 'whois.ripe.net', |
79
|
|
|
|
|
|
|
'81.0.0.0/8' => 'whois.ripe.net', |
80
|
|
|
|
|
|
|
'82.0.0.0/8' => 'whois.ripe.net', |
81
|
|
|
|
|
|
|
'83.0.0.0/8' => 'whois.ripe.net', |
82
|
|
|
|
|
|
|
'84.0.0.0/8' => 'whois.ripe.net', |
83
|
|
|
|
|
|
|
'85.0.0.0/8' => 'whois.ripe.net', |
84
|
|
|
|
|
|
|
'86.0.0.0/8' => 'whois.ripe.net', |
85
|
|
|
|
|
|
|
'87.0.0.0/8' => 'whois.ripe.net', |
86
|
|
|
|
|
|
|
'88.0.0.0/8' => 'whois.ripe.net', |
87
|
|
|
|
|
|
|
'89.0.0.0/8' => 'whois.ripe.net', |
88
|
|
|
|
|
|
|
'90.0.0.0/8' => 'whois.ripe.net', |
89
|
|
|
|
|
|
|
'91.0.0.0/8' => 'whois.ripe.net', |
90
|
|
|
|
|
|
|
'92.0.0.0/8' => 'whois.ripe.net', |
91
|
|
|
|
|
|
|
'93.0.0.0/8' => 'whois.ripe.net', |
92
|
|
|
|
|
|
|
'94.0.0.0/8' => 'whois.ripe.net', |
93
|
|
|
|
|
|
|
'95.0.0.0/8' => 'whois.ripe.net', |
94
|
|
|
|
|
|
|
'96.0.0.0/8' => 'whois.arin.net', |
95
|
|
|
|
|
|
|
'97.0.0.0/8' => 'whois.arin.net', |
96
|
|
|
|
|
|
|
'98.0.0.0/8' => 'whois.arin.net', |
97
|
|
|
|
|
|
|
'99.0.0.0/8' => 'whois.arin.net', |
98
|
|
|
|
|
|
|
'100.0.0.0/8' => 'whois.arin.net', |
99
|
|
|
|
|
|
|
'101.0.0.0/8' => 'whois.apnic.net', |
100
|
|
|
|
|
|
|
'102.0.0.0/8' => 'whois.afrinic.net', |
101
|
|
|
|
|
|
|
'103.0.0.0/8' => 'whois.apnic.net', |
102
|
|
|
|
|
|
|
'104.0.0.0/8' => 'whois.arin.net', |
103
|
|
|
|
|
|
|
'105.0.0.0/8' => 'whois.afrinic.net', |
104
|
|
|
|
|
|
|
'106.0.0.0/8' => 'whois.apnic.net', |
105
|
|
|
|
|
|
|
'107.0.0.0/8' => 'whois.arin.net', |
106
|
|
|
|
|
|
|
'108.0.0.0/8' => 'whois.arin.net', |
107
|
|
|
|
|
|
|
'109.0.0.0/8' => 'whois.ripe.net', |
108
|
|
|
|
|
|
|
'110.0.0.0/8' => 'whois.apnic.net', |
109
|
|
|
|
|
|
|
'111.0.0.0/8' => 'whois.apnic.net', |
110
|
|
|
|
|
|
|
'112.0.0.0/8' => 'whois.apnic.net', |
111
|
|
|
|
|
|
|
'113.0.0.0/8' => 'whois.apnic.net', |
112
|
|
|
|
|
|
|
'114.0.0.0/8' => 'whois.apnic.net', |
113
|
|
|
|
|
|
|
'115.0.0.0/8' => 'whois.apnic.net', |
114
|
|
|
|
|
|
|
'116.0.0.0/8' => 'whois.apnic.net', |
115
|
|
|
|
|
|
|
'117.0.0.0/8' => 'whois.apnic.net', |
116
|
|
|
|
|
|
|
'118.0.0.0/8' => 'whois.apnic.net', |
117
|
|
|
|
|
|
|
'119.0.0.0/8' => 'whois.apnic.net', |
118
|
|
|
|
|
|
|
'120.0.0.0/8' => 'whois.apnic.net', |
119
|
|
|
|
|
|
|
'121.0.0.0/8' => 'whois.apnic.net', |
120
|
|
|
|
|
|
|
'122.0.0.0/8' => 'whois.apnic.net', |
121
|
|
|
|
|
|
|
'123.0.0.0/8' => 'whois.apnic.net', |
122
|
|
|
|
|
|
|
'124.0.0.0/8' => 'whois.apnic.net', |
123
|
|
|
|
|
|
|
'125.0.0.0/8' => 'whois.apnic.net', |
124
|
|
|
|
|
|
|
'126.0.0.0/8' => 'whois.apnic.net', |
125
|
|
|
|
|
|
|
'128.0.0.0/8' => 'whois.arin.net', |
126
|
|
|
|
|
|
|
'129.0.0.0/8' => 'whois.arin.net', |
127
|
|
|
|
|
|
|
'130.0.0.0/8' => 'whois.arin.net', |
128
|
|
|
|
|
|
|
'131.0.0.0/8' => 'whois.arin.net', |
129
|
|
|
|
|
|
|
'132.0.0.0/8' => 'whois.arin.net', |
130
|
|
|
|
|
|
|
'133.0.0.0/8' => 'whois.apnic.net', |
131
|
|
|
|
|
|
|
'134.0.0.0/8' => 'whois.arin.net', |
132
|
|
|
|
|
|
|
'135.0.0.0/8' => 'whois.arin.net', |
133
|
|
|
|
|
|
|
'136.0.0.0/8' => 'whois.arin.net', |
134
|
|
|
|
|
|
|
'137.0.0.0/8' => 'whois.arin.net', |
135
|
|
|
|
|
|
|
'138.0.0.0/8' => 'whois.arin.net', |
136
|
|
|
|
|
|
|
'139.0.0.0/8' => 'whois.arin.net', |
137
|
|
|
|
|
|
|
'140.0.0.0/8' => 'whois.arin.net', |
138
|
|
|
|
|
|
|
'141.0.0.0/8' => 'whois.ripe.net', |
139
|
|
|
|
|
|
|
'142.0.0.0/8' => 'whois.arin.net', |
140
|
|
|
|
|
|
|
'143.0.0.0/8' => 'whois.arin.net', |
141
|
|
|
|
|
|
|
'144.0.0.0/8' => 'whois.arin.net', |
142
|
|
|
|
|
|
|
'145.0.0.0/8' => 'whois.ripe.net', |
143
|
|
|
|
|
|
|
'146.0.0.0/8' => 'whois.arin.net', |
144
|
|
|
|
|
|
|
'147.0.0.0/8' => 'whois.arin.net', |
145
|
|
|
|
|
|
|
'148.0.0.0/8' => 'whois.arin.net', |
146
|
|
|
|
|
|
|
'149.0.0.0/8' => 'whois.arin.net', |
147
|
|
|
|
|
|
|
'150.0.0.0/8' => 'whois.apnic.net', |
148
|
|
|
|
|
|
|
'151.0.0.0/8' => 'whois.ripe.net', |
149
|
|
|
|
|
|
|
'152.0.0.0/8' => 'whois.arin.net', |
150
|
|
|
|
|
|
|
'153.0.0.0/8' => 'whois.apnic.net', |
151
|
|
|
|
|
|
|
'154.0.0.0/8' => 'whois.afrinic.net', |
152
|
|
|
|
|
|
|
'155.0.0.0/8' => 'whois.arin.net', |
153
|
|
|
|
|
|
|
'156.0.0.0/8' => 'whois.arin.net', |
154
|
|
|
|
|
|
|
'157.0.0.0/8' => 'whois.arin.net', |
155
|
|
|
|
|
|
|
'158.0.0.0/8' => 'whois.arin.net', |
156
|
|
|
|
|
|
|
'159.0.0.0/8' => 'whois.arin.net', |
157
|
|
|
|
|
|
|
'160.0.0.0/8' => 'whois.arin.net', |
158
|
|
|
|
|
|
|
'161.0.0.0/8' => 'whois.arin.net', |
159
|
|
|
|
|
|
|
'162.0.0.0/8' => 'whois.arin.net', |
160
|
|
|
|
|
|
|
'163.0.0.0/8' => 'whois.apnic.net', |
161
|
|
|
|
|
|
|
'164.0.0.0/8' => 'whois.arin.net', |
162
|
|
|
|
|
|
|
'165.0.0.0/8' => 'whois.arin.net', |
163
|
|
|
|
|
|
|
'166.0.0.0/8' => 'whois.arin.net', |
164
|
|
|
|
|
|
|
'167.0.0.0/8' => 'whois.arin.net', |
165
|
|
|
|
|
|
|
'168.0.0.0/8' => 'whois.arin.net', |
166
|
|
|
|
|
|
|
'169.0.0.0/8' => 'whois.arin.net', |
167
|
|
|
|
|
|
|
'170.0.0.0/8' => 'whois.arin.net', |
168
|
|
|
|
|
|
|
'171.0.0.0/8' => 'whois.apnic.net', |
169
|
|
|
|
|
|
|
'172.0.0.0/8' => 'whois.arin.net', |
170
|
|
|
|
|
|
|
'173.0.0.0/8' => 'whois.arin.net', |
171
|
|
|
|
|
|
|
'174.0.0.0/8' => 'whois.arin.net', |
172
|
|
|
|
|
|
|
'175.0.0.0/8' => 'whois.apnic.net', |
173
|
|
|
|
|
|
|
'176.0.0.0/8' => 'whois.ripe.net', |
174
|
|
|
|
|
|
|
'177.0.0.0/8' => 'whois.lacnic.net', |
175
|
|
|
|
|
|
|
'178.0.0.0/8' => 'whois.ripe.net', |
176
|
|
|
|
|
|
|
'179.0.0.0/8' => 'whois.lacnic.net', |
177
|
|
|
|
|
|
|
'180.0.0.0/8' => 'whois.apnic.net', |
178
|
|
|
|
|
|
|
'181.0.0.0/8' => 'whois.lacnic.net', |
179
|
|
|
|
|
|
|
'182.0.0.0/8' => 'whois.apnic.net', |
180
|
|
|
|
|
|
|
'183.0.0.0/8' => 'whois.apnic.net', |
181
|
|
|
|
|
|
|
'184.0.0.0/8' => 'whois.arin.net', |
182
|
|
|
|
|
|
|
'185.0.0.0/8' => 'whois.ripe.net', |
183
|
|
|
|
|
|
|
'186.0.0.0/8' => 'whois.lacnic.net', |
184
|
|
|
|
|
|
|
'187.0.0.0/8' => 'whois.lacnic.net', |
185
|
|
|
|
|
|
|
'188.0.0.0/8' => 'whois.ripe.net', |
186
|
|
|
|
|
|
|
'189.0.0.0/8' => 'whois.lacnic.net', |
187
|
|
|
|
|
|
|
'190.0.0.0/8' => 'whois.lacnic.net', |
188
|
|
|
|
|
|
|
'191.0.0.0/8' => 'whois.lacnic.net', |
189
|
|
|
|
|
|
|
'192.0.0.0/8' => 'whois.arin.net', |
190
|
|
|
|
|
|
|
'193.0.0.0/8' => 'whois.ripe.net', |
191
|
|
|
|
|
|
|
'194.0.0.0/8' => 'whois.ripe.net', |
192
|
|
|
|
|
|
|
'195.0.0.0/8' => 'whois.ripe.net', |
193
|
|
|
|
|
|
|
'196.0.0.0/8' => 'whois.afrinic.net', |
194
|
|
|
|
|
|
|
'197.0.0.0/8' => 'whois.afrinic.net', |
195
|
|
|
|
|
|
|
'198.0.0.0/8' => 'whois.arin.net', |
196
|
|
|
|
|
|
|
'199.0.0.0/8' => 'whois.arin.net', |
197
|
|
|
|
|
|
|
'200.0.0.0/8' => 'whois.lacnic.net', |
198
|
|
|
|
|
|
|
'201.0.0.0/8' => 'whois.lacnic.net', |
199
|
|
|
|
|
|
|
'202.0.0.0/8' => 'whois.apnic.net', |
200
|
|
|
|
|
|
|
'203.0.0.0/8' => 'whois.apnic.net', |
201
|
|
|
|
|
|
|
'204.0.0.0/8' => 'whois.arin.net', |
202
|
|
|
|
|
|
|
'205.0.0.0/8' => 'whois.arin.net', |
203
|
|
|
|
|
|
|
'206.0.0.0/8' => 'whois.arin.net', |
204
|
|
|
|
|
|
|
'207.0.0.0/8' => 'whois.arin.net', |
205
|
|
|
|
|
|
|
'208.0.0.0/8' => 'whois.arin.net', |
206
|
|
|
|
|
|
|
'209.0.0.0/8' => 'whois.arin.net', |
207
|
|
|
|
|
|
|
'210.0.0.0/8' => 'whois.apnic.net', |
208
|
|
|
|
|
|
|
'211.0.0.0/8' => 'whois.apnic.net', |
209
|
|
|
|
|
|
|
'212.0.0.0/8' => 'whois.ripe.net', |
210
|
|
|
|
|
|
|
'213.0.0.0/8' => 'whois.ripe.net', |
211
|
|
|
|
|
|
|
'216.0.0.0/8' => 'whois.arin.net', |
212
|
|
|
|
|
|
|
'217.0.0.0/8' => 'whois.ripe.net', |
213
|
|
|
|
|
|
|
'218.0.0.0/8' => 'whois.apnic.net', |
214
|
|
|
|
|
|
|
'219.0.0.0/8' => 'whois.apnic.net', |
215
|
|
|
|
|
|
|
'220.0.0.0/8' => 'whois.apnic.net', |
216
|
|
|
|
|
|
|
'221.0.0.0/8' => 'whois.apnic.net', |
217
|
|
|
|
|
|
|
'222.0.0.0/8' => 'whois.apnic.net', |
218
|
|
|
|
|
|
|
'223.0.0.0/8' => 'whois.apnic.net', |
219
|
|
|
|
|
|
|
}; |
220
|
3
|
|
|
|
|
18
|
return $self; |
221
|
|
|
|
|
|
|
} |
222
|
|
|
|
|
|
|
|
223
|
|
|
|
|
|
|
sub get_server { |
224
|
3
|
|
|
3
|
1
|
1871
|
my $self = shift; |
225
|
3
|
|
50
|
|
|
11
|
my $ip = shift || return undef; |
226
|
|
|
|
|
|
|
|
227
|
3
|
|
|
|
|
7
|
foreach my $range ( keys %{ $self->{data} } ) { |
|
3
|
|
|
|
|
70
|
|
228
|
524
|
50
|
|
|
|
20236
|
if ( $range eq '0.0.0.0/2' ) { |
229
|
0
|
|
|
|
|
0
|
foreach my $cls_a ( 1 .. 126 ) { |
230
|
0
|
|
|
|
|
0
|
my $block2 = Net::Netmask->new( "$cls_a.0.0.0/8" ); |
231
|
0
|
0
|
|
|
|
0
|
if ( $block2->match( $ip ) ) { |
232
|
0
|
|
|
|
|
0
|
return ( $self->{data}->{ $range }, $range ); |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
} |
236
|
524
|
|
|
|
|
1117
|
my $block = Net::Netmask->new( $range ); |
237
|
524
|
100
|
|
|
|
25410
|
if ( $block->match( $ip ) ) { |
238
|
3
|
|
|
|
|
140
|
return ( $self->{data}->{ $range }, $range ); |
239
|
|
|
|
|
|
|
} |
240
|
|
|
|
|
|
|
} |
241
|
0
|
|
|
|
|
|
return undef; |
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
1; |
245
|
|
|
|
|
|
|
|
246
|
|
|
|
|
|
|
__END__ |