-
-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
154 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#-- | ||
# Ruby Whois | ||
# | ||
# An intelligent pure Ruby WHOIS client and parser. | ||
# | ||
# Copyright (c) 2009-2016 Simone Carletti <weppos@weppos.net> | ||
#++ | ||
|
||
|
||
module Whois | ||
class Server | ||
module Adapters | ||
|
||
# | ||
# = NICbr Adapter | ||
# | ||
# Provides ability to query NICbr WHOIS interfaces. | ||
# | ||
class Nicbr < Base | ||
|
||
# Executes a WHOIS query to the NICbr WHOIS interface, | ||
# resolving any intermediate referral, | ||
# and appends the response to the client buffer. | ||
# | ||
# @param [String] string | ||
# @return [void] | ||
# | ||
def request(string) | ||
response = query_the_socket(string, host) | ||
buffer_append response, host | ||
|
||
if options[:referral] != false && referral = extract_referral(response) | ||
response = query_the_socket(string, referral) | ||
buffer_append(response, referral) | ||
end | ||
end | ||
|
||
|
||
private | ||
|
||
def extract_referral(response) | ||
if response =~ /Domain Name:/ | ||
response.slice(/Whois Server:(\S+)/, 1) | ||
end | ||
end | ||
|
||
end | ||
|
||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
Domain Name: nic.rio | ||
Domain ID: D54-RIO | ||
WHOIS Server: whois.gtlds.nic.br | ||
Referral URL: http://gtlds.nic.br | ||
Updated Date: 2015-05-12T19:56:09Z | ||
Creation Date: 2014-05-19T22:46:02Z | ||
Registry Expiry Date: 2025-05-19T22:46:02Z | ||
Sponsoring Registrar: NIC.br New gTLD Back-End Registry Services | ||
Sponsoring Registrar IANA ID: 9999 | ||
Domain Status: ok https://www.icann.org/epp#ok | ||
Registrant ID: C4R3-NICBR | ||
Registrant Name: Empresa Municipal de Informatica SA - IPLANRIO | ||
Registrant Organization: 73.214.439/0001-90 | ||
Registrant Street: Av. Presidente Vargas 3131 Sala 1204 | ||
Registrant City: Rio de Janeiro | ||
Registrant State/Province: RJ | ||
Registrant Postal Code: 20210-030 | ||
Registrant Country: BR | ||
Registrant Phone: +55.2139711818 | ||
Registrant Fax: | ||
Registrant Email: gtlds-rio@registro.br | ||
Admin ID: C4R3-NICBR | ||
Admin Name: Empresa Municipal de Informatica SA - IPLANRIO | ||
Admin Organization: 73.214.439/0001-90 | ||
Admin Street: Av. Presidente Vargas 3131 Sala 1204 | ||
Admin City: Rio de Janeiro | ||
Admin State/Province: RJ | ||
Admin Postal Code: 20210-030 | ||
Admin Country: BR | ||
Admin Phone: +55.2139711818 | ||
Admin Fax: | ||
Admin Email: gtlds-rio@registro.br | ||
Tech ID: C4R3-NICBR | ||
Tech Name: Empresa Municipal de Informatica SA - IPLANRIO | ||
Tech Organization: 73.214.439/0001-90 | ||
Tech Street: Av. Presidente Vargas 3131 Sala 1204 | ||
Tech City: Rio de Janeiro | ||
Tech State/Province: RJ | ||
Tech Postal Code: 20210-030 | ||
Tech Country: BR | ||
Tech Phone: +55.2139711818 | ||
Tech Fax: | ||
Tech Email: gtlds-rio@registro.br | ||
Name Server: ns.dns.br | ||
Name Server: ns2.dns.br | ||
DNSSEC: signedDelegation | ||
|
||
>>> Last update of WHOIS database: 2016-07-20T18:04:56Z <<< | ||
|
||
For more information on Whois status codes, please visit https://icann.org/epp | ||
|
||
% The queried data can only be used for technical or | ||
% administrative requirements associated with the Internet | ||
% or in order to contact the domain or block holder over | ||
% legal problems, being prohibited the distribution, | ||
% repackaging, modification, comercialization or | ||
% reproduction, in particular, to use it for advertising or | ||
% any similar purpose; | ||
% | ||
% Any prohibited use or harvesting, may cause, without | ||
% previous warning, access restriction, without prejudice | ||
% of future legal action. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'spec_helper' | ||
|
||
describe Whois::Server::Adapters::Nicbr do | ||
|
||
let(:definition) { [:tld, ".test", "whois.gtlds.nic.br", {}] } | ||
let(:server) { described_class.new(*definition) } | ||
|
||
|
||
describe "#lookup" do | ||
context "without referral" do | ||
it "returns the WHOIS record" do | ||
response = "No match for example.test." | ||
expected = response | ||
expect(server.query_handler).to receive(:call).with("example.test", "whois.gtlds.nic.br", 43).and_return(response) | ||
|
||
record = server.lookup("example.test") | ||
expect(record.to_s).to eq(expected) | ||
expect(record.parts.size).to eq(1) | ||
expect(record.parts).to eq([Whois::Record::Part.new(body: response, host: "whois.gtlds.nic.br")]) | ||
end | ||
end | ||
|
||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters