Whois is an intelligent pure Ruby WHOIS client and parser.
It is a OS-independent library and doesn't require external C libraries or Gems: it is a 100% Ruby software with all the advantages and disadvantages that it involves. This software was developed to power RoboDomain and it eventually become a standalone library.
Whois provides the following key features:
- Ability to query registry data for IPv4, IPv6, TLDs, and domain names
- Ability to parse WHOIS responses
- Flexible and extensible interface (e.g. You can define custom servers on the fly)
- Object oriented design, featuring 10 different design patterns
- Pure Ruby library, without any external dependency other than Ruby itself
- Compatible with Ruby 1.8.6 and greater, including Ruby 1.9 branch
- Successfully tested against several Ruby implementations, including Ruby, Ruby Enterprise Edition, JRuby, and MacRuby
Whois 1.0
Whois 1.0 is the first major release since I started working on the library one year ago. It reached an high level of maturity and stability and you can safely consider it production ready.
Compared with previous version, Whois 1.0 includes a really huge CHANGELOG (more than 100 lines!). The most important features are:
- Updates to existing definitions
- 48 New WHOIS Parsers
- Ability to check whether a property is set
- Command Line Improvements
- Changes to the internal Answer/Parser architecture to improve usability
Last but not least, a dedicated site is now available at whoisrb.org.
A Retrospective
Whois 1.0 is a really important milestone. The first Whois release was just another WHOIS library. Yes, it offered support for all existing TLDs, but that was just the beginning. My idea was to creare a library to be able to parse and access all WHOIS responses with a single, standardized, object oriented API.
The current Whois library perfectly fit this milestone. Unfortunately, there's still a big number of unsupported server, but I'm working really hard to reduce the gap. Also, in the last months a small number of users contributed back with servers, patches, changes and I'm really grateful to them.
If you look at the CHANGELOG, Whois has improved day after day.
The Client side
Whois 1.0 is a pure Ruby WHOIS client. It means you can install and use it on any platform where Ruby is supported, including (but not limited to) Microsoft Windows, Linux, MacOSX and Solaris.
This is one of the most important feature, compared with other WHOIS libraries. Whois is shipped with a Command Line Interface you can use to lookup a domain.
$ ruby-whois google.com
And this works on Windows too!
Whois is an intelligent Whois client. It means, you don't need to know anything about WHOIS, Dns or TLD. Simply feed the client with the domain you want to lookup, and wait for the response.
require 'rubygems'
require 'whois'
a = Whois.query "google.com"
puts a
Whois will automatically choose the best WHOIS server according to the given query. If the query is a domain, Whois will try to find a server for the corresponding TLD. If the query is an IPv4 or IPv6, Whois will send the request to the corresponding management authority.
TLD and IP definitions are included in the package and read when the library is loaded. You can always update/change them at runtime.
The Parser side
Until now, Whois just seems to be an other powerful-but-standard WHOIS client. But this is not true.
The biggest difference between Whois and other WHOIS libraries, is that Whois can parse and decompose a raw WHOIS response into a powerful Ruby object. This means, you can access WHOIS property calling a simple method rather than dealing with complex regular expressions in order to extract the data you need.
require 'rubygems'
require 'whois'
a = Whois.query "google.it"
puts a.available?
# => false
a.nameservers.each do |nameserver|
puts nameserver
end
# => ns1.google.com
# => ns4.google.com
# => ns2.google.com
# => ns3.google.com
puts a.created_on
# => Fri Dec 10 00:00:00 +0100 1999
puts a.expires_on
# => Sat Nov 27 00:00:00 +0100 2010
You can read more at whoisrb.org.
RoboDomain
Whois library has been creates to power RoboDomain project. With Robodomain you can keep track of any domain in one single place: log transactions, store notes, check domain status and enjoy our network tools.
Be sure to signup for an invitation code if you want to join the beta program.
Contribute
Whois is an open source project and released under the terms of the MIT license.
You can contribute by suggesting new features and reporting bugs or you can fork away the project and submit your changes.
Do you have a question? Need an help with the library? Join the discussion group.
Enjoy Ruby Whois 1.0.
$ gem install whois