Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions lib/whois/parsers/whois.nameisp.com.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
#--
# 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

class WhoisNameispCom < BaseIcannCompliant
self.scanner = Scanners::BaseIcannCompliant, {
pattern_available: /^ERROR: domain not found:/
}

property_supported :domain do
node("Domain Name")
end

property_supported :domain_id do
node("Registry Domain ID")
end

property_supported :created_on do
node("Creation Date") { |value| parse_time(value) }
end

property_supported :updated_on do
node("Updated Date") { |value| parse_time(value) }
end

property_supported :expires_on do
node("Registrar Registration Expiration Date") { |value| parse_time(value) }
end

property_supported :registrar do
return unless node("Registrar")
Parser::Registrar.new(
id: node("Registrar IANA ID"),
name: node("Registrar"),
organization: node("Registrar"),
url: node("Registrar URL")
)
end

property_supported :registrant_contacts do
build_contact("Registrant", Parser::Contact::TYPE_REGISTRANT)
end

property_supported :admin_contacts do
build_contact("Admin", Parser::Contact::TYPE_ADMINISTRATIVE)
end

property_supported :technical_contacts do
build_contact("Tech", Parser::Contact::TYPE_TECHNICAL)
end

# Checks whether this response contains a message
# that can be reconducted to a "WHOIS Server Unavailable" status.
#
# @return [Boolean]
def response_unavailable?
!!node("response:unavailable")
end

private

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

end
end
end
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#domain
%s == nil

#domain_id
%s == nil

#status
%s == :available

#available?
%s == true

#registered?
%s == false

#created_on
%s == nil

#updated_on
%s == nil

#expires_on
%s == nil

#registrar
%s == nil

#registrant_contacts
%s %CLASS{array}
%s == []

#admin_contacts
%s %CLASS{array}
%s == []

#technical_contacts
%s %CLASS{array}
%s == []

#nameservers
%s %CLASS{array}
%s == []
23 changes: 23 additions & 0 deletions spec/fixtures/responses/whois.nameisp.com/status_available.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

ERROR: domain not found: u34jedzcq.com

Whois server 2.5

The data in the www.NameISP.com whois database is provided to you for
information purposes only, that is, to assist you in obtaining information
about or related to a domain name registration record. We make this
information available "as is," and do not guarantee its accuracy.

By submitting a whois query, you agree that you will use this data only for
lawful purposes and that, under no circumstances will you use this data to:

(1) enable high volume, automated, electronic processes that stress or load
this whois database system providing you this information; or
(2) allow, enable, or otherwise support the transmission of mass
unsolicited,
commercial advertising or solicitations via direct mail, electronic
mail, or by telephone. The compilation, repackaging, dissemination or
other use of this data is expressly prohibited without prior written
consent from us.

NOTE! ALL WHOIS QUERIES AND IP ADDRESSES ARE LOGGED!
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#domain
%s == "domain.com"

#domain_id
%s == "93697156_DOMAIN_COM-VRSN"

#status
%s == :registered

#available?
%s == false

#registered?
%s == true

#created_on
%s %CLASS{time}
%s %TIME{2003-01-06 13:49:20 UTC}

#updated_on
%s %CLASS{time}
%s %TIME{2017-03-20 10:43:48 UTC}

#expires_on
%s %CLASS{time}
%s %TIME{2025-01-06 13:49:20 UTC}

#registrar
%s %CLASS{registrar}
%s.id == "113"
%s.name == "AB NAME ISP"
%s.organization == "AB NAME ISP"
%s.url == "www.namesrs.com"

#registrant_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_REGISTRANT
%s[0].name == "Domain Admin"
%s[0].organization == "AB Name ISP"
%s[0].address == "Radiovgen 2"
%s[0].city == "VSTRA FRLUNDA"
%s[0].zip == "421 47"
%s[0].state == ""
%s[0].country_code == "SE"
%s[0].phone == "+46.313011220"
%s[0].fax == "+46.317090850"
%s[0].email == "registry@nameisp.com"

#admin_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_ADMINISTRATIVE
%s[0].name == "Domain Admin"
%s[0].organization == "AB Name ISP"
%s[0].address == "Radiovgen 2"
%s[0].city == "VSTRA FRLUNDA"
%s[0].zip == "421 47"
%s[0].state == ""
%s[0].country_code == "se"
%s[0].phone == "+46.313011220"
%s[0].fax == "+46.317090850"
%s[0].email == "registry@nameisp.com"

#technical_contacts
%s %CLASS{array}
%s %SIZE{1}
%s[0] %CLASS{contact}
%s[0].type == Whois::Parser::Contact::TYPE_TECHNICAL
%s[0].name == "Domain Admin"
%s[0].organization == "AB Name ISP"
%s[0].address == "Radiovgen 2"
%s[0].city == "VSTRA FRLUNDA"
%s[0].zip == "421 47"
%s[0].state == ""
%s[0].country_code == "SE"
%s[0].phone == "+46.313011220"
%s[0].fax == "+46.317090850"
%s[0].email == "registry@nameisp.com"

#nameservers
%s %CLASS{array}
%s %SIZE{2}
%s[0] %CLASS{nameserver}
%s[0].name == "gene.ns.cloudflare.com"
%s[1] %CLASS{nameserver}
%s[1].name == "tim.ns.cloudflare.com"
74 changes: 74 additions & 0 deletions spec/fixtures/responses/whois.nameisp.com/status_registered.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@


Domain Name: nameisp.com
Registry Domain ID: 93697156_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.nameisp.com
Registrar URL: www.namesrs.com
Updated Date: 2017-03-20T10:43:48.00Z
Creation Date: 2003-01-06T13:49:20.00Z
Registrar Registration Expiration Date: 2025-01-06T13:49:20.00Z
Registrar: AB NAME ISP
Registrar IANA ID: 1371
Registrar Abuse Contact Email: info@nameisp.com
Registrar Abuse Contact Phone: +46.313011220
Domain Status: clientTransferProhibited https://icann.org/epp#clientTransferProhibited
Registry Registrant ID: 793066
Registrant Name: Domain Admin
Registrant Organization: AB Name ISP
Registrant Street: Radiovgen 2
Registrant City: VSTRA FRLUNDA
Registrant State:
Registrant Postal Code: 421 47
Registrant Country: SE
Registrant Phone: +46.313011220
Registrant Fax: +46.317090850
Registrant Email: registry@nameisp.com
Registry Admin ID: 959999
Admin Name: Domain Admin
Admin Organization: AB Name ISP
Admin Street: Radiovgen 2
Admin City: VSTRA FRLUNDA
Admin Postal Code: 421 47
Admin Country: se
Admin Phone: +46.313011220
Admin Fax: +46.317090850
Admin Email: registry@nameisp.com
Registry Tech ID: 793066
Tech Name: Domain Admin
Tech Organization: AB Name ISP
Tech Street: Radiovgen 2
Tech City: VSTRA FRLUNDA
Tech Postal Code: 421 47
Tech Country: SE
Tech Phone: +46.313011220
Tech Fax: +46.317090850
Tech Email: registry@nameisp.com
Name Server: GENE.NS.CLOUDFLARE.COM
Name Server: TIM.NS.CLOUDFLARE.COM
DNSSEC: Unsigned
URL of the ICANN WHOIS Data Problem Reporting System: http://wdprs.internic.net/
Last update of WHOIS database: 2018-05-03T10:01:08.00Z

Whois information protected.
Contact the registrant via http://www.shieldwhois.com

Whois server 2.5

The data in the www.NameISP.com whois database is provided to you for
information purposes only, that is, to assist you in obtaining information
about or related to a domain name registration record. We make this
information available "as is," and do not guarantee its accuracy.

By submitting a whois query, you agree that you will use this data only for
lawful purposes and that, under no circumstances will you use this data to:

(1) enable high volume, automated, electronic processes that stress or load
this whois database system providing you this information; or
(2) allow, enable, or otherwise support the transmission of mass
unsolicited,
commercial advertising or solicitations via direct mail, electronic
mail, or by telephone. The compilation, repackaging, dissemination or
other use of this data is expressly prohibited without prior written
consent from us.

NOTE! ALL WHOIS QUERIES AND IP ADDRESSES ARE LOGGED!
Loading