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 is converted into a pure Ruby object and can be easily printed or manipulated using the Ruby programming language.

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.

It means you can easily 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 'rubygems'
require 'whois'

r = Whois.whois("google.com")
r.nameservers.each do |nameserver|
  puts nameserver

# => ns1.google.com
# => ns2.google.com
# => ns3.google.com
# => ns4.google.com