whois 2.7.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +143 -0
- data/{LICENSE → LICENSE.txt} +1 -1
- data/README.md +28 -41
- data/bin/ruby-whois +14 -7
- data/data/ipv4.json +723 -0
- data/data/ipv6.json +100 -0
- data/data/tld.json +1302 -0
- data/lib/whois.rb +3 -3
- data/lib/whois/client.rb +17 -7
- data/lib/whois/core_ext.rb +0 -2
- data/lib/whois/errors.rb +13 -20
- data/lib/whois/record.rb +28 -22
- data/lib/whois/record/contact.rb +1 -1
- data/lib/whois/record/nameserver.rb +1 -1
- data/lib/whois/record/parser.rb +70 -46
- data/lib/whois/record/parser/base.rb +58 -59
- data/lib/whois/record/parser/base_afilias.rb +2 -7
- data/lib/whois/record/parser/base_cocca.rb +8 -5
- data/lib/whois/record/parser/base_cocca2.rb +107 -0
- data/lib/whois/record/parser/base_shared1.rb +2 -7
- data/lib/whois/record/parser/base_shared2.rb +2 -7
- data/lib/whois/record/parser/base_whoisd.rb +16 -9
- data/lib/whois/record/parser/blank.rb +1 -1
- data/lib/whois/record/parser/example.rb +1 -10
- data/lib/whois/record/parser/jobswhois.verisign-grs.com.rb +19 -19
- data/lib/whois/record/parser/kero.yachay.pe.rb +28 -18
- data/lib/whois/record/parser/whois.adamsnames.tc.rb +1 -1
- data/lib/whois/record/parser/whois.aeda.net.ae.rb +1 -1
- data/lib/whois/record/parser/whois.aero.rb +2 -2
- data/lib/whois/record/parser/whois.afilias-grs.info.rb +1 -1
- data/lib/whois/record/parser/whois.afilias.info.rb +1 -1
- data/lib/whois/record/parser/whois.ai.rb +1 -1
- data/lib/whois/record/parser/whois.arnes.si.rb +1 -1
- data/lib/whois/record/parser/whois.ati.tn.rb +3 -8
- data/lib/whois/record/parser/whois.audns.net.au.rb +4 -9
- data/lib/whois/record/parser/whois.ax.rb +66 -0
- data/lib/whois/record/parser/whois.biz.rb +1 -1
- data/lib/whois/record/parser/whois.cat.rb +1 -1
- data/lib/whois/record/parser/whois.cctld.by.rb +5 -8
- data/lib/whois/record/parser/whois.cctld.uz.rb +1 -1
- data/lib/whois/record/parser/whois.centralnic.com.rb +4 -9
- data/lib/whois/record/parser/whois.cira.ca.rb +3 -8
- data/lib/whois/record/parser/whois.cmc.iq.rb +7 -4
- data/lib/whois/record/parser/whois.cnnic.cn.rb +13 -21
- data/lib/whois/record/parser/whois.co.ca.rb +1 -1
- data/lib/whois/record/parser/whois.co.pl.rb +1 -6
- data/lib/whois/record/parser/whois.co.ug.rb +2 -2
- data/lib/whois/record/parser/whois.crsnic.net.rb +14 -15
- data/lib/whois/record/parser/whois.denic.de.rb +2 -2
- data/lib/whois/record/parser/whois.dk-hostmaster.dk.rb +2 -2
- data/lib/whois/record/parser/whois.dns.be.rb +2 -2
- data/lib/whois/record/parser/whois.dns.hr.rb +3 -8
- data/lib/whois/record/parser/whois.dns.lu.rb +1 -1
- data/lib/whois/record/parser/whois.dns.pl.rb +70 -9
- data/lib/whois/record/parser/whois.dns.pt.rb +16 -15
- data/lib/whois/record/parser/whois.domain-registry.nl.rb +2 -2
- data/lib/whois/record/parser/whois.domain.kg.rb +1 -1
- data/lib/whois/record/parser/whois.domainregistry.ie.rb +9 -12
- data/lib/whois/record/parser/whois.domainregistry.my.rb +1 -1
- data/lib/whois/record/parser/whois.domreg.lt.rb +1 -1
- data/lib/whois/record/parser/whois.dot.tk.rb +1 -1
- data/lib/whois/record/parser/whois.dotmobiregistry.net.rb +1 -1
- data/lib/whois/record/parser/whois.dreamhost.com.rb +1 -1
- data/lib/whois/record/parser/whois.educause.edu.rb +1 -6
- data/lib/whois/record/parser/whois.eenet.ee.rb +1 -1
- data/lib/whois/record/parser/whois.enom.com.rb +1 -1
- data/lib/whois/record/parser/whois.eu.org.rb +1 -1
- data/lib/whois/record/parser/whois.eu.rb +13 -1
- data/lib/whois/record/parser/whois.fi.rb +2 -2
- data/lib/whois/record/parser/whois.gg.rb +1 -1
- data/lib/whois/record/parser/whois.godaddy.com.rb +4 -4
- data/lib/whois/record/parser/whois.gov.za.rb +1 -1
- data/lib/whois/record/parser/whois.hkirc.hk.rb +1 -1
- data/lib/whois/record/parser/whois.iam.net.ma.rb +1 -1
- data/lib/whois/record/parser/whois.iana.org.rb +2 -2
- data/lib/whois/record/parser/whois.in.ua.rb +1 -1
- data/lib/whois/record/parser/whois.isnic.is.rb +1 -1
- data/lib/whois/record/parser/whois.isoc.org.il.rb +1 -1
- data/lib/whois/record/parser/whois.ja.net.rb +1 -1
- data/lib/whois/record/parser/whois.je.rb +1 -1
- data/lib/whois/record/parser/whois.jprs.jp.rb +9 -6
- data/lib/whois/record/parser/whois.kenic.or.ke.rb +1 -1
- data/lib/whois/record/parser/whois.kr.rb +1 -1
- data/lib/whois/record/parser/whois.markmonitor.com.rb +1 -1
- data/lib/whois/record/parser/whois.meregistry.net.rb +1 -1
- data/lib/whois/record/parser/whois.monic.mo.rb +1 -6
- data/lib/whois/record/parser/whois.museum.rb +1 -1
- data/lib/whois/record/parser/whois.na-nic.com.na.rb +3 -23
- data/lib/whois/record/parser/whois.nc.rb +8 -11
- data/lib/whois/record/parser/whois.netcom.cm.rb +1 -1
- data/lib/whois/record/parser/whois.networksolutions.com.rb +1 -1
- data/lib/whois/record/parser/whois.nic-se.se.rb +1 -1
- data/lib/whois/record/parser/whois.nic.ac.rb +1 -6
- data/lib/whois/record/parser/whois.nic.af.rb +7 -3
- data/lib/whois/record/parser/whois.nic.ag.rb +1 -1
- data/lib/whois/record/parser/whois.nic.am.rb +1 -1
- data/lib/whois/record/parser/whois.nic.as.rb +1 -1
- data/lib/whois/record/parser/whois.nic.asia.rb +1 -1
- data/lib/whois/record/parser/whois.nic.at.rb +7 -9
- data/lib/whois/record/parser/whois.nic.bo.rb +1 -1
- data/lib/whois/record/parser/whois.nic.cc.rb +11 -11
- data/lib/whois/record/parser/whois.nic.cd.rb +1 -1
- data/lib/whois/record/parser/whois.nic.ch.rb +1 -1
- data/lib/whois/record/parser/whois.nic.ci.rb +1 -1
- data/lib/whois/record/parser/whois.nic.ck.rb +1 -1
- data/lib/whois/record/parser/whois.nic.cl.rb +1 -1
- data/lib/whois/record/parser/whois.nic.co.rb +1 -1
- data/lib/whois/record/parser/whois.nic.coop.rb +1 -1
- data/lib/whois/record/parser/whois.nic.cx.rb +7 -3
- data/lib/whois/record/parser/whois.nic.cz.rb +8 -3
- data/lib/whois/record/parser/whois.nic.dm.rb +3 -8
- data/lib/whois/record/parser/whois.nic.dz.rb +1 -1
- data/lib/whois/record/parser/whois.nic.ec.rb +1 -1
- data/lib/whois/record/parser/whois.nic.fo.rb +2 -2
- data/lib/whois/record/parser/whois.nic.fr.rb +1 -1
- data/lib/whois/record/parser/whois.nic.gl.rb +5 -1
- data/lib/whois/record/parser/whois.nic.gov.rb +11 -12
- data/lib/whois/record/parser/whois.nic.gs.rb +7 -23
- data/lib/whois/record/parser/whois.nic.hn.rb +28 -0
- data/lib/whois/record/parser/whois.nic.ht.rb +7 -3
- data/lib/whois/record/parser/whois.nic.hu.rb +2 -2
- data/lib/whois/record/parser/whois.nic.im.rb +1 -1
- data/lib/whois/record/parser/whois.nic.io.rb +1 -6
- data/lib/whois/record/parser/whois.nic.ir.rb +1 -1
- data/lib/whois/record/parser/whois.nic.it.rb +2 -7
- data/lib/whois/record/parser/whois.nic.ki.rb +7 -3
- data/lib/whois/record/parser/whois.nic.kz.rb +9 -12
- data/lib/whois/record/parser/whois.nic.la.rb +3 -2
- data/lib/whois/record/parser/whois.nic.li.rb +1 -1
- data/lib/whois/record/parser/whois.nic.lk.rb +3 -9
- data/lib/whois/record/parser/whois.nic.lv.rb +1 -1
- data/lib/whois/record/parser/whois.nic.ly.rb +1 -1
- data/lib/whois/record/parser/whois.nic.md.rb +1 -6
- data/lib/whois/record/parser/whois.nic.mg.rb +1 -1
- data/lib/whois/record/parser/whois.nic.ms.rb +7 -3
- data/lib/whois/record/parser/whois.nic.mu.rb +7 -3
- data/lib/whois/record/parser/whois.nic.mx.rb +1 -1
- data/lib/whois/record/parser/whois.nic.name.rb +2 -2
- data/lib/whois/record/parser/whois.nic.net.nf.rb +7 -42
- data/lib/whois/record/parser/whois.nic.net.ng.rb +3 -3
- data/lib/whois/record/parser/whois.nic.net.sa.rb +1 -1
- data/lib/whois/record/parser/whois.nic.net.sb.rb +7 -3
- data/lib/whois/record/parser/whois.nic.nu.rb +1 -1
- data/lib/whois/record/parser/whois.nic.org.uy.rb +1 -1
- data/lib/whois/record/parser/whois.nic.pr.rb +32 -14
- data/lib/whois/record/parser/whois.nic.priv.at.rb +1 -1
- data/lib/whois/record/parser/whois.nic.pw.rb +27 -0
- data/lib/whois/record/parser/whois.nic.sh.rb +1 -6
- data/lib/whois/record/parser/whois.nic.sl.rb +1 -1
- data/lib/whois/record/parser/whois.nic.sm.rb +1 -1
- data/lib/whois/record/parser/whois.nic.sn.rb +1 -6
- data/lib/whois/record/parser/whois.nic.so.rb +1 -1
- data/lib/whois/record/parser/whois.nic.st.rb +1 -1
- data/lib/whois/record/parser/whois.nic.tel.rb +5 -54
- data/lib/whois/record/parser/whois.nic.tl.rb +7 -3
- data/lib/whois/record/parser/whois.nic.tm.rb +1 -6
- data/lib/whois/record/parser/whois.nic.tr.rb +1 -1
- data/lib/whois/record/parser/whois.nic.travel.rb +5 -50
- data/lib/whois/record/parser/whois.nic.tv.rb +11 -12
- data/lib/whois/record/parser/whois.nic.uk.rb +18 -20
- data/lib/whois/record/parser/whois.nic.us.rb +5 -50
- data/lib/whois/record/parser/whois.nic.ve.rb +1 -1
- data/lib/whois/record/parser/whois.nic.xxx.rb +1 -1
- data/lib/whois/record/parser/whois.norid.no.rb +1 -1
- data/lib/whois/record/parser/whois.org.za.rb +1 -6
- data/lib/whois/record/parser/whois.pandi.or.id.rb +1 -1
- data/lib/whois/record/parser/whois.pir.org.rb +1 -1
- data/lib/whois/record/parser/whois.pnina.ps.rb +1 -1
- data/lib/whois/record/parser/whois.register.bg.rb +1 -1
- data/lib/whois/record/parser/whois.register.com.rb +2 -2
- data/lib/whois/record/parser/whois.registro.br.rb +1 -1
- data/lib/whois/record/parser/whois.registry.gy.rb +7 -3
- data/lib/whois/record/parser/whois.registry.hm.rb +1 -1
- data/lib/whois/record/parser/whois.registry.in.rb +1 -1
- data/lib/whois/record/parser/whois.registry.net.za.rb +123 -0
- data/lib/whois/record/parser/whois.registry.om.rb +2 -2
- data/lib/whois/record/parser/whois.registry.qa.rb +1 -1
- data/lib/whois/record/parser/whois.registrypro.pro.rb +2 -2
- data/lib/whois/record/parser/whois.ripe.net.rb +1 -1
- data/lib/whois/record/parser/whois.rnids.rs.rb +3 -8
- data/lib/whois/record/parser/whois.rotld.ro.rb +1 -1
- data/lib/whois/record/parser/whois.samoanic.ws.rb +1 -1
- data/lib/whois/record/parser/whois.sgnic.sg.rb +1 -1
- data/lib/whois/record/parser/whois.sk-nic.sk.rb +1 -1
- data/lib/whois/record/parser/whois.smallregistry.net.rb +2 -2
- data/lib/whois/record/parser/whois.srs.net.nz.rb +1 -1
- data/lib/whois/record/parser/whois.sx.rb +50 -32
- data/lib/whois/record/parser/whois.tcinet.ru.rb +2 -2
- data/lib/whois/record/parser/whois.thnic.co.th.rb +5 -5
- data/lib/whois/record/parser/whois.tld.ee.rb +2 -2
- data/lib/whois/record/parser/whois.tonic.to.rb +1 -6
- data/lib/whois/record/parser/whois.twnic.net.tw.rb +1 -1
- data/lib/whois/record/parser/whois.tznic.or.tz.rb +2 -2
- data/lib/whois/record/parser/whois.ua.rb +1 -6
- data/lib/whois/record/parser/whois.usp.ac.fj.rb +1 -1
- data/lib/whois/record/parser/whois.za.net.rb +1 -1
- data/lib/whois/record/parser/whois.za.org.rb +1 -1
- data/lib/whois/record/parser/whois1.nic.bi.rb +5 -1
- data/lib/whois/record/part.rb +1 -1
- data/lib/whois/record/registrar.rb +1 -1
- data/lib/whois/record/scanners/base.rb +1 -1
- data/lib/whois/record/scanners/base_afilias.rb +1 -1
- data/lib/whois/record/scanners/base_shared1.rb +1 -1
- data/lib/whois/record/scanners/base_shared2.rb +1 -2
- data/lib/whois/record/scanners/base_whoisd.rb +4 -4
- data/lib/whois/record/scanners/iana.rb +1 -1
- data/lib/whois/record/scanners/{ast.rb → nodable.rb} +4 -4
- data/lib/whois/record/scanners/verisign.rb +1 -1
- data/lib/whois/record/scanners/whois.ati.tn.rb +1 -1
- data/lib/whois/record/scanners/whois.audns.net.au.rb +1 -1
- data/lib/whois/record/scanners/whois.cctld.by.rb +3 -1
- data/lib/whois/record/scanners/whois.centralnic.com.rb +1 -1
- data/lib/whois/record/scanners/whois.cira.ca.rb +1 -1
- data/lib/whois/record/scanners/whois.cnnic.cn.rb +6 -3
- data/lib/whois/record/scanners/whois.denic.de.rb +1 -1
- data/lib/whois/record/scanners/whois.dns.hr.rb +1 -1
- data/lib/whois/record/scanners/whois.domainregistry.ie.rb +3 -1
- data/lib/whois/record/scanners/whois.nc.rb +1 -1
- data/lib/whois/record/scanners/whois.nic.dm.rb +1 -1
- data/lib/whois/record/scanners/whois.nic.hu.rb +1 -1
- data/lib/whois/record/scanners/whois.nic.it.rb +1 -1
- data/lib/whois/record/scanners/whois.registry.net.za.rb +103 -0
- data/lib/whois/record/scanners/whois.rnids.rs.rb +1 -1
- data/lib/whois/record/scanners/whois.smallregistry.net.rb +1 -1
- data/lib/whois/record/scanners/whois.sx.rb +14 -46
- data/lib/whois/record/super_struct.rb +1 -1
- data/lib/whois/server.rb +18 -4
- data/lib/whois/server/adapters/afilias.rb +8 -13
- data/lib/whois/server/adapters/arpa.rb +1 -1
- data/lib/whois/server/adapters/base.rb +24 -44
- data/lib/whois/server/adapters/formatted.rb +1 -1
- data/lib/whois/server/adapters/none.rb +1 -1
- data/lib/whois/server/adapters/not_implemented.rb +1 -1
- data/lib/whois/server/adapters/standard.rb +1 -1
- data/lib/whois/server/adapters/verisign.rb +11 -19
- data/lib/whois/server/adapters/web.rb +2 -5
- data/lib/whois/server/socket_handler.rb +66 -0
- data/lib/whois/version.rb +3 -3
- data/whois.gemspec +11 -11
- metadata +24 -29
- data/lib/whois/core_ext/date_time/conversions.rb +0 -14
- data/lib/whois/definitions/ipv4.rb +0 -240
- data/lib/whois/definitions/ipv6.rb +0 -32
- data/lib/whois/definitions/tlds.rb +0 -367
- data/lib/whois/record/parser/saudinic.net.sa.rb +0 -23
- data/lib/whois/record/parser/whois.ausregistry.net.au.rb +0 -23
- data/lib/whois/record/parser/whois.centralnic.net.rb +0 -25
- data/lib/whois/record/parser/whois.cnnic.net.cn.rb +0 -23
- data/lib/whois/record/parser/whois.coza.net.za.rb +0 -76
- data/lib/whois/record/parser/whois.ficora.fi.rb +0 -24
- data/lib/whois/record/parser/whois.hkdnr.net.hk.rb +0 -23
- data/lib/whois/record/parser/whois.net.ua.rb +0 -24
- data/lib/whois/record/parser/whois.nic.or.kr.rb +0 -24
- data/lib/whois/record/parser/whois.publicinterestregistry.net.rb +0 -23
- data/lib/whois/record/parser/whois.ripn.net.rb +0 -23
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# An intelligent pure Ruby WHOIS client and parser.
|
5
5
|
#
|
6
|
-
# Copyright (c) 2009-
|
6
|
+
# Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
|
7
7
|
#++
|
8
8
|
|
9
9
|
|
@@ -11,14 +11,13 @@ require 'time'
|
|
11
11
|
require 'whois/record/contact'
|
12
12
|
require 'whois/record/registrar'
|
13
13
|
require 'whois/record/nameserver'
|
14
|
-
require 'whois/record/scanners/
|
14
|
+
require 'whois/record/scanners/nodable'
|
15
15
|
|
16
16
|
|
17
17
|
module Whois
|
18
18
|
class Record
|
19
19
|
class Parser
|
20
20
|
|
21
|
-
|
22
21
|
# Represents the abstract base parser class for all
|
23
22
|
# server-specific parser implementations.
|
24
23
|
#
|
@@ -38,15 +37,15 @@ module Whois
|
|
38
37
|
# @return [Symbol, nil]
|
39
38
|
#
|
40
39
|
# @example Undefined property
|
41
|
-
#
|
40
|
+
# property_state(:disclaimer)
|
42
41
|
# # => nil
|
43
42
|
#
|
44
43
|
# @example Defined property
|
45
|
-
# property_register(:disclaimer,
|
46
|
-
#
|
44
|
+
# property_register(:disclaimer, Whois::Record::Parser::PROPERTY_STATE_SUPPORTED) {}
|
45
|
+
# property_state(:disclaimer)
|
47
46
|
# # => :supported
|
48
47
|
#
|
49
|
-
def self.
|
48
|
+
def self.property_state(property)
|
50
49
|
self._properties[property]
|
51
50
|
end
|
52
51
|
|
@@ -58,15 +57,15 @@ module Whois
|
|
58
57
|
# @return [Boolean]
|
59
58
|
#
|
60
59
|
# @example Not-registered property
|
61
|
-
#
|
60
|
+
# property_state?(:disclaimer)
|
62
61
|
# # => false
|
63
62
|
#
|
64
63
|
# @example Registered property
|
65
64
|
# property_register(:disclaimer) {}
|
66
|
-
#
|
65
|
+
# property_state?(:disclaimer)
|
67
66
|
# # => true
|
68
67
|
#
|
69
|
-
def self.
|
68
|
+
def self.property_state?(property, status = :any)
|
70
69
|
if status == :any
|
71
70
|
self._properties.key?(property)
|
72
71
|
else
|
@@ -86,10 +85,10 @@ module Whois
|
|
86
85
|
end
|
87
86
|
|
88
87
|
|
89
|
-
# Registers a <tt>property</tt> as
|
88
|
+
# Registers a <tt>property</tt> as "not implemented"
|
90
89
|
# and defines the corresponding private _property_PROPERTY method.
|
91
90
|
#
|
92
|
-
# A
|
91
|
+
# A "not implemented" property always raises a <tt>AttributeNotImplemented</tt> error
|
93
92
|
# when the property method is called.
|
94
93
|
#
|
95
94
|
# @param [Symbol] property
|
@@ -100,21 +99,21 @@ module Whois
|
|
100
99
|
# property_not_implemented(:disclaimer)
|
101
100
|
#
|
102
101
|
def self.property_not_implemented(property)
|
103
|
-
property_register(property,
|
102
|
+
property_register(property, Whois::Record::Parser::PROPERTY_STATE_NOT_IMPLEMENTED)
|
104
103
|
|
105
104
|
class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
106
105
|
def _property_#{property}(*args)
|
107
|
-
raise
|
106
|
+
raise AttributeNotImplemented
|
108
107
|
end
|
109
108
|
|
110
109
|
private :_property_#{property}
|
111
110
|
RUBY
|
112
111
|
end
|
113
112
|
|
114
|
-
# Registers a <tt>property</tt> as
|
113
|
+
# Registers a <tt>property</tt> as "not supported"
|
115
114
|
# and defines the corresponding private _property_PROPERTY method.
|
116
115
|
#
|
117
|
-
# A
|
116
|
+
# A "not supported" property always raises a <tt>AttributeNotSupported</tt> error
|
118
117
|
# when the property method is called.
|
119
118
|
#
|
120
119
|
# @param [Symbol] property
|
@@ -125,18 +124,18 @@ module Whois
|
|
125
124
|
# property_not_supported(:disclaimer)
|
126
125
|
#
|
127
126
|
def self.property_not_supported(property)
|
128
|
-
property_register(property,
|
127
|
+
property_register(property, Whois::Record::Parser::PROPERTY_STATE_NOT_SUPPORTED)
|
129
128
|
|
130
129
|
class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
131
130
|
def _property_#{property}(*args)
|
132
|
-
raise
|
131
|
+
raise AttributeNotSupported
|
133
132
|
end
|
134
133
|
|
135
134
|
private :_property_#{property}
|
136
135
|
RUBY
|
137
136
|
end
|
138
137
|
|
139
|
-
# Registers a <tt>property</tt> as
|
138
|
+
# Registers a <tt>property</tt> as "supported"
|
140
139
|
# and defines the corresponding private _property_PROPERTY method.
|
141
140
|
#
|
142
141
|
# @param [Symbol] property
|
@@ -149,7 +148,7 @@ module Whois
|
|
149
148
|
# end
|
150
149
|
#
|
151
150
|
def self.property_supported(property, &block)
|
152
|
-
property_register(property,
|
151
|
+
property_register(property, Whois::Record::Parser::PROPERTY_STATE_SUPPORTED)
|
153
152
|
|
154
153
|
define_method("_property_#{property}", &block)
|
155
154
|
private :"_property_#{property}"
|
@@ -162,7 +161,7 @@ module Whois
|
|
162
161
|
# @return [Boolean]
|
163
162
|
#
|
164
163
|
def property_supported?(property)
|
165
|
-
self.class.
|
164
|
+
self.class.property_state?(property, Whois::Record::Parser::PROPERTY_STATE_SUPPORTED)
|
166
165
|
end
|
167
166
|
|
168
167
|
|
@@ -223,7 +222,7 @@ module Whois
|
|
223
222
|
end
|
224
223
|
|
225
224
|
|
226
|
-
#
|
225
|
+
# @!group Properties
|
227
226
|
|
228
227
|
Whois::Record::Parser::PROPERTIES.each do |property|
|
229
228
|
class_eval(<<-RUBY, __FILE__, __LINE__ + 1)
|
@@ -235,10 +234,10 @@ module Whois
|
|
235
234
|
property_not_implemented(property)
|
236
235
|
end
|
237
236
|
|
238
|
-
#
|
237
|
+
# @!endgroup
|
239
238
|
|
240
239
|
|
241
|
-
#
|
240
|
+
# @!group Methods
|
242
241
|
|
243
242
|
# Collects and returns all the available contacts.
|
244
243
|
#
|
@@ -254,10 +253,10 @@ module Whois
|
|
254
253
|
end
|
255
254
|
end
|
256
255
|
|
257
|
-
#
|
256
|
+
# @!endgroup
|
258
257
|
|
259
258
|
|
260
|
-
#
|
259
|
+
# @!group Response
|
261
260
|
|
262
261
|
# Checks whether the content of this part is different than +other+.
|
263
262
|
#
|
@@ -299,6 +298,7 @@ module Whois
|
|
299
298
|
content_for_scanner == other.content_for_scanner
|
300
299
|
end
|
301
300
|
|
301
|
+
|
302
302
|
# Checks whether this is an incomplete response.
|
303
303
|
#
|
304
304
|
# @return [Boolean]
|
@@ -343,55 +343,54 @@ module Whois
|
|
343
343
|
end
|
344
344
|
|
345
345
|
# Let them be documented
|
346
|
-
undef
|
347
|
-
undef
|
348
|
-
undef
|
346
|
+
undef response_incomplete?
|
347
|
+
undef response_throttled?
|
348
|
+
undef response_unavailable?
|
349
349
|
|
350
|
-
#
|
350
|
+
# @!endgroup
|
351
351
|
|
352
352
|
|
353
353
|
protected
|
354
354
|
|
355
|
-
|
356
|
-
|
357
|
-
|
355
|
+
def content_for_scanner
|
356
|
+
@content_for_scanner ||= content.to_s.gsub(/\r\n/, "\n")
|
357
|
+
end
|
358
358
|
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
end
|
363
|
-
@cached_properties[key]
|
359
|
+
def cached_properties_fetch(key)
|
360
|
+
if !@cached_properties.key?(key)
|
361
|
+
@cached_properties[key] = yield
|
364
362
|
end
|
363
|
+
@cached_properties[key]
|
364
|
+
end
|
365
|
+
|
365
366
|
|
366
367
|
private
|
367
368
|
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
value
|
374
|
-
end
|
369
|
+
def typecast(value, type)
|
370
|
+
if Array == type
|
371
|
+
Array.wrap(value)
|
372
|
+
else
|
373
|
+
value
|
375
374
|
end
|
375
|
+
end
|
376
376
|
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
end
|
377
|
+
def handle_property(property, *args)
|
378
|
+
unless property_supported?(property)
|
379
|
+
return send(:"_property_#{property}", *args)
|
380
|
+
end
|
382
381
|
|
383
|
-
|
384
|
-
|
385
|
-
|
382
|
+
cached_properties_fetch(property) do
|
383
|
+
validate!
|
384
|
+
value = send(:"_property_#{property}", *args)
|
386
385
|
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
end
|
386
|
+
case property.to_s
|
387
|
+
when /_contacts$/, "nameservers"
|
388
|
+
typecast(value, Array)
|
389
|
+
else
|
390
|
+
value
|
393
391
|
end
|
394
392
|
end
|
393
|
+
end
|
395
394
|
|
396
395
|
end
|
397
396
|
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# An intelligent pure Ruby WHOIS client and parser.
|
5
5
|
#
|
6
|
-
# Copyright (c) 2009-
|
6
|
+
# Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
|
7
7
|
#++
|
8
8
|
|
9
9
|
|
@@ -19,7 +19,7 @@ module Whois
|
|
19
19
|
#
|
20
20
|
# @abstract
|
21
21
|
class BaseAfilias < Base
|
22
|
-
include Scanners::
|
22
|
+
include Scanners::Nodable
|
23
23
|
|
24
24
|
|
25
25
|
property_supported :disclaimer do
|
@@ -36,11 +36,6 @@ module Whois
|
|
36
36
|
end
|
37
37
|
|
38
38
|
|
39
|
-
property_not_supported :referral_whois
|
40
|
-
|
41
|
-
property_not_supported :referral_url
|
42
|
-
|
43
|
-
|
44
39
|
property_supported :status do
|
45
40
|
Array.wrap(node("Status"))
|
46
41
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# An intelligent pure Ruby WHOIS client and parser.
|
5
5
|
#
|
6
|
-
# Copyright (c) 2009-
|
6
|
+
# Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
|
7
7
|
#++
|
8
8
|
|
9
9
|
|
@@ -73,10 +73,13 @@ module Whois
|
|
73
73
|
|
74
74
|
|
75
75
|
property_supported :registrar do
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
76
|
+
if content_for_scanner =~ /Registrar Name: (.+)\n/
|
77
|
+
Record::Registrar.new(
|
78
|
+
:name => $1,
|
79
|
+
:organization => nil,
|
80
|
+
:url => content_for_scanner.slice(/Registration URL: (.+)\n/, 1)
|
81
|
+
)
|
82
|
+
end
|
80
83
|
end
|
81
84
|
|
82
85
|
|
@@ -0,0 +1,107 @@
|
|
1
|
+
#--
|
2
|
+
# Ruby Whois
|
3
|
+
#
|
4
|
+
# An intelligent pure Ruby WHOIS client and parser.
|
5
|
+
#
|
6
|
+
# Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
|
7
|
+
#++
|
8
|
+
|
9
|
+
|
10
|
+
require 'whois/record/parser/base'
|
11
|
+
|
12
|
+
|
13
|
+
module Whois
|
14
|
+
class Record
|
15
|
+
class Parser
|
16
|
+
|
17
|
+
# Base parser for CoCCA servers.
|
18
|
+
#
|
19
|
+
# @abstract
|
20
|
+
class BaseCocca2 < Base
|
21
|
+
|
22
|
+
property_supported :domain do
|
23
|
+
content_for_scanner =~ /Domain Name: (.+)\n/
|
24
|
+
$1 || Whois.bug!(ParserError, "Unable to parse domain.")
|
25
|
+
end
|
26
|
+
|
27
|
+
property_not_supported :domain_id
|
28
|
+
|
29
|
+
# TODO: /pending delete/ => :redemption
|
30
|
+
# TODO: /pending purge/ => :redemption
|
31
|
+
property_supported :status do
|
32
|
+
list = statuses
|
33
|
+
case
|
34
|
+
when list.empty?
|
35
|
+
Whois.bug!(ParserError, "Unable to parse status.")
|
36
|
+
when list.include?("available")
|
37
|
+
:available
|
38
|
+
when list.include?("ok")
|
39
|
+
:registered
|
40
|
+
else
|
41
|
+
Whois.bug!(ParserError, "Unknown status `#{list.join(", ")}'.")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
property_supported :available? do
|
46
|
+
status == :available
|
47
|
+
end
|
48
|
+
|
49
|
+
property_supported :registered? do
|
50
|
+
!available?
|
51
|
+
end
|
52
|
+
|
53
|
+
|
54
|
+
property_supported :created_on do
|
55
|
+
if content_for_scanner =~ /Creation Date: (.+?)\n/
|
56
|
+
parse_time($1)
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
60
|
+
property_supported :updated_on do
|
61
|
+
if content_for_scanner =~ /Updated Date: (.+?)\n/
|
62
|
+
parse_time($1)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
property_supported :expires_on do
|
67
|
+
if content_for_scanner =~ /Registry Expiry Date: (.+?)\n/
|
68
|
+
parse_time($1)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
|
73
|
+
property_supported :registrar do
|
74
|
+
if content_for_scanner =~ /Sponsoring Registrar: (.+?)\n/
|
75
|
+
Record::Registrar.new(
|
76
|
+
:name => $1,
|
77
|
+
:organization => nil,
|
78
|
+
:url => content_for_scanner.slice(/Sponsoring Registrar URL: (.+)\n/, 1)
|
79
|
+
)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
property_supported :nameservers do
|
85
|
+
content_for_scanner.scan(/Name Server: (.+)\n/).flatten.map do |name|
|
86
|
+
Record::Nameserver.new(:name => name)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
90
|
+
|
91
|
+
def statuses
|
92
|
+
content_for_scanner.scan(/Domain Status: (.+)\n/).flatten.map(&:downcase)
|
93
|
+
end
|
94
|
+
|
95
|
+
|
96
|
+
private
|
97
|
+
|
98
|
+
def parse_time(value)
|
99
|
+
# Hack to remove usec. Do you know a better way?
|
100
|
+
Time.utc(*Time.parse(value).to_a)
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
#
|
4
4
|
# An intelligent pure Ruby WHOIS client and parser.
|
5
5
|
#
|
6
|
-
# Copyright (c) 2009-
|
6
|
+
# Copyright (c) 2009-2013 Simone Carletti <weppos@weppos.net>
|
7
7
|
#++
|
8
8
|
|
9
9
|
|
@@ -21,7 +21,7 @@ module Whois
|
|
21
21
|
#
|
22
22
|
# @since RELEASE
|
23
23
|
class BaseShared1 < Base
|
24
|
-
include Scanners::
|
24
|
+
include Scanners::Nodable
|
25
25
|
|
26
26
|
property_not_supported :disclaimer
|
27
27
|
|
@@ -33,11 +33,6 @@ module Whois
|
|
33
33
|
property_not_supported :domain_id
|
34
34
|
|
35
35
|
|
36
|
-
property_not_supported :referral_whois
|
37
|
-
|
38
|
-
property_not_supported :referral_url
|
39
|
-
|
40
|
-
|
41
36
|
property_supported :status do
|
42
37
|
Array.wrap(node("Status"))
|
43
38
|
end
|