So i'm here again about the ruby whois gem on which i'm bound to be working on for some time. I have been fiddling around with it and noticed some of the news gTLDs weren't implemented or not completely. Hence, i would like to understand the depths of this Ruby whois parser in order to add some of the missing properties.
Right now, I am working on the .name TLD (parser is 'whois.nic.name') wich has domain, registrar, registrant_contacts and tech_contacts missing. (among other less useful ones)
Please correct me if i'm wrong, but from what i've understood the process of parsing is to extract from a plain text string notable keywords (such as "Domain Name" or "Sponsoring Registrar ID") in order to create either a property or a hash, depending on the input.
N.B -> A parser extends a base that is relevant to either a generic or specific registry. I'm pretty sure it has to do with the adapters, unless it is because each registry may have its own way of structuring whois data. Back to .name i've looked it up and it seems to be operated by Verisign. Among others, the .net TLD (parser is 'whois.verisign-grs.com') is also operated by the said registry so i assumed they should have a similar behavior. What a grave mistake i made...
Domain Name ID: XXXXXXXXXXXX
Domain Name: XXXXXXXXXXX.NAME
Sponsoring Registrar: Network Solutions, LLC.
Sponsoring Registrar ID: 2_REGISTRAR_NAME-VRSN
Domain Status: clientTransferProhibited
Registrant ID: CONTACT_NAME-VRSN
Admin ID: CONTACT_NAME-VRSN
Tech ID: CONTACT_NAME-VRSN
Billing ID: CONTACT_NAME-VRSN
Name Server: NS1.WIX.COM
Name Server ID: 1739652_HOST_NAME-VRSN
Name Server: NS2.WIX.COM
Name Server ID: 1739653_HOST_NAME-VRSN
Created On: 2013-09-30T05:36:15Z
Expires On: 2015-09-30T05:36:15Z
Updated On: 2014-10-06T11:44:37Z
Domain Name: XXXXXXX.NET
Registry Domain ID:
Registrar WHOIS Server: whois.publicdomainregistry.com
Registrar URL: www.publicdomainregistry.com
Updated Date: 23-Jul-2014
Creation Date: 24-Apr-2009
Registrar Registration Expiration Date: 24-Apr-2016
Registrar: PDR Ltd. d/b/a PublicDomainRegistry.com
Registrar IANA ID: 303
Registrar Abuse Contact Email: [email protected]
Registrar Abuse Contact Phone: +1-2013775952
Domain Status: clientTransferProhibited
Registry Registrant ID: XXXXXXXX
Registrant Name: Domain Admin
And here is the output I did to display properties
domain :
status : ["clientTransferProhibited"]
available? : false
registered? : true
created on : 2013-09-30 05:36:15 UTC
updated on : 2014-10-06 11:44:37 UTC
expires_on : 2015-09-30 05:36:15 UTC
registrar (hash) :
registrant contact (hash) :
admin contact (hash) :
technical contact (hash) :
domain : XXXXXXX.net
status : registered
available? : false
registered? : true
created on : 2009-04-24 00:00:00 +0000
updated on : 2014-05-24 00:00:00 +0000
expires_on : 2016-04-24 00:00:00 +0000
registrar (hash) : #<struct Whois::Record::Registrar id=nil, name="PDR LTD. D/B/A PUBLICDOMAINREGISTRY.COM", organization=nil, url="http://www.PublicDomainRegistry.com">
registrant contact (hash) :
admin contact (hash) :
technical contact (hash) :
As one can see, there are a few variations. The one i wanted to point out was for the Registrar property in the plain text response. For the first one, it is "REGISTRAR IANA ID" and for the latter "SPONSORING REGISTRAR ID". This must explain why the parser is not working on the .name TLD since the Verisign base parser (file base_verisign.rb) was configured as such :
property_supported :registrar do
node("Sponsoring Registrar") do |value|
Whois::Record::Registrar.new(
id: last_useful_item(node("Sponsoring Registrar IANA ID")),
name: last_useful_item(value),
url: referral_url
)
end
end
Not that I understand why it is "Sponsoring Registrar IANA ID" and not "Registrar IANA ID"...
Anyway, if someone could help me out by explaining what i'm misunderstanding and provide me with an example as to how i could add the registrar property for the .name TLD (so i could do it for the rest) that'd be awesome !
And I would like to know what is a "node" it thy code, because i have no idea. I'm assuming it's a representation of the struct object that encapsulates the properties of the whois response, but i haven't seen any info on it anywhere.
Anyway, cheers !
Actually, figured my issue was elsewhere.
Since the Ruby-Whois is a gem, its Load_Path will load as a gem from the rvm directory (and it should do so). But in a developping environment where i'm editing the sources files, Ruby just ignores my changes and loads the gem, not my edited version. Thank you Load_Path.
That's why even when using Byebug i couldn't get any breakpoints to work, since it was using the gem version of whois and not the local one i was editing. Seems quite obvious now, but when modifying the whois you should not install the gem.
Then, with a bit of regex adding properties isn't all that difficult, just time consuming.