Permalink
Browse files

Update whois.nic.xxx parser

  • Loading branch information...
1 parent 1e8499f commit c80d35c3e4d046c9a6a6c77b177d271402bccccd @weppos committed Feb 25, 2014
@@ -72,12 +72,12 @@ class BaseAfilias < Base
property_supported :registrar do
node("Sponsoring Registrar") do |value|
- parts = decompose_registrar(value) ||
+ id, name = decompose_registrar(value) ||
Whois.bug!(ParserError, "Unknown registrar format `#{value}'")
Record::Registrar.new(
- id: parts[0],
- name: parts[1]
+ id: id,
+ name: name
)
end
end
@@ -106,7 +106,7 @@ class BaseAfilias < Base
def build_contact(element, type)
node("#{element} ID") do
- address = (1..3).
+ address = ["", "1", "2", "3"].
map { |i| node("#{element} Street#{i}") }.
delete_if { |i| i.nil? || i.empty? }.
join("\n")
@@ -122,7 +122,7 @@ def build_contact(element, type)
:state => node("#{element} State/Province"),
:country_code => node("#{element} Country"),
:phone => node("#{element} Phone"),
- :fax => node("#{element} FAX"),
+ :fax => node("#{element} FAX") || node("#{element} Fax"),
:email => node("#{element} Email")
)
end
@@ -40,7 +40,7 @@ class BaseShared2 < Base
property_supported :status do
- node("Domain Status")
+ node("Domain Status") { |value| Array.wrap(value) }
end
property_supported :available? do
@@ -17,18 +17,35 @@ class Parser
# Parser for the whois.nic.xxx server.
class WhoisNicXxx < BaseAfilias
+ self.scanner = Scanners::BaseAfilias, {
+ pattern_disclaimer: /^Access to/
+ }
+
+
property_supported :status do
if reserved?
:reserved
else
- super()
+ Array.wrap(node("Domain Status"))
end
end
+
+ property_supported :created_on do
+ node("Creation Date") do |value|
+ Time.parse(value)
+ end
+ end
property_supported :updated_on do
- node("Last Updated On") do |value|
- Time.parse(value) unless value.empty?
+ node("Updated Date") do |value|
+ Time.parse(value)
+ end
+ end
+
+ property_supported :expires_on do
+ node("Registry Expiry Date") do |value|
+ Time.parse(value)
end
end
@@ -38,15 +55,6 @@ def reserved?
!!node("status:reserved")
end
-
- private
-
- def decompose_registrar(value)
- if value =~ /(.+?) \((.+?)\)/
- [$1, $2]
- end
- end
-
end
end
@@ -31,15 +31,14 @@ def response_throttled?
end
property_supported :status do
- list = Array.wrap(node("Domain Status"))
+ Array.wrap(node("Domain Status"))
end
property_supported :registrar do
node('Sponsoring Registrar') do |name|
Record::Registrar.new(
- :id => node('Sponsoring Registrar IANA ID'),
- :name => node('Sponsoring Registrar'),
- :organization => node('Sponsoring Registrar')
+ id: node('Sponsoring Registrar IANA ID'),
+ name: node('Sponsoring Registrar')
)
end
end
@@ -49,7 +49,11 @@ class BaseAfilias < Base
end
tokenizer :scan_disclaimer do
- if @input.pos == 0 && @input.match?(/^(.+\n){3,}\n/)
+ if settings[:pattern_disclaimer]
+ if @input.match?(settings[:pattern_disclaimer])
+ @ast["field:disclaimer"] = _scan_lines_to_array(/^(.+)\n/).join(" ")
+ end
+ elsif @input.pos == 0 && @input.match?(/^(.+\n){3,}\n/)
@ast["field:disclaimer"] = _scan_lines_to_array(/^(.+)\n/).join(" ")
end
end
@@ -1,2 +0,0 @@
-#updated_on
- %s == nil
@@ -1,98 +0,0 @@
-Access to the .XXX WHOIS information is provided to assist persons in
-determining the contents of a domain name registration record in the
-ICM Registry database. The data in this record is provided by
-ICM Registry for informational purposes only, and ICM does not
-guarantee its accuracy. This service is intended only for query-based
-access. You agree that you will use this data only for lawful purposes
-and that, under no circumstances will you use this data to: (a) allow,
-enable, or otherwise support the transmission by e-mail, telephone, or
-facsimile of mass unsolicited, commercial advertising or solicitations
-to entities other than the data recipient's own existing customers; or
-(b) enable high volume, automated, electronic processes that send
-queries or data to the systems of Registry Operator, a Registrar, or
-ICM except as reasonably necessary to register domain names or
-modify existing registrations. All rights reserved. ICM reserves
-the right to modify these terms at any time. By submitting this query,
-you agree to abide by this policy.
-
-
-Domain ID:D372-ICM
-Domain Name:MASALA.XXX
-Created On:2011-08-09 17:48:52.556689+00
-Last Updated On:
-Expiration Date:2012-08-09 17:48:52.556689
-Sponsoring Registrar:R2-ICM (Domainmonster.com)
-Status:OK
-Registrant ID:C7-ICM
-Registrant Name:Domainmonster.com Privacy Service
-Registrant Organization:Mesh Digital Ltd (Domainmonster.com)
-Registrant Street1:PO Box 795
-Registrant Street2:
-Registrant Street3:
-Registrant City:Godalming
-Registrant State/Province:Surrey
-Registrant Postal Code:GU7 9GA
-Registrant Country:UB
-Registrant Phone:44.14833075
-Registrant Phone Ext.:
-Registrant FAX:+44.148330403
-Registrant FAX Ext.:
-Registrant Email:support@domainmonster.com
-Admin ID:C7-ICM
-Admin Name:Domainmonster.com Privacy Service
-Admin Organization:Mesh Digital Ltd (Domainmonster.com)
-Admin Street1:PO Box 795
-Admin Street2:
-Admin Street3:
-Admin City:Godalming
-Admin State/Province:Surrey
-Admin Postal Code:GU7 9GA
-Admin Country:UB
-Admin Phone:44.14833075
-Admin Phone Ext.:
-Admin FAX:+44.148330403
-Admin FAX Ext.:
-Admin Email:support@domainmonster.com
-Billing ID:C7-ICM
-Billing Name:Domainmonster.com Privacy Service
-Billing Organization:Mesh Digital Ltd (Domainmonster.com)
-Billing Street1:PO Box 795
-Billing Street2:
-Billing Street3:
-Billing City:Godalming
-Billing State/Province:Surrey
-Billing Postal Code:GU7 9GA
-Billing Country:UB
-Billing Phone:44.14833075
-Billing Phone Ext.:
-Billing FAX:+44.148330403
-Billing FAX Ext.:
-Billing Email:support@domainmonster.com
-Tech ID:C7-ICM
-Tech Name:Domainmonster.com Privacy Service
-Tech Organization:Mesh Digital Ltd (Domainmonster.com)
-Tech Street1:PO Box 795
-Tech Street2:
-Tech Street3:
-Tech City:Godalming
-Tech State/Province:Surrey
-Tech Postal Code:GU7 9GA
-Tech Country:UB
-Tech Phone:44.14833075
-Tech Phone Ext.:
-Tech FAX:+44.148330403
-Tech FAX Ext.:
-Tech Email:support@domainmonster.com
-Name Server:ns33.domaincontrol.com
-Name Server:ns34.domaincontrol.com
-Name Server:
-Name Server:
-Name Server:
-Name Server:
-Name Server:
-Name Server:
-Name Server:
-Name Server:
-Name Server:
-Name Server:
-Name Server:
@@ -1,16 +1,16 @@
#disclaimer
- %s == "Access to the .XXX WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the ICM Registry database. The data in this record is provided by ICM Registry for informational purposes only, and ICM does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to: (a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or ICM except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. ICM reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy."
+ %s == "Access to .XXX ICM REGISTRY WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the ICM registry database. The data in this record is provided by ICM Registry for informational purposes only, and ICM does not guarantee its accuracy. This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to(a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. ICM reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy."
#domain
%s == "masala.xxx"
#domain_id
- %s == "D372-ICM"
+ %s == "D130773-XXX"
#status
- %s == ["OK"]
+ %s == ["ok"]
#available?
%s == false
@@ -21,79 +21,83 @@
#created_on
%s %CLASS{time}
- %s %TIME{2011-08-09 17:48:52.556689 UTC}
+ %s %TIME{2011-12-01 01:37:55 UTC}
#updated_on
- %s == nil
+ %s %CLASS{time}
+ %s %TIME{2013-12-02 22:20:04 UTC}
#expires_on
%s %CLASS{time}
- %s %TIME{2012-08-09 17:48:52.556689}
+ %s %TIME{2014-12-01 01:37:55 UTC}
#registrar
%s %CLASS{registrar}
- %s.id == "R2-ICM"
- %s.name == "Domainmonster.com"
+ %s.id == "R3228-XXX"
+ %s.name == "Mesh Digital Limited"
%s.organization == nil
%s.url == nil
#registrant_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
- %s[0].type == Whois::Record::Contact::TYPE_REGISTRANT
- %s[0].id == "C7-ICM"
- %s[0].name == "Domainmonster.com Privacy Service"
- %s[0].organization == "Mesh Digital Ltd (Domainmonster.com)"
- %s[0].address == "PO Box 795"
- %s[0].city == "Godalming"
- %s[0].zip == "GU7 9GA"
- %s[0].state == "Surrey"
- %s[0].country_code == "UB"
- %s[0].phone == "44.14833075"
- %s[0].fax == "+44.148330403"
- %s[0].email == "support@domainmonster.com"
+ %s[0].type == Whois::Record::Contact::TYPE_REGISTRANT
+ %s[0].id == "MNT5BB23000590"
+ %s[0].name == "Domainmonster.com Privacy Service"
+ %s[0].organization == "Identity Protect Limited"
+ %s[0].address == "PO Box 795"
+ %s[0].city == "Godalming"
+ %s[0].zip == "GU7 9GA"
+ %s[0].state == "Surrey"
+ %s[0].country == nil
+ %s[0].country_code == "GB"
+ %s[0].phone == "+44.1483307527"
+ %s[0].fax == "+44.1483304031"
+ %s[0].email == "masala.xxx@privatemonster.com"
#admin_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
- %s[0].type == Whois::Record::Contact::TYPE_ADMINISTRATIVE
- %s[0].id == "C7-ICM"
- %s[0].name == "Domainmonster.com Privacy Service"
- %s[0].organization == "Mesh Digital Ltd (Domainmonster.com)"
- %s[0].address == "PO Box 795"
- %s[0].city == "Godalming"
- %s[0].zip == "GU7 9GA"
- %s[0].state == "Surrey"
- %s[0].country_code == "UB"
- %s[0].phone == "44.14833075"
- %s[0].fax == "+44.148330403"
- %s[0].email == "support@domainmonster.com"
+ %s[0].type == Whois::Record::Contact::TYPE_ADMINISTRATIVE
+ %s[0].id == "MNT5BB23000590"
+ %s[0].name == "Domainmonster.com Privacy Service"
+ %s[0].organization == "Identity Protect Limited"
+ %s[0].address == "PO Box 795"
+ %s[0].city == "Godalming"
+ %s[0].zip == "GU7 9GA"
+ %s[0].state == "Surrey"
+ %s[0].country == nil
+ %s[0].country_code == "GB"
+ %s[0].phone == "+44.1483307527"
+ %s[0].fax == "+44.1483304031"
+ %s[0].email == "masala.xxx@privatemonster.com"
#technical_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
- %s[0].type == Whois::Record::Contact::TYPE_TECHNICAL
- %s[0].id == "C7-ICM"
- %s[0].name == "Domainmonster.com Privacy Service"
- %s[0].organization == "Mesh Digital Ltd (Domainmonster.com)"
- %s[0].address == "PO Box 795"
- %s[0].city == "Godalming"
- %s[0].zip == "GU7 9GA"
- %s[0].state == "Surrey"
- %s[0].country_code == "UB"
- %s[0].phone == "44.14833075"
- %s[0].fax == "+44.148330403"
- %s[0].email == "support@domainmonster.com"
+ %s[0].type == Whois::Record::Contact::TYPE_TECHNICAL
+ %s[0].id == "MNT5BB23000590"
+ %s[0].name == "Domainmonster.com Privacy Service"
+ %s[0].organization == "Identity Protect Limited"
+ %s[0].address == "PO Box 795"
+ %s[0].city == "Godalming"
+ %s[0].zip == "GU7 9GA"
+ %s[0].state == "Surrey"
+ %s[0].country == nil
+ %s[0].country_code == "GB"
+ %s[0].phone == "+44.1483307527"
+ %s[0].fax == "+44.1483304031"
+ %s[0].email == "masala.xxx@privatemonster.com"
#nameservers
%s %CLASS{array}
%s %SIZE{2}
%s[0] %CLASS{nameserver}
- %s[0].name == "ns33.domaincontrol.com"
+ %s[0].name == "ns39.domaincontrol.com"
%s[1] %CLASS{nameserver}
- %s[1].name == "ns34.domaincontrol.com"
+ %s[1].name == "ns40.domaincontrol.com"
Oops, something went wrong.

0 comments on commit c80d35c

Please sign in to comment.