Use address2rir() to ask a particular RIR or IANA if not yet allocated
[App-Abuser.git] / t / stub / whois
blob17b8266da845eb02794934c11d52bcda510fe236
1 #!/usr/bin/perl
2 use strict;
3 use warnings;
4 use utf8;
6 my $examples = {
7 '-h' => {
8 'whois.arin.net' => {
9 '--' => {
10 '192.0.2.0' => <<'OUTPUT',
11 % [whois.apnic.net]
12 % Whois data copyright terms http://www.apnic.net/db/dbcopyright.html
14 % Information related to '192.0.2.0 - 192.0.2.255'
16 % Abuse contact for '192.0.2.0 - 192.0.2.255' is 'bad@example.com'
18 inetnum: 192.0.2.0 - 192.0.2.255
19 netname: X
20 descr: X
21 descr: X
22 country: X
23 org: ORG-1
24 admin-c: ROLE-1
25 tech-c: ROLE-1
26 abuse-c: ROLE-2
27 status: ASSIGNED PORTABLE
28 mnt-by: X
29 mnt-routes: X
30 mnt-irt: IRT-1
31 last-modified: 1970-01-01T00:00:00Z
32 source: APNIC
34 irt: IRT-1
35 address: X
36 address: X
37 address: X
38 e-mail: bad@example.com
39 abuse-mailbox: bad@example.com
40 admin-c: ROLE-1
41 tech-c: ROLE-1
42 auth: # Filtered
43 remarks: X
44 mnt-by: X
45 last-modified: 1970-01-01T00:00:00Z
46 source: APNIC
48 organisation: ORG-1
49 org-name: X
50 country: X
51 address: X
52 e-mail: bad@example.com
53 mnt-ref: X
54 mnt-by: X
55 last-modified: 1970-01-01T00:00:00Z
56 source: APNIC
58 role: X
59 address: X
60 address: X
61 address: X
62 country: X
63 phone: X
64 e-mail: bad@example.com
65 admin-c: ROLE-1
66 tech-c: ROLE-1
67 nic-hdl: ROLE-2
68 remarks: X
69 abuse-mailbox: good@example.com
70 mnt-by: X
71 last-modified: 1970-01-01T00:00:00Z
72 source: APNIC
74 role: X
75 address: X
76 address: X
77 address: X
78 country: X
79 phone: X
80 fax-no: X
81 e-mail: bad@example.com
82 nic-hdl: ROLE-1
83 tech-c: X
84 admin-c: X
85 mnt-by: X
86 last-modified: 1970-01-01T00:00:00Z
87 source: APNIC
89 % This query was served by the APNIC Whois Service version 1.88.15-SNAPSHOT (WHOIS-UK4)
92 OUTPUT
93 '192.0.2.1' => <<'OUTPUT',
94 % This is the RIPE Database query service.
95 % The objects are in RPSL format.
97 % The RIPE Database is subject to Terms and Conditions.
98 % See http://www.ripe.net/db/support/db-terms-conditions.pdf
100 % Note: this output has been filtered.
101 % To receive output for a database update, use the "-B" flag.
103 % Information related to '192.0.2.0 - 192.0.2.255'
105 % Abuse contact for '192.0.2.0 - 192.0.2.255' is 'bad@example.com'
107 inetnum: 192.0.2.0 - 192.0.2.255
108 netname: X
109 descr: X
110 descr: X
111 country: X
112 org: ORG-2
113 admin-c: PERSON-1
114 tech-c: ROLE-1
115 status: X
116 mnt-by: X
117 remarks: X
118 created: X
119 last-modified: X
120 source: RIPE
122 organisation: ORG-2
123 org-name: X
124 org-type: X
125 address: X
126 address: X
127 address: X
128 address: X
129 phone: X
130 phone: X
131 admin-c: X
132 admin-c: X
133 tech-c: ROLE-1
134 abuse-c: ROLE-1
135 mnt-ref: X
136 mnt-ref: X
137 mnt-by: X
138 mnt-by: X
139 created: X
140 last-modified: X
141 source: RIPE # Filtered
143 role: X
144 address: X
145 address: X
146 address: X
147 address: X
148 address: X
149 phone: X
150 phone: X
151 abuse-mailbox: good@example.com
152 org: ORG-2
153 admin-c: X
154 tech-c: X
155 tech-c: X
156 nic-hdl: ROLE-1
157 mnt-by: X
158 created: X
159 last-modified: X
160 source: RIPE # Filtered
162 person: X
163 address: X
164 address: X
165 address: X
166 address: X
167 address: X
168 phone: X
169 nic-hdl: PERSON-1
170 mnt-by: X
171 created: X
172 last-modified: X
173 source: RIPE # Filtered
175 % Information related to '192.0.2.0/24AS0001'
177 route: 192.0.2.0/24
178 descr: X
179 origin: AS0001
180 mnt-by: X
181 remarks: X
182 created: X
183 last-modified: X
184 source: RIPE
186 % This query was served by the RIPE Database Query Service version 1.98 (WAGYU)
189 OUTPUT
190 '192.0.2.2' => <<'OUTPUT',
191 % This is the RIPE Database query service.
192 % The objects are in RPSL format.
194 % The RIPE Database is subject to Terms and Conditions.
195 % See http://www.ripe.net/db/support/db-terms-conditions.pdf
197 % Note: this output has been filtered.
198 % To receive output for a database update, use the "-B" flag.
200 % Information related to '192.0.2.0 - 192.0.2.255'
202 % Abuse contact for '192.0.2.0 - 192.0.2.255' is 'good@example.com'
204 inetnum: 192.0.2.0 - 192.0.2.255
205 netname: X
206 descr: X
207 country: X
208 admin-c: PERSON-1
209 tech-c: PERSON-2
210 status: X
211 mnt-by: X
212 mnt-domains: X
213 created: X
214 last-modified: X
215 source: RIPE
217 person: X
218 address: X
219 phone: X
220 nic-hdl: PERSON-1
221 mnt-by: X
222 created: X
223 last-modified: X
224 source: RIPE
226 person: X
227 address: X
228 phone: X
229 nic-hdl: PERSON-2
230 mnt-by: X
231 created: X
232 last-modified: X
233 source: RIPE
235 % Information related to '192.0.2.0/24AS00001'
237 route: 192.0.2.0/24
238 descr: X
239 origin: AS00001
240 mnt-by: X
241 created: X
242 last-modified: X
243 source: RIPE
245 % This query was served by the RIPE Database Query Service version 1.98 (ANGUS)
248 OUTPUT
249 '192.0.2.3' => <<'OUTPUT',
250 query : 192.0.2.3
253 # KOREAN(UTF8)
255 조회하신 IPv4주소는 한국인터넷진흥원으로부터 아래의 관리대행자에게 할당되었으며, 할당 정보는 다음과 같습니다.
257 [ 네트워크 할당 정보 ]
258 IPv4주소 : 192.0.2.0 - 192.0.2.255 (/24)
259 기관명 : X
260 서비스명 : X
261 주소 : X
262 우편번호 : X
263 할당일자 : X
265 이름 : X
266 전화번호 : X
267 전자우편 : bad@example.com
269 조회하신 IPv4주소는 위의 관리대행자로부터 아래의 사용자에게 할당되었으며, 할당 정보는 다음과 같습니다.
270 --------------------------------------------------------------------------------
273 [ 네트워크 할당 정보 ]
274 IPv4주소 : 192.0.2.0 - 192.0.2.127 (/25)
275 기관명 : X
276 네트워크 구분 : X
277 주소 : X
278 우편번호 : X
279 할당내역 등록일 : X
281 이름 : X
282 전화번호 : X
283 전자우편 : good@example.com
286 # ENGLISH
288 KRNIC is not an ISP but a National Internet Registry similar to APNIC.
290 [ Network Information ]
291 IPv4 Address : 192.0.2.0 - 192.0.2.255 (/24)
292 Organization Name : X
293 Service Name : X
294 Address : X
295 Zip Code : X
296 Registration Date : X
298 Name : X
299 Phone : X
300 E-Mail : bad@example.com
302 --------------------------------------------------------------------------------
304 More specific assignment information is as follows.
306 [ Network Information ]
307 IPv4 Address : 192.0.2.0 - 192.0.2.127 (/25)
308 Organization Name : X
309 Network Type : X
310 Address : X
311 Zip Code : X
312 Registration Date : X
314 Name : X
315 Phone : X
316 E-Mail : good@example.com
319 - KISA/KRNIC WHOIS Service -
321 OUTPUT
322 '192.0.2.3' => <<'OUTPUT',
323 % This is the AfriNIC Whois server.
324 % The AFRINIC whois database is subject to the following terms of Use. See https://afrinic.net/whois/terms
326 % Note: this output has been filtered.
327 % To receive output for a database update, use the "-B" flag.
329 % [whois.apnic.net]
330 % Whois data copyright terms http://www.apnic.net/db/dbcopyright.html
332 % Information related to '192.0.2.0 - 192.0.2.255'
334 % Abuse contact for '192.0.2.0 - 192.0.2.255' is 'bad@example.com'
336 inetnum: 192.0.2.0 - 192.0.2.255
337 netname: X
338 descr: X
339 descr: X
340 admin-c: ROLE-2
341 tech-c: ROLE-2
342 remarks: Email address for spam or abuse complaints: bad@example.com
343 country: X
344 mnt-by: X
345 mnt-lower: X
346 mnt-irt: IRT-2
347 status: X
348 last-modified: X
349 source: APNIC
351 irt: IRT-2
352 address: X
353 address: X
354 e-mail: bad@example.com
355 abuse-mailbox: bad@example.com
356 admin-c: ROLE-2
357 tech-c: ROLE-2
358 auth: # Filtered
359 remarks: X
360 mnt-by: X
361 last-modified: X
362 source: APNIC
364 role: X
365 address: X
366 address: X
367 address: X
368 country: X
369 phone: X
370 fax-no: X
371 e-mail: bad@example.com
372 admin-c: X
373 tech-c: X
374 nic-hdl: ROLE-2
375 mnt-by: X
376 last-modified: X
377 source: APNIC
379 % Information related to '192.0.2.0 - 192.0.2.255'
381 inetnum: 192.0.2.0 - 192.0.2.255
382 netname: X
383 descr: X
384 remarks: Email address for spam or abuse complaints : bad@example.com
385 country: X
386 admin-c: ROLE-3
387 tech-c: RILE-3
388 remarks: This information has been partially mirrored by APNIC from
389 remarks: JPNIC. To obtain more specific information, please use the
390 remarks: JPNIC WHOIS Gateway at
391 remarks: http://www.nic.ad.jp/en/db/whois/en-gateway.html or
392 remarks: whois.nic.ad.jp for WHOIS client. (The WHOIS client
393 remarks: defaults to Japanese output, use the /e switch for English
394 remarks: output)
395 last-modified: X
396 source: JPNIC
398 % This query was served by the APNIC Whois Service version 1.88.15-SNAPSHOT (WHOIS-JP3)
404 OUTPUT
405 '192.0.2.4' => <<'OUTPUT',
406 % [whois.apnic.net]
407 % Whois data copyright terms http://www.apnic.net/db/dbcopyright.html
409 % Information related to '192.0.2.0 - 192.0.2.255'
411 % Abuse contact for '192.0.2.0 - 192.0.2.255' is 'bad@example.com'
413 inetnum: 192.0.2.0 - 192.0.2.255
414 netname: X
415 descr: X
416 country: X
417 tech-c: person-2
418 admin-c: person-3
419 status: X
420 mnt-by: X
421 last-modified: X
422 source: APNIC
424 person: X
425 nic-hdl: PERSON-3
426 e-mail: bad@example.com
427 address: X
428 address: X
429 phone: X
430 fax-no: X
431 country: X
432 mnt-by: X
433 last-modified: X
434 source: APNIC
436 person: X
437 nic-hdl: PERSON-2
438 e-mail: good@example.com
439 address: X
440 address: X
441 phone: X
442 fax-no: X
443 country: X
444 mnt-by: X
445 last-modified: X
446 source: APNIC
448 % Information related to '192.0.2.0/24AS0002'
450 route: 192.0.2.0/24
451 descr: X
452 origin: AS0002
453 mnt-by: X
454 last-modified: X
455 source: APNIC
457 % This query was served by the APNIC Whois Service version 1.88.15-SNAPSHOT (WHOIS-JP3)
460 OUTPUT
461 '192.0.2.5' => <<'OUTPUT',
462 % This is the RIPE Database query service.
463 % The objects are in RPSL format.
465 % The RIPE Database is subject to Terms and Conditions.
466 % See http://www.ripe.net/db/support/db-terms-conditions.pdf
468 % Note: this output has been filtered.
469 % To receive output for a database update, use the "-B" flag.
471 % Information related to '192.0.2.0 - 192.0.2.255'
473 % Abuse contact for '192.0.2.0 - 192.0.2.255' is 'bad@example.com'
475 inetnum: 192.0.2.0 - 192.0.2.255
476 abuse-c: ROLE-4
477 netname: X
478 country: X
479 admin-c: PERSON-4
480 tech-c: PERSON-4
481 status: X
482 mnt-by: X
483 created: X
484 last-modified: X
485 source: RIPE
487 person: X
488 address: X
489 address: X
490 address: X
491 phone: X
492 nic-hdl: PERSON-4
493 mnt-by: X
494 created: X
495 last-modified: X
496 source: RIPE # Filtered
497 org: X
499 % This query was served by the RIPE Database Query Service version 1.98 (BLAARKOP)
502 OUTPUT
503 '192.0.2.6' => <<'OUTPUT',
505 % Copyright (c) Nic.br
506 % The use of the data below is only permitted as described in
507 % full by the terms of use at https://registro.br/termo/en.html ,
508 % being prohibited its distribution, commercialization or
509 % reproduction, in particular, to use it for advertising or
510 % any similar purpose.
511 % 1970-01-01T00:00:00+00:00 - IP: 2001:db8::
513 inetnum: 192.0.2.0/24
514 aut-num: X
515 abuse-c: CONTACT-1
516 owner: X
517 ownerid: X
518 responsible: X
519 country: X
520 owner-c: CONTACT-1
521 tech-c: CONTACT-1
522 inetrev: X
523 nserver: X
524 nsstat: X
525 nslastaa: X
526 nserver: X
527 nsstat: X
528 nslastaa: X
529 created: X
530 changed: X
532 nic-hdl-br: CONTACT-1
533 person: X
534 e-mail: good@example.com
535 country: X
536 created: X
537 changed: X
539 % Security and mail abuse issues should also be addressed to
540 % cert.br, http://www.cert.br/ , respectivelly to bad@example.com
541 % and bad@example.com
543 % whois.registro.br accepts only direct match queries. Types
544 % of queries are: domain (.br), registrant (tax ID), ticket,
545 % provider, CIDR block, IP and ASN.
546 OUTPUT
547 '192.0.2.7' => <<'OUTPUT',
548 % [whois.apnic.net]
549 % Whois data copyright terms http://www.apnic.net/db/dbcopyright.html
551 % Information related to '192.0.2.0 - 192.0.2.255'
553 % Abuse contact for '192.0.2.0 - 192.0.2.255' is 'bad@example.com'
555 inetnum: 192.0.2.0 - 192.0.2.255
556 netname: X
557 descr: X
558 descr: X
559 country: X
560 admin-c: ROLE-5
561 tech-c: ROLE-5
562 status: X
563 remarks: X
564 mnt-by: X
565 mnt-irt: IRT-JPNIC-JP
566 mnt-lower: X
567 last-modified: X
568 source: APNIC
570 irt: IRT-JPNIC-JP
571 address: X
572 address: X
573 e-mail: bad@example.com
574 abuse-mailbox: bad@example.com
575 admin-c: ROLE-5
576 tech-c: ROLE-5
577 auth: X
578 remarks: X
579 mnt-by: X
580 last-modified: X
581 source: APNIC
583 role: X
584 address: X
585 address: X
586 address: X
587 country: X
588 phone: X
589 fax-no: X
590 e-mail: bad@example.com
591 admin-c: X
592 tech-c: X
593 nic-hdl: ROLE-5
594 mnt-by: X
595 last-modified: X
596 source: APNIC
598 % Information related to '192.0.2.0 - 192.0.2.255'
600 inetnum: 192.0.2.0 - 192.0.2.255
601 netname: X
602 descr: X
603 country: X
604 admin-c: ROLE-6
605 tech-c: ROLE-6
606 remarks: This information has been partially mirrored by APNIC from
607 remarks: JPNIC. To obtain more specific information, please use the
608 remarks: JPNIC WHOIS Gateway at
609 remarks: http://www.nic.ad.jp/en/db/whois/en-gateway.html or
610 remarks: whois.nic.ad.jp for WHOIS client. (The WHOIS client
611 remarks: defaults to Japanese output, use the /e switch for English
612 remarks: output)
613 last-modified: X
614 source: JPNIC
616 % This query was served by the APNIC Whois Service version 1.88.15-SNAPSHOT (WHOIS-UK3)
619 OUTPUT
622 'whois.iana.org' => {
623 '--' => {
624 '0.0.0.0' => <<'OUTPUT',
625 % IANA WHOIS server
626 % for more information on IANA, visit http://www.iana.org
627 % This query returned 1 object
629 inetnum: 0.0.0.0 - 0.255.255.255
630 organisation: IANA - Local Identification
631 status: RESERVED
633 remarks: 0.0.0.0/8 reserved for self-identification [RFC1122],
634 remarks: section 3.2.1.3. Reserved by protocol. For authoritative
635 remarks: registration, seeiana-ipv4-special-registry.
637 changed: 1981-09
638 source: IANA
640 OUTPUT
643 'whois.apnic.net' => {
644 '--' => {
645 '192.0.2.3' => <<'OUTPUT',
646 % [whois.apnic.net]
647 % Whois data copyright terms http://www.apnic.net/db/dbcopyright.html
649 % Information related to '192.0.2.0 - 192.0.2.255'
651 % Abuse contact for '192.0.2.0 - 192.0.2.255' is 'bad@example.com'
653 inetnum: 192.0.2.0 - 192.0.2.255
654 netname: X
655 descr: X
656 descr: X
657 admin-c: ROLE-2
658 tech-c: ROLE-2
659 remarks: Email address for spam or abuse complaints: bad@example.com
660 country: X
661 mnt-by: X
662 mnt-lower: X
663 mnt-irt: IRT-2
664 status: X
665 last-modified: X
666 source: APNIC
668 irt: IRT-2
669 address: X
670 address: X
671 e-mail: bad@example.com
672 abuse-mailbox: bad@example.com
673 admin-c: ROLE-2
674 tech-c: ROLE-2
675 auth: # Filtered
676 remarks: X
677 mnt-by: X
678 last-modified: X
679 source: APNIC
681 role: X
682 address: X
683 address: X
684 address: X
685 country: X
686 phone: X
687 fax-no: X
688 e-mail: bad@example.com
689 admin-c: X
690 tech-c: X
691 nic-hdl: ROLE-2
692 mnt-by: X
693 last-modified: X
694 source: APNIC
696 % Information related to '192.0.2.0 - 192.0.2.255'
698 inetnum: 192.0.2.0 - 192.0.2.255
699 netname: X
700 descr: X
701 remarks: Email address for spam or abuse complaints : bad@example.com
702 country: X
703 admin-c: ROLE-3
704 tech-c: ROLE-3
705 remarks: This information has been partially mirrored by APNIC from
706 remarks: JPNIC. To obtain more specific information, please use the
707 remarks: JPNIC WHOIS Gateway at
708 remarks: http://www.nic.ad.jp/en/db/whois/en-gateway.html or
709 remarks: whois.nic.ad.jp for WHOIS client. (The WHOIS client
710 remarks: defaults to Japanese output, use the /e switch for English
711 remarks: output)
712 last-modified: X
713 source: JPNIC
715 % This query was served by the APNIC Whois Service version 1.88.15-SNAPSHOT (WHOIS-JP3)
718 OUTPUT
721 'whois.nic.ad.jp' => {
722 '--' => {
723 '192.0.2.3' => <<'OUTPUT',
724 [ JPNIC database provides information regarding IP address and ASN. Its use ]
725 [ is restricted to network administration purposes. For further information, ]
726 [ use 'whois -h whois.nic.ad.jp help'. To only display English output, ]
727 [ add '/e' at the end of command, e.g. 'whois -h whois.nic.ad.jp xxx/e'. ]
729 Network Information:
730 a. [Network Number] 192.0.2.0/25
731 b. [Network Name] X
732 g. [Organization] X
733 m. [Administrative Contact] ROLE-3
734 n. [Technical Contact] ROLE-3
735 p. [Nameserver] X
736 p. [Nameserver] X
737 [Assigned Date] X
738 [Return Date]
739 [Last Update] X
741 Less Specific Info.
742 ----------
744 [Allocation] 192.0.2.0/24
746 More Specific Info.
747 ----------
748 No match!!
749 OUTPUT
750 'ROLE-3' => <<'OUTPUT',
751 [ JPNIC database provides information regarding IP address and ASN. Its use ]
752 [ is restricted to network administration purposes. For further information, ]
753 [ use 'whois -h whois.nic.ad.jp help'. To only display English output, ]
754 [ add '/e' at the end of command, e.g. 'whois -h whois.nic.ad.jp xxx/e'. ]
756 Group Contact Information:
757 [Group Handle] ROLE-3
758 [Group Name] X
759 [E-Mail] good@example.com
760 [Organization] X
761 [Division]
762 [TEL] X
763 [FAX]
764 [Last Update] X
765 bad@example.com
766 OUTPUT
767 '192.0.2.7' => <<'OUTPUT',
768 [ JPNIC database provides information regarding IP address and ASN. Its use ]
769 [ is restricted to network administration purposes. For further information, ]
770 [ use 'whois -h whois.nic.ad.jp help'. To only display English output, ]
771 [ add '/e' at the end of command, e.g. 'whois -h whois.nic.ad.jp xxx/e'. ]
773 Network Information:
774 a. [Network Number] 192.0.2.0/25
775 b. [Network Name] X
776 g. [Organization] X
777 m. [Administrative Contact] ROLE-6
778 n. [Technical Contact] ROLE-6
779 p. [Nameserver] X
780 [Assigned Date] X
781 [Return Date]
782 [Last Update] X
784 Less Specific Info.
785 ----------
787 [Allocation] 192.0.2.0/24
789 More Specific Info.
790 ----------
791 No match!!
792 OUTPUT
793 'ROLE-6' => <<'OUTPUT'
794 [ JPNIC database provides information regarding IP address and ASN. Its use ]
795 [ is restricted to network administration purposes. For further information, ]
796 [ use 'whois -h whois.nic.ad.jp help'. To only display English output, ]
797 [ add '/e' at the end of command, e.g. 'whois -h whois.nic.ad.jp xxx/e'. ]
799 Contact Information:
800 a. [JPNIC Handle] ROLE-6
801 c. [Last, First] X
802 d. [E-Mail] good@example.com
803 g. [Organization] X
804 l. [Division] X
805 n. [Title] X
806 o. [TEL] X
807 p. [FAX] X
808 y. [Reply Mail]
809 [Last Update] X
810 bad@example.com
811 OUTPUT
814 'whois.ripe.net' => {
815 '--' => {
816 'ROLE-4' => <<'OUTPUT',
817 % This is the RIPE Database query service.
818 % The objects are in RPSL format.
820 % The RIPE Database is subject to Terms and Conditions.
821 % See http://www.ripe.net/db/support/db-terms-conditions.pdf
823 % Note: this output has been filtered.
824 % To receive output for a database update, use the "-B" flag.
826 % Information related to 'ROLE-4'
828 role: X
829 remarks: X
830 address: X
831 address: X
832 address: X
833 address: X
834 abuse-mailbox: good@example.com
835 nic-hdl: ROLE-4
836 mnt-by: X
837 created: X
838 last-modified: X
839 source: RIPE # Filtered
841 % This query was served by the RIPE Database Query Service version 1.98 (WAGYU)
844 OUTPUT
851 my $key = $examples;
852 for my $arg (@ARGV) {
853 if (ref $key eq '') {
854 die "Too many arguments: " . join(', ', @ARGV) . "\n";
856 if (!exists $key->{$arg}) {
857 die "Unknown argument '$arg' in: " . join(', ', @ARGV) . "\n";
859 $key = $key->{$arg};
862 if (ref $key ne '') {
863 die "Too few arguments: " . join(', ', @ARGV) . "\n";
866 print $key;
867 exit 0;