Skip to content

Commit

Permalink
Added support for all (or fixing existing) CentralNic TLDs (136 at th…
Browse files Browse the repository at this point in the history
…e time: .ADAC, .AE.ORG, .ALLFINANZ, .ART, .AUTO, .AUTOS, .BABY, .BAR, .BEAUTY, .BEST, .BH, .BLOG, .BMW, .BOATS, .BOND, .BOX, .BR.COM, .BUILD, .CAM, .CAR, .CARS, .CASE, .CEO, .CFD, .CN.COM, .CO.COM, .CO.NL, .CO.NO, .CO.RO, .COLLEGE, .COM.DE, .COM.SE, .COOP, .CYOU, .DE.COM, .DEALER, .DELOITTE, .DESI, .DESIGN, .DHL, .DVAG, .ETISALAT, .EU.COM, .FANS, .FEEDBACK, .FM, .FO, .FORUM, .FRESENIUS, .FRL, .FUN, .GAY, .GB.NET, .GD, .GENT, .GR.COM, .HAIR, .HOMES, .HOST, .HU.NET, .ICU, .IN.NET, .INC, .INK, .JP.NET, .JPN.COM, .KFH, .KPN, .KRED, .LIDL, .LONDON, .LOVE, .LPL, .LPLFINANCIAL, .LUXURY, .MAKEUP, .MEX.COM, .MINI, .MONSTER, .MOTORCYCLES, .MUSIC, .ONLINE, .OOO, .PID, .POHL, .PRESS, .PROTECTION, .PW, .QPON, .QUEST, .RADIO.AM, .REIT, .RENT, .REST, .RU.COM, .SA.COM, .SAARLAND, .SBS, .SCHWARZ, .SE.NET, .SECURITY, .SFR, .SHOP.RO, .SITE, .SKIN, .SMART, .SPACE, .STC, .STCGROUP, .STORAGE, .STORE, .TECH, .THEATRE, .TICKETS, .TUI, .UK.COM, .UK.NET, .UNO, .US.COM, .US.ORG, .VG, .VIVA, .WEBSITE, .WIKI, .WME, .موقع, .اتصالات, .البحرين, .بيتك, .VERMÖGENSBERATER, .VERMÖGENSBERATUNG, .XYZ, .YACHTS, .ZA.BZ, .ZA.COM, .ZUERICH)
  • Loading branch information
jarthod committed Dec 16, 2021
1 parent e8bc52a commit e0222f8
Show file tree
Hide file tree
Showing 230 changed files with 2,301 additions and 8,433 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ This project uses [Semantic Versioning 2.0.0](http://semver.org/).

#### master

- NEW: Added support for all (or fixing existing) CentralNic TLDs (136 at the time: .ADAC, .AE.ORG, .ALLFINANZ, .ART, .AUTO, .AUTOS, .BABY, .BAR, .BEAUTY, .BEST, .BH, .BLOG, .BMW, .BOATS, .BOND, .BOX, .BR.COM, .BUILD, .CAM, .CAR, .CARS, .CASE, .CEO, .CFD, .CN.COM, .CO.COM, .CO.NL, .CO.NO, .CO.RO, .COLLEGE, .COM.DE, .COM.SE, .COOP, .CYOU, .DE.COM, .DEALER, .DELOITTE, .DESI, .DESIGN, .DHL, .DVAG, .ETISALAT, .EU.COM, .FANS, .FEEDBACK, .FM, .FO, .FORUM, .FRESENIUS, .FRL, .FUN, .GAY, .GB.NET, .GD, .GENT, .GR.COM, .HAIR, .HOMES, .HOST, .HU.NET, .ICU, .IN.NET, .INC, .INK, .JP.NET, .JPN.COM, .KFH, .KPN, .KRED, .LIDL, .LONDON, .LOVE, .LPL, .LPLFINANCIAL, .LUXURY, .MAKEUP, .MEX.COM, .MINI, .MONSTER, .MOTORCYCLES, .MUSIC, .ONLINE, .OOO, .PID, .POHL, .PRESS, .PROTECTION, .PW, .QPON, .QUEST, .RADIO.AM, .REIT, .RENT, .REST, .RU.COM, .SA.COM, .SAARLAND, .SBS, .SCHWARZ, .SE.NET, .SECURITY, .SFR, .SHOP.RO, .SITE, .SKIN, .SMART, .SPACE, .STC, .STCGROUP, .STORAGE, .STORE, .TECH, .THEATRE, .TICKETS, .TUI, .UK.COM, .UK.NET, .UNO, .US.COM, .US.ORG, .VG, .VIVA, .WEBSITE, .WIKI, .WME, .موقع, .اتصالات, .البحرين, .بيتك, .VERMÖGENSBERATER, .VERMÖGENSBERATUNG, .XYZ, .YACHTS, .ZA.BZ, .ZA.COM, .ZUERICH)
- FIX: Updated parser for .IN tld which changed name
- FIX: Updated parser for .MX tld (and derivates: .COM.MX, .ORG.MX, etc.) which changed name
- FIX: Updated parser for .COM.AU tld (based on #100) Thanks @kovalevsky
Expand Down
2 changes: 2 additions & 0 deletions lib/whois/parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def self.parser_klass(part)
# But using one host per TLD, so in this case it's easier to match on the disclaimer directly to cover all hosts
if part.body&.include?("Terms of Use: Donuts Inc.")
autoload("donuts_inc")
elsif part.body&.include?("The Whois and RDAP services are provided by CentralNic")
autoload("central_nic")
else
autoload("blank")
end
Expand Down
13 changes: 8 additions & 5 deletions lib/whois/parsers/base_icann_compliant.rb
Original file line number Diff line number Diff line change
Expand Up @@ -141,14 +141,17 @@ def contact_address_attribute(element)
private

def value_for_phone_property(element, property)
[
value_for_property(element, "#{property}"),
value_for_property(element, "#{property} Ext")
].reject(&:empty?).join(' ext: ')
node("#{element} #{property}") do |phone|
ext = node("#{element} #{property} Ext")
phone += " ext: #{ext}" if ext.present?
phone
end
end

def value_for_property(element, property)
Array.wrap(node("#{element} #{property}")).reject(&:empty?).join(', ')
node("#{element} #{property}") do |values|
Array.wrap(values).reject(&:empty?).join(', ')
end
end

end
Expand Down
47 changes: 47 additions & 0 deletions lib/whois/parsers/central_nic.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#--
# Ruby Whois
#
# An intelligent pure Ruby WHOIS client and parser.
#
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
#++

require_relative 'base_icann_compliant'

module Whois
class Parsers

# Parser for the whois.centralnic.com server.
class CentralNic < BaseIcannCompliant
include Scanners::Scannable

self.scanner = Scanners::BaseIcannCompliant, {
pattern_available: /^The queried object does not exist:.+\(?DOMAIN NOT FOUND\)?/,
pattern_disclaimer: /^The Whois and RDAP services are provided by CentralNic/
}

private

def build_contact(element, type)
node("#{element} Email") do |email|
Parser::Contact.new(
type: type,
id: node("#{element} ID"),
name: node("#{element} Name"),
organization: node("#{element} Organization"),
city: node("#{element} City"),
address: contact_address_attribute(element),
zip: node("#{element} Postal Code"),
state: node("#{element} State/Province"),
country_code: node("#{element} Country"),
phone: node("#{element} Phone"),
fax: node("#{element} FAX") || node("#{element} Fax"),
email: email
)
end
end

end

end
end
137 changes: 0 additions & 137 deletions lib/whois/parsers/whois.centralnic.com.rb

This file was deleted.

25 changes: 0 additions & 25 deletions lib/whois/parsers/whois.nic.college.rb

This file was deleted.

25 changes: 0 additions & 25 deletions lib/whois/parsers/whois.nic.design.rb

This file was deleted.

23 changes: 15 additions & 8 deletions lib/whois/parsers/whois.nic.la.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,26 @@
# Copyright (c) 2009-2018 Simone Carletti <weppos@weppos.net>
#++


require_relative 'base'
require_relative 'whois.centralnic.com.rb'

require_relative 'base_icann_compliant'

module Whois
class Parsers

# Parser for the whois.nic.la server.
#
# It aliases the whois.centralnic.com parser because
# the .LA TLD is powered by Centralnic.
class WhoisNicLa < WhoisCentralnicCom
class WhoisNicLa < BaseIcannCompliant
self.scanner = Scanners::BaseIcannCompliant, {
pattern_available: /^The queried object does not exist:.+\(?DOMAIN NOT FOUND\)?/,
pattern_disclaimer: /^This whois service is provided by LANIC/
}

private

def build_contact(element, type)
node("#{element} Email") do |email|
Parser::Contact.new(type: type, email: email)
end
end

end

end
Expand Down
25 changes: 0 additions & 25 deletions lib/whois/parsers/whois.nic.pw.rb

This file was deleted.

25 changes: 0 additions & 25 deletions lib/whois/parsers/whois.nic.space.rb

This file was deleted.

25 changes: 0 additions & 25 deletions lib/whois/parsers/whois.nic.tech.rb

This file was deleted.

Loading

0 comments on commit e0222f8

Please sign in to comment.