Welcome
Whois is an intelligent — pure Ruby — WHOIS client and parser.
It exposes an object oriented Ruby API to look up WHOIS information contained in the databases maintained by the Network Information Centers (NICs). The response data can be manipulated directly, or parsed into Ruby data structures using the optional parser dependency.
It also offers command-line interface to run WHOIS queries from the console.
What is a WHOIS?
As explained by Wikipedia, WHOIS is a query/response protocol that is widely used for querying databases in order to determine the registrant or assignee of Internet resources, such as a domain name or an IP address.
Using the WHOIS protocol you can obtain information about a specific domain name, TLD or IP address including:
- the object owner and additional contacts
- the object registrar
- the name servers assigned to the object
- the creation and expiration dates
The final data available in a WHOIS response is not a standard. The effective availability of the information above depends on the Authority in charge of the object assignation (NIC).
Why Intelligent?
Whois is an intelligent because it automatically tries to guess the right server to query for the specified object.
The intelligent definition is borrowed from the Debian Whois client which influenced the design of the client/server architecture.
Why Parser?
Whois is more than a WHOIS client. It also includes a huge set of data parsers which converts a raw registry response into a pure Ruby object. As version 4 the parser component is available as a standalone library called Whois Parser.
The Whois Parser library allows you to extract and access WHOIS information using Ruby methods and classes.
For instance, to print all the name servers for a specific WHOIS record you can write:
# Example: Fetching nameservers property from a Whois::Record
require 'whois-parser'
record = Whois.whois("google.com")
parser = record.parser
parser.nameservers.each do |nameserver|
puts nameserver
end
# => ns1.google.com
# => ns2.google.com
# => ns3.google.com
# => ns4.google.com
RubyGems
Both Whois and Whois Parsers are packaged as Ruby gems, and distributed using the Ruby standard package manager RubyGems.
The name of the packages, that will also be consistently reused in this documentation to reference the libraries is:
whois
for the Whois librarywhois-parser
for the Whois Parser library