whois 0.9.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +161 -21
- data/LICENSE.rdoc +1 -1
- data/Manifest +184 -13
- data/README.rdoc +24 -31
- data/Rakefile +7 -7
- data/bin/ruby-whois +9 -3
- data/data/ip_del_list +2 -0
- data/data/make_servers_charset.pl +21 -0
- data/data/make_tld_serv.pl +8 -7
- data/data/servers_charset_list +37 -0
- data/data/tld_serv_list +32 -30
- data/lib/whois.rb +0 -1
- data/lib/whois/answer.rb +24 -13
- data/lib/whois/answer/parser.rb +27 -16
- data/lib/whois/answer/parser/NOTES.txt +3 -0
- data/lib/whois/answer/parser/base.rb +140 -101
- data/lib/whois/answer/parser/jobswhois.verisign-grs.com.rb +99 -0
- data/lib/whois/answer/parser/whois.adamsnames.tc.rb +64 -0
- data/lib/whois/answer/parser/whois.aeda.net.ae.rb +65 -0
- data/lib/whois/answer/parser/whois.aero.rb +6 -6
- data/lib/whois/answer/parser/whois.afilias-grs.info.rb +6 -6
- data/lib/whois/answer/parser/whois.afilias.info.rb +12 -12
- data/lib/whois/answer/parser/whois.biz.rb +72 -0
- data/lib/whois/answer/parser/whois.cat.rb +74 -0
- data/lib/whois/answer/parser/whois.cira.ca.rb +77 -0
- data/lib/whois/answer/parser/whois.crsnic.net.rb +16 -13
- data/lib/whois/answer/parser/whois.denic.de.rb +14 -18
- data/lib/whois/answer/parser/whois.dk-hostmaster.dk.rb +75 -0
- data/lib/whois/answer/parser/whois.domain-registry.nl.rb +72 -0
- data/lib/whois/answer/parser/whois.domainregistry.ie.rb +7 -13
- data/lib/whois/answer/parser/whois.dotmobiregistry.net.rb +72 -0
- data/lib/whois/answer/parser/whois.educause.edu.rb +8 -8
- data/lib/whois/answer/parser/whois.eu.org.rb +8 -17
- data/lib/whois/answer/parser/whois.eu.rb +64 -0
- data/lib/whois/answer/parser/whois.iana.org.rb +6 -9
- data/lib/whois/answer/parser/whois.isnic.is.rb +72 -0
- data/lib/whois/answer/parser/whois.meregistry.net.rb +72 -0
- data/lib/whois/answer/parser/whois.museum.rb +76 -0
- data/lib/whois/answer/parser/whois.nic-se.se.rb +77 -0
- data/lib/whois/answer/parser/whois.nic.ac.rb +92 -0
- data/lib/whois/answer/parser/whois.nic.asia.rb +12 -12
- data/lib/whois/answer/parser/whois.nic.cc.rb +99 -0
- data/lib/whois/answer/parser/whois.nic.cd.rb +68 -0
- data/lib/whois/answer/parser/whois.nic.ch.rb +64 -0
- data/lib/whois/answer/parser/whois.nic.coop.rb +74 -0
- data/lib/whois/answer/parser/whois.nic.fr.rb +8 -11
- data/lib/whois/answer/parser/whois.nic.gl.rb +77 -0
- data/lib/whois/answer/parser/whois.nic.gov.rb +8 -17
- data/lib/whois/answer/parser/whois.nic.hu.rb +21 -19
- data/lib/whois/answer/parser/whois.nic.im.rb +68 -0
- data/lib/whois/answer/parser/whois.nic.io.rb +64 -0
- data/lib/whois/answer/parser/whois.nic.it.rb +16 -16
- data/lib/whois/answer/parser/whois.nic.ly.rb +76 -0
- data/lib/whois/answer/parser/whois.nic.mu.rb +77 -0
- data/lib/whois/answer/parser/whois.nic.name.rb +8 -17
- data/lib/whois/answer/parser/whois.nic.nu.rb +84 -0
- data/lib/whois/answer/parser/whois.nic.tel.rb +76 -0
- data/lib/whois/answer/parser/whois.nic.tl.rb +76 -0
- data/lib/whois/answer/parser/whois.nic.travel.rb +72 -0
- data/lib/whois/answer/parser/whois.nic.tv.rb +16 -13
- data/lib/whois/answer/parser/whois.nic.uk.rb +82 -0
- data/lib/whois/answer/parser/whois.nic.us.rb +72 -0
- data/lib/whois/answer/parser/whois.norid.no.rb +72 -0
- data/lib/whois/answer/parser/whois.publicinterestregistry.net.rb +16 -16
- data/lib/whois/answer/parser/whois.register.bg.rb +74 -0
- data/lib/whois/answer/parser/whois.registro.br.rb +64 -0
- data/lib/whois/answer/parser/whois.registrypro.pro.rb +77 -0
- data/lib/whois/answer/parser/whois.ripe.net.rb +64 -0
- data/lib/whois/answer/parser/whois.ripn.net.rb +72 -0
- data/lib/whois/answer/parser/whois.rotld.ro.rb +64 -0
- data/lib/whois/answer/parser/whois.samoanic.ws.rb +76 -0
- data/lib/whois/answer/parser/whois.za.net.rb +8 -11
- data/lib/whois/answer/parser/whois.za.org.rb +7 -10
- data/lib/whois/answer/super_struct.rb +1 -1
- data/lib/whois/client.rb +4 -4
- data/lib/whois/definitions/NOTES.txt +12 -0
- data/lib/whois/definitions/ipv4.rb +2 -0
- data/lib/whois/definitions/tlds.rb +27 -27
- data/lib/whois/errors.rb +11 -1
- data/lib/whois/server.rb +1 -0
- data/lib/whois/server/adapters/web.rb +1 -2
- data/lib/whois/version.rb +4 -4
- data/test/answer/parser/base_test.rb +16 -29
- data/test/answer/parser/jobswhois.verisign-grs.com_test.rb +122 -0
- data/test/answer/parser/whois.adamsnames.tc_test.rb +122 -0
- data/test/answer/parser/whois.aeda.net.ae_test.rb +63 -0
- data/test/answer/parser/whois.afilias-grs.info_test.rb +274 -13
- data/test/answer/parser/whois.afilias.info_test.rb +1 -1
- data/test/answer/parser/whois.biz_test.rb +51 -0
- data/test/answer/parser/whois.cat_test.rb +51 -0
- data/test/answer/parser/whois.cira.ca_test.rb +51 -0
- data/test/answer/parser/whois.crsnic.net_test.rb +8 -3
- data/test/answer/parser/whois.denic.de_test.rb +11 -18
- data/test/answer/parser/whois.dk-hostmaster.dk_test.rb +57 -0
- data/test/answer/parser/whois.domain-registry.nl_test.rb +49 -0
- data/test/answer/parser/whois.domainregistry.ie_test.rb +7 -11
- data/test/answer/parser/whois.dotmobiregistry.net_test.rb +51 -0
- data/test/answer/parser/whois.educause.edu_test.rb +3 -3
- data/test/answer/parser/whois.eu.org_test.rb +6 -12
- data/test/answer/parser/whois.eu_test.rb +45 -0
- data/test/answer/parser/whois.iana.org_test.rb +2 -4
- data/test/answer/parser/whois.isnic.is_test.rb +49 -0
- data/test/answer/parser/whois.meregistry.net_test.rb +51 -0
- data/test/answer/parser/whois.museum_test.rb +51 -0
- data/test/answer/parser/whois.nic-se.se_test.rb +58 -0
- data/test/answer/parser/whois.nic.ac_test.rb +126 -0
- data/test/answer/parser/whois.nic.asia_test.rb +1 -1
- data/test/answer/parser/whois.nic.cc_test.rb +122 -0
- data/test/answer/parser/whois.nic.cd_test.rb +49 -0
- data/test/answer/parser/whois.nic.ch_test.rb +45 -0
- data/test/answer/parser/whois.nic.coop_test.rb +51 -0
- data/test/answer/parser/whois.nic.fr_test.rb +178 -13
- data/test/answer/parser/whois.nic.gl_test.rb +51 -0
- data/test/answer/parser/whois.nic.gov_test.rb +6 -12
- data/test/answer/parser/whois.nic.hu_test.rb +9 -7
- data/test/answer/parser/whois.nic.im_test.rb +47 -0
- data/test/answer/parser/whois.nic.io_test.rb +45 -0
- data/test/answer/parser/whois.nic.it_test.rb +6 -3
- data/test/answer/parser/whois.nic.ly_test.rb +51 -0
- data/test/answer/parser/whois.nic.mu_test.rb +97 -0
- data/test/answer/parser/whois.nic.name_test.rb +6 -12
- data/test/answer/parser/whois.nic.nu_test.rb +59 -0
- data/test/answer/parser/whois.nic.tel_test.rb +51 -0
- data/test/answer/parser/whois.nic.tl_test.rb +51 -0
- data/test/answer/parser/whois.nic.travel_test.rb +51 -0
- data/test/answer/parser/whois.nic.tv_test.rb +9 -5
- data/test/answer/parser/whois.nic.uk_test.rb +63 -0
- data/test/answer/parser/whois.nic.us_test.rb +51 -0
- data/test/answer/parser/whois.norid.no_test.rb +49 -0
- data/test/answer/parser/whois.register.bg_test.rb +49 -0
- data/test/answer/parser/whois.registro.br_test.rb +45 -0
- data/test/answer/parser/whois.registrypro.pro_test.rb +84 -0
- data/test/answer/parser/whois.ripe.net_test.rb +203 -0
- data/test/answer/parser/whois.ripn.net_test.rb +94 -0
- data/test/answer/parser/whois.rotld.ro_test.rb +45 -0
- data/test/answer/parser/whois.samoanic.ws_test.rb +51 -0
- data/test/answer/parser/whois.za.net_test.rb +2 -4
- data/test/answer/parser/whois.za.org_test.rb +2 -4
- data/test/answer/parser_test.rb +71 -48
- data/test/answer_test.rb +57 -21
- data/test/client_test.rb +5 -2
- data/test/errors_test.rb +23 -0
- data/test/list_tld +74 -76
- data/test/testcases/responses/jobswhois.verisign-grs.com/available.txt +44 -0
- data/test/testcases/responses/jobswhois.verisign-grs.com/registered.txt +54 -0
- data/test/testcases/responses/super_struct_test.rb +3 -4
- data/test/testcases/responses/whois.adamsnames.tc/gd/available.txt +2 -0
- data/test/testcases/responses/whois.adamsnames.tc/gd/registered.txt +26 -0
- data/test/testcases/responses/whois.adamsnames.tc/tc/available.txt +2 -0
- data/test/testcases/responses/whois.adamsnames.tc/tc/registered.txt +28 -0
- data/test/testcases/responses/whois.adamsnames.tc/vg/available.txt +2 -0
- data/test/testcases/responses/whois.adamsnames.tc/vg/registered.txt +28 -0
- data/test/testcases/responses/whois.aeda.net.ae/available.txt +1 -0
- data/test/testcases/responses/whois.aeda.net.ae/registered.txt +15 -0
- data/test/testcases/responses/whois.biz/available.txt +25 -0
- data/test/testcases/responses/whois.biz/registered.txt +89 -0
- data/test/testcases/responses/whois.cat/available.txt +18 -0
- data/test/testcases/responses/whois.cat/registered.txt +83 -0
- data/test/testcases/responses/whois.cira.ca/available.txt +9 -0
- data/test/testcases/responses/whois.cira.ca/registered.txt +47 -0
- data/test/testcases/responses/whois.dk-hostmaster.dk/available.txt +15 -0
- data/test/testcases/responses/whois.dk-hostmaster.dk/registered.txt +47 -0
- data/test/testcases/responses/whois.domain-registry.nl/available.txt +21 -0
- data/test/testcases/responses/whois.domain-registry.nl/registered.txt +67 -0
- data/test/testcases/responses/whois.dotmobiregistry.net/available.txt +25 -0
- data/test/testcases/responses/whois.dotmobiregistry.net/registered.txt +81 -0
- data/test/testcases/responses/whois.eu/available.txt +47 -0
- data/test/testcases/responses/whois.eu/registered.txt +63 -0
- data/test/testcases/responses/whois.isnic.is/available.txt +7 -0
- data/test/testcases/responses/whois.isnic.is/registered.txt +57 -0
- data/test/testcases/responses/{whois.afilias-grs.info → whois.meregistry.net}/available.txt +0 -0
- data/test/testcases/responses/whois.meregistry.net/registered.txt +94 -0
- data/test/testcases/responses/whois.museum/available.txt +18 -0
- data/test/testcases/responses/whois.museum/registered.txt +92 -0
- data/test/testcases/responses/whois.nic-se.se/available.txt +21 -0
- data/test/testcases/responses/whois.nic-se.se/registered.txt +37 -0
- data/test/testcases/responses/whois.nic.ac/available.txt +2 -0
- data/test/testcases/responses/whois.nic.ac/registered.txt +2 -0
- data/test/testcases/responses/whois.nic.cc/available.txt +44 -0
- data/test/testcases/responses/whois.nic.cc/registered.txt +58 -0
- data/test/testcases/responses/whois.nic.cd/available.txt +1 -0
- data/test/testcases/responses/whois.nic.cd/registered.txt +85 -0
- data/test/testcases/responses/whois.nic.ch/available.txt +2 -0
- data/test/testcases/responses/whois.nic.ch/registered.txt +28 -0
- data/test/testcases/responses/whois.nic.coop/available.txt +33 -0
- data/test/testcases/responses/whois.nic.coop/registered.txt +123 -0
- data/test/testcases/responses/whois.nic.fr/{available.txt → fr/available.txt} +0 -0
- data/test/testcases/responses/whois.nic.fr/{registered.txt → fr/registered.txt} +0 -0
- data/test/testcases/responses/whois.nic.fr/pm/available.txt +19 -0
- data/test/testcases/responses/whois.nic.fr/pm/registered.txt +88 -0
- data/test/testcases/responses/whois.nic.fr/re/available.txt +19 -0
- data/test/testcases/responses/whois.nic.fr/re/registered.txt +83 -0
- data/test/testcases/responses/whois.nic.fr/wf/available.txt +19 -0
- data/test/testcases/responses/whois.nic.fr/wf/registered.txt +88 -0
- data/test/testcases/responses/whois.nic.fr/yt/available.txt +19 -0
- data/test/testcases/responses/whois.nic.fr/yt/registered.txt +88 -0
- data/test/testcases/responses/whois.nic.gl/available.txt +23 -0
- data/test/testcases/responses/whois.nic.gl/registered.txt +40 -0
- data/test/testcases/responses/whois.nic.hu/available.txt +5 -5
- data/test/testcases/responses/whois.nic.hu/in_progress.txt +5 -5
- data/test/testcases/responses/whois.nic.hu/registered.txt +6 -6
- data/test/testcases/responses/whois.nic.im/available.txt +2 -0
- data/test/testcases/responses/whois.nic.im/registered.txt +45 -0
- data/test/testcases/responses/whois.nic.io/available.txt +2 -0
- data/test/testcases/responses/whois.nic.io/registered.txt +2 -0
- data/test/testcases/responses/whois.nic.ly/available.txt +1 -0
- data/test/testcases/responses/whois.nic.ly/registered.txt +65 -0
- data/test/testcases/responses/whois.nic.mu/ki/available.txt +20 -0
- data/test/testcases/responses/whois.nic.mu/ki/registered.txt +30 -0
- data/test/testcases/responses/whois.nic.mu/mu/available.txt +9 -0
- data/test/testcases/responses/whois.nic.mu/mu/registered.txt +22 -0
- data/test/testcases/responses/whois.nic.nu/available.txt +19 -0
- data/test/testcases/responses/whois.nic.nu/registered.txt +35 -0
- data/test/testcases/responses/whois.nic.tel/available.txt +59 -0
- data/test/testcases/responses/whois.nic.tel/registered.txt +111 -0
- data/test/testcases/responses/whois.nic.tl/available.txt +21 -0
- data/test/testcases/responses/whois.nic.tl/registered.txt +29 -0
- data/test/testcases/responses/whois.nic.travel/available.txt +25 -0
- data/test/testcases/responses/whois.nic.travel/registered.txt +75 -0
- data/test/testcases/responses/whois.nic.uk/available.txt +20 -0
- data/test/testcases/responses/whois.nic.uk/invalid.txt +22 -0
- data/test/testcases/responses/whois.nic.uk/registered.txt +50 -0
- data/test/testcases/responses/whois.nic.us/available.txt +29 -0
- data/test/testcases/responses/whois.nic.us/registered.txt +99 -0
- data/test/testcases/responses/whois.norid.no/available.txt +5 -0
- data/test/testcases/responses/whois.norid.no/registered.txt +34 -0
- data/test/testcases/responses/whois.register.bg/available.txt +1 -0
- data/test/testcases/responses/whois.register.bg/registered.txt +44 -0
- data/test/testcases/responses/whois.registro.br/available.txt +22 -0
- data/test/testcases/responses/whois.registro.br/registered.txt +23 -0
- data/test/testcases/responses/whois.registrypro.pro/available.txt +20 -0
- data/test/testcases/responses/whois.registrypro.pro/registered.txt +62 -0
- data/test/testcases/responses/whois.ripe.net/fo/available.txt +11 -0
- data/test/testcases/responses/whois.ripe.net/fo/registered.txt +45 -0
- data/test/testcases/responses/whois.ripe.net/gm/available.txt +11 -0
- data/test/testcases/responses/whois.ripe.net/gm/registered.txt +37 -0
- data/test/testcases/responses/whois.ripe.net/mc/available.txt +11 -0
- data/test/testcases/responses/whois.ripe.net/mc/registered.txt +36 -0
- data/test/testcases/responses/whois.ripe.net/sm/available.txt +11 -0
- data/test/testcases/responses/whois.ripe.net/sm/registered.txt +60 -0
- data/test/testcases/responses/whois.ripe.net/va/available.txt +11 -0
- data/test/testcases/responses/whois.ripe.net/va/registered.txt +48 -0
- data/test/testcases/responses/whois.ripn.net/ru/available.txt +9 -0
- data/test/testcases/responses/whois.ripn.net/ru/registered.txt +24 -0
- data/test/testcases/responses/whois.ripn.net/su/available.txt +9 -0
- data/test/testcases/responses/whois.ripn.net/su/registered.txt +20 -0
- data/test/testcases/responses/whois.rotld.ro/available.txt +16 -0
- data/test/testcases/responses/whois.rotld.ro/registered.txt +27 -0
- data/test/testcases/responses/whois.samoanic.ws/available.txt +12 -0
- data/test/testcases/responses/whois.samoanic.ws/registered.txt +34 -0
- data/whois.gemspec +19 -19
- metadata +274 -31
- data/lib/whois/answer/parser/README.rdoc +0 -21
- data/lib/whois/definitions/ipv4.txt +0 -214
- data/lib/whois/definitions/ipv6.txt +0 -32
- data/lib/whois/definitions/tld.notes.txt +0 -1
- data/lib/whois/definitions/tlds.txt +0 -354
- data/lib/whois/whois.rb +0 -185
- data/test/testcases/responses/whois.afilias-grs.info/registered.txt +0 -122
- data/test/testcases/responses/whois.nic.fr/MULTIPLE.txt +0 -4
- data/test/whois_test.rb +0 -32
- data/utils/tlds.txt +0 -318
@@ -34,7 +34,7 @@ module Whois
|
|
34
34
|
#
|
35
35
|
class WhoisNicFr < Base
|
36
36
|
|
37
|
-
|
37
|
+
property_supported :status do
|
38
38
|
@status ||= if content.to_s =~ /status:\s+(.*)\n/
|
39
39
|
$1.downcase.to_sym
|
40
40
|
else
|
@@ -42,33 +42,30 @@ module Whois
|
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
|
-
|
45
|
+
property_supported :available? do
|
46
46
|
@available ||= !!(content.to_s =~ /No entries found in the AFNIC Database/)
|
47
47
|
end
|
48
48
|
|
49
|
-
|
49
|
+
property_supported :registered? do
|
50
50
|
!available?
|
51
51
|
end
|
52
52
|
|
53
53
|
|
54
|
-
|
54
|
+
property_supported :created_on do
|
55
55
|
@created_on ||= if content.to_s =~ /created:\s+(.*)\n/
|
56
56
|
d, m, y = $1.split("/")
|
57
57
|
Time.parse("#{y}-#{m}-#{d}")
|
58
58
|
end
|
59
59
|
end
|
60
|
-
|
61
|
-
|
60
|
+
|
61
|
+
property_supported :updated_on do
|
62
62
|
@updated_on ||= if content.to_s =~ /last-update:\s+(.*)\n/
|
63
63
|
d, m, y = $1.split("/")
|
64
64
|
Time.parse("#{y}-#{m}-#{d}")
|
65
65
|
end
|
66
66
|
end
|
67
|
-
|
68
|
-
|
69
|
-
register_method :expires_on do
|
70
|
-
nil
|
71
|
-
end
|
67
|
+
|
68
|
+
property_not_supported :expires_on
|
72
69
|
|
73
70
|
end
|
74
71
|
|
@@ -0,0 +1,77 @@
|
|
1
|
+
#
|
2
|
+
# = Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# Category:: Net
|
8
|
+
# Package:: Whois
|
9
|
+
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
+
# License:: MIT License
|
11
|
+
#
|
12
|
+
#--
|
13
|
+
#
|
14
|
+
#++
|
15
|
+
|
16
|
+
|
17
|
+
require 'whois/answer/parser/base'
|
18
|
+
|
19
|
+
|
20
|
+
module Whois
|
21
|
+
class Answer
|
22
|
+
class Parser
|
23
|
+
|
24
|
+
#
|
25
|
+
# = whois.nic.gl parser
|
26
|
+
#
|
27
|
+
# Parser for the whois.nic.gl server.
|
28
|
+
#
|
29
|
+
# NOTE: This parser is just a stub and provides only a few basic methods
|
30
|
+
# to check for domain availability and get domain status.
|
31
|
+
# Please consider to contribute implementing missing methods.
|
32
|
+
# See WhoisNicIt parser for an explanation of all available methods
|
33
|
+
# and examples.
|
34
|
+
#
|
35
|
+
class WhoisNicGl < Base
|
36
|
+
|
37
|
+
property_supported :status do
|
38
|
+
@status ||= if content.to_s =~ /Status:\s+(.*?)\n/
|
39
|
+
case $1.downcase.to_sym
|
40
|
+
when :"active" then :registered
|
41
|
+
when :"not registered" then :available
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
property_supported :available? do
|
47
|
+
@available ||= (status == :available)
|
48
|
+
end
|
49
|
+
|
50
|
+
property_supported :registered? do
|
51
|
+
!available?
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
property_supported :created_on do
|
56
|
+
@created_on ||= if content.to_s =~ /Created:\s+(.*?)\n/
|
57
|
+
Time.parse($1)
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
property_supported :updated_on do
|
62
|
+
@updated_on ||= if content.to_s =~ /Modified:\s+(.*?)\n/
|
63
|
+
Time.parse($1)
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
property_supported :expires_on do
|
68
|
+
@expires_on ||= if content.to_s =~ /Expires:\s+(.*?)\n/
|
69
|
+
Time.parse($1)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
74
|
+
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
@@ -34,35 +34,26 @@ module Whois
|
|
34
34
|
#
|
35
35
|
class WhoisNicGov < Base
|
36
36
|
|
37
|
-
|
37
|
+
property_supported :status do
|
38
38
|
@status ||= if content.to_s =~ /Status:\s(.*?)[\r\n]+/
|
39
39
|
$1.downcase.to_sym
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
|
-
|
43
|
+
property_supported :available? do
|
44
44
|
!registered?
|
45
45
|
end
|
46
46
|
|
47
|
-
|
47
|
+
property_supported :registered? do
|
48
48
|
@registered ||= (content.to_s =~ /Domain Name:/)
|
49
49
|
end
|
50
50
|
|
51
51
|
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
# TODO: NotAvailable
|
58
|
-
register_method :updated_on do
|
59
|
-
nil
|
60
|
-
end
|
61
|
-
|
62
|
-
# TODO: NotAvailable
|
63
|
-
register_method :expires_on do
|
64
|
-
nil
|
65
|
-
end
|
52
|
+
property_not_supported :created_on
|
53
|
+
|
54
|
+
property_not_supported :updated_on
|
55
|
+
|
56
|
+
property_not_supported :expires_on
|
66
57
|
|
67
58
|
end
|
68
59
|
|
@@ -30,23 +30,23 @@ module Whois
|
|
30
30
|
include Ast
|
31
31
|
|
32
32
|
# Returns the registry disclaimer that comes with the answer.
|
33
|
-
|
33
|
+
property_supported :disclaimer do
|
34
34
|
node('Disclaimer')
|
35
35
|
end
|
36
36
|
|
37
37
|
# If available, returns the domain name as stored by the registry.
|
38
|
-
|
38
|
+
property_supported :domain do
|
39
39
|
node('Domain')
|
40
40
|
end
|
41
41
|
|
42
42
|
# If available, returns the unique domain ID set by the registry.
|
43
|
-
|
43
|
+
property_supported :domain_id do
|
44
44
|
node('hun-id')
|
45
45
|
end
|
46
46
|
|
47
47
|
# Returns the record status: <tt>:available</tt>, <tt>:in_progress</tt>
|
48
48
|
# or <tt>:registered</tt>.
|
49
|
-
|
49
|
+
property_supported :status do
|
50
50
|
if node('NotFound')
|
51
51
|
:available
|
52
52
|
elsif node('InProgress')
|
@@ -57,30 +57,30 @@ module Whois
|
|
57
57
|
end
|
58
58
|
|
59
59
|
# Returns whether this record is available.
|
60
|
-
|
60
|
+
property_supported :available? do
|
61
61
|
@available ||= status == :available
|
62
62
|
end
|
63
63
|
|
64
64
|
# Returns whether this record is registered.
|
65
|
-
|
65
|
+
property_supported :registered? do
|
66
66
|
@registered ||= status == :registered
|
67
67
|
end
|
68
68
|
|
69
69
|
# If available, returns a Time object representing the date
|
70
70
|
# the record was created, according to the registry answer.
|
71
|
-
|
71
|
+
property_supported :created_on do
|
72
72
|
node('registered') { |raw| Time.parse(raw) }
|
73
73
|
end
|
74
74
|
|
75
75
|
# If available, returns a Time object representing the date
|
76
76
|
# the record was last updated, according to the registry answer.
|
77
|
-
|
77
|
+
property_supported :updated_on do
|
78
78
|
node('changed') { |raw| Time.parse(raw) }
|
79
79
|
end
|
80
80
|
|
81
81
|
# If available, returns a <tt>Whois::Answer::Contact</tt> record
|
82
82
|
# containing the registrant details extracted from the registry answer.
|
83
|
-
|
83
|
+
property_supported :registrant do
|
84
84
|
if registered?
|
85
85
|
a1 = (node('address') || [])[1].split(/\s/)
|
86
86
|
zip = a1.shift
|
@@ -100,35 +100,35 @@ module Whois
|
|
100
100
|
|
101
101
|
# If available, returns an array of name servers entries for this domain
|
102
102
|
# if any name server is available in the registry answer.
|
103
|
-
|
103
|
+
property_supported :nameservers do
|
104
104
|
node('nameserver')
|
105
105
|
end
|
106
106
|
|
107
107
|
# If available, returns a <tt>Whois::Answer::Contact</tt> record
|
108
108
|
# containing the admin contact details extracted from the registry answer.
|
109
|
-
|
109
|
+
property_supported :admin do
|
110
110
|
contact('admin-c')
|
111
111
|
end
|
112
112
|
|
113
113
|
# If available, returns a <tt>Whois::Answer::Contact</tt> record
|
114
114
|
# containing the technical contact details extracted from the registry answer.
|
115
|
-
|
115
|
+
property_supported :technical do
|
116
116
|
contact('tech-c')
|
117
117
|
end
|
118
118
|
|
119
119
|
# If available, returns a <tt>Whois::Answer::Contact</tt> record
|
120
120
|
# containing the zone contact details extracted from the registry answer.
|
121
|
-
|
121
|
+
property_supported :zone_contact do
|
122
122
|
contact('zone-c')
|
123
123
|
end
|
124
124
|
|
125
125
|
# If available, returns a <tt>Whois::Answer::Contact</tt> record
|
126
126
|
# containing the registrar contact details extracted from the registry answer.
|
127
|
-
|
127
|
+
property_supported :registrar_contact do
|
128
128
|
contact('registrar')
|
129
129
|
end
|
130
130
|
|
131
|
-
|
131
|
+
property_supported :registrar do
|
132
132
|
if rc = registrar_contact
|
133
133
|
Answer::Registrar.new(
|
134
134
|
:id => rc[:id],
|
@@ -206,17 +206,19 @@ module Whois
|
|
206
206
|
false
|
207
207
|
end
|
208
208
|
|
209
|
+
# FIXME: Requires UTF-8 Encoding (see #11)
|
209
210
|
def parse_not_found
|
210
|
-
if @input.match?(/\nNincs
|
211
|
-
@input.scan(/\nNincs
|
211
|
+
if @input.match?(/\nNincs (.*?) \/ No match\n/)
|
212
|
+
@input.scan(/\nNincs (.*?) \/ No match\n/)
|
212
213
|
return @ast['NotFound'] = true
|
213
214
|
end
|
214
215
|
@ast['NotFound'] = false
|
215
216
|
end
|
216
217
|
|
218
|
+
# FIXME: Requires UTF-8 Encoding (see #11)
|
217
219
|
def parse_in_progress
|
218
|
-
if @input.match?(/
|
219
|
-
@input.scan(/
|
220
|
+
if @input.match?(/(.*?) folyamatban \/ Registration in progress\n/)
|
221
|
+
@input.scan(/(.*?) folyamatban \/ Registration in progress\n/)
|
220
222
|
return @ast['InProgress'] = true
|
221
223
|
end
|
222
224
|
@ast['InProgress'] = false
|
@@ -0,0 +1,68 @@
|
|
1
|
+
#
|
2
|
+
# = Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# Category:: Net
|
8
|
+
# Package:: Whois
|
9
|
+
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
+
# License:: MIT License
|
11
|
+
#
|
12
|
+
#--
|
13
|
+
#
|
14
|
+
#++
|
15
|
+
|
16
|
+
|
17
|
+
require 'whois/answer/parser/base'
|
18
|
+
|
19
|
+
|
20
|
+
module Whois
|
21
|
+
class Answer
|
22
|
+
class Parser
|
23
|
+
|
24
|
+
#
|
25
|
+
# = whois.nic.im parser
|
26
|
+
#
|
27
|
+
# Parser for the whois.nic.im server.
|
28
|
+
#
|
29
|
+
# NOTE: This parser is just a stub and provides only a few basic methods
|
30
|
+
# to check for domain availability and get domain status.
|
31
|
+
# Please consider to contribute implementing missing methods.
|
32
|
+
# See WhoisNicIt parser for an explanation of all available methods
|
33
|
+
# and examples.
|
34
|
+
#
|
35
|
+
class WhoisNicIm < Base
|
36
|
+
|
37
|
+
property_supported :status do
|
38
|
+
@status ||= if available?
|
39
|
+
:available
|
40
|
+
else
|
41
|
+
:registered
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
property_supported :available? do
|
46
|
+
@available ||= !!(content.to_s =~ /was not found/)
|
47
|
+
end
|
48
|
+
|
49
|
+
property_supported :registered? do
|
50
|
+
!available?
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
property_not_supported :created_on
|
55
|
+
|
56
|
+
property_not_supported :updated_on
|
57
|
+
|
58
|
+
property_supported :expires_on do
|
59
|
+
@expires_on ||= if content.to_s =~ /Expiry Date:\s+(.*?)\n/
|
60
|
+
Time.parse($1.gsub("/", "-"))
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
#
|
2
|
+
# = Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
#
|
7
|
+
# Category:: Net
|
8
|
+
# Package:: Whois
|
9
|
+
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
+
# License:: MIT License
|
11
|
+
#
|
12
|
+
#--
|
13
|
+
#
|
14
|
+
#++
|
15
|
+
|
16
|
+
|
17
|
+
require 'whois/answer/parser/base'
|
18
|
+
|
19
|
+
|
20
|
+
module Whois
|
21
|
+
class Answer
|
22
|
+
class Parser
|
23
|
+
|
24
|
+
#
|
25
|
+
# = whois.nic.io parser
|
26
|
+
#
|
27
|
+
# Parser for the whois.nic.io server.
|
28
|
+
#
|
29
|
+
# NOTE: This parser is just a stub and provides only a few basic methods
|
30
|
+
# to check for domain availability and get domain status.
|
31
|
+
# Please consider to contribute implementing missing methods.
|
32
|
+
# See WhoisNicIt parser for an explanation of all available methods
|
33
|
+
# and examples.
|
34
|
+
#
|
35
|
+
class WhoisNicIo < Base
|
36
|
+
|
37
|
+
property_supported :status do
|
38
|
+
@status ||= if available?
|
39
|
+
:available
|
40
|
+
else
|
41
|
+
:registered
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
property_supported :available? do
|
46
|
+
@available ||= !!(content.to_s =~ /- Available/)
|
47
|
+
end
|
48
|
+
|
49
|
+
property_supported :registered? do
|
50
|
+
!available?
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
property_not_supported :created_on
|
55
|
+
|
56
|
+
property_not_supported :updated_on
|
57
|
+
|
58
|
+
property_not_supported :expires_on
|
59
|
+
|
60
|
+
end
|
61
|
+
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -30,61 +30,61 @@ module Whois
|
|
30
30
|
include Ast
|
31
31
|
|
32
32
|
# Returns the registry disclaimer that comes with the answer.
|
33
|
-
|
33
|
+
property_supported :disclaimer do
|
34
34
|
node("Disclaimer")
|
35
35
|
end
|
36
36
|
|
37
37
|
|
38
38
|
# If available, returns the domain name as stored by the registry.
|
39
|
-
|
39
|
+
property_supported :domain do
|
40
40
|
node("Domain") { |raw| raw.downcase }
|
41
41
|
end
|
42
42
|
|
43
43
|
# If available, returns the unique domain ID set by the registry.
|
44
|
-
|
44
|
+
property_supported :domain_id do
|
45
45
|
nil
|
46
46
|
end
|
47
47
|
|
48
48
|
|
49
49
|
# Returns the record status or an array of status,
|
50
50
|
# in case the registry supports it.
|
51
|
-
|
51
|
+
property_supported :status do
|
52
52
|
node("Status") { |raw| raw.downcase.to_sym }
|
53
53
|
end
|
54
54
|
|
55
55
|
# Returns whether this record is available.
|
56
|
-
|
56
|
+
property_supported :available? do
|
57
57
|
node("Status") == "AVAILABLE"
|
58
58
|
end
|
59
59
|
|
60
60
|
# Returns whether this record is registered.
|
61
|
-
|
61
|
+
property_supported :registered? do
|
62
62
|
!available?
|
63
63
|
end
|
64
64
|
|
65
65
|
|
66
66
|
# If available, returns a Time object representing the date
|
67
67
|
# the record was created, according to the registry answer.
|
68
|
-
|
68
|
+
property_supported :created_on do
|
69
69
|
node("Created") { |raw| Time.parse(raw) }
|
70
70
|
end
|
71
71
|
|
72
72
|
# If available, returns a Time object representing the date
|
73
73
|
# the record was last updated, according to the registry answer.
|
74
|
-
|
74
|
+
property_supported :updated_on do
|
75
75
|
node("Last Update") { |raw| Time.parse(raw) }
|
76
76
|
end
|
77
77
|
|
78
78
|
# If available, returns a Time object representing the date
|
79
79
|
# the record is set to expire, according to the registry answer.
|
80
|
-
|
80
|
+
property_supported :expires_on do
|
81
81
|
node("Expire Date") { |raw| Time.parse(raw) }
|
82
82
|
end
|
83
83
|
|
84
84
|
|
85
85
|
# If available, returns a <tt>Whois::Answer::Registrar</tt> record
|
86
86
|
# containing the registrar details extracted from the registry answer.
|
87
|
-
|
87
|
+
property_supported :registrar do
|
88
88
|
node("Registrar") do |raw|
|
89
89
|
Answer::Registrar.new(
|
90
90
|
:id => raw["Name"],
|
@@ -96,19 +96,19 @@ module Whois
|
|
96
96
|
|
97
97
|
# If available, returns a <tt>Whois::Answer::Contact</tt> record
|
98
98
|
# containing the registrant details extracted from the registry answer.
|
99
|
-
|
99
|
+
property_supported :registrant do
|
100
100
|
contact("Registrant")
|
101
101
|
end
|
102
102
|
|
103
103
|
# If available, returns a <tt>Whois::Answer::Contact</tt> record
|
104
104
|
# containing the admin contact details extracted from the registry answer.
|
105
|
-
|
105
|
+
property_supported :admin do
|
106
106
|
contact("Admin Contact")
|
107
107
|
end
|
108
108
|
|
109
109
|
# If available, returns a <tt>Whois::Answer::Contact</tt> record
|
110
110
|
# containing the technical contact details extracted from the registry answer.
|
111
|
-
|
111
|
+
property_supported :technical do
|
112
112
|
contact("Technical Contacts")
|
113
113
|
end
|
114
114
|
|
@@ -124,7 +124,7 @@ module Whois
|
|
124
124
|
# nameserver
|
125
125
|
# # => ["ns2.google.com", "ns1.google.com", "ns3.google.com"]
|
126
126
|
#
|
127
|
-
|
127
|
+
property_supported :nameservers do
|
128
128
|
node("Nameservers")
|
129
129
|
end
|
130
130
|
|
@@ -139,12 +139,12 @@ module Whois
|
|
139
139
|
#
|
140
140
|
# This method should provide a bulletproof way to detect whether this answer
|
141
141
|
# changed if compared with <tt>other</tt>.
|
142
|
-
|
142
|
+
property_supported :changed? do |other|
|
143
143
|
!unchanged?(other)
|
144
144
|
end
|
145
145
|
|
146
146
|
# The opposite of <tt>changed?</tt>.
|
147
|
-
|
147
|
+
property_supported :unchanged? do |other|
|
148
148
|
self == other ||
|
149
149
|
self.content.to_s == other.content.to_s
|
150
150
|
# (self == other) ||
|