Coder Social home page Coder Social logo

mlightner / universal_ruby_whois Goto Github PK

View Code? Open in Web Editor NEW
42.0 3.0 15.0 147 KB

A module that attempts to act as a universal WHOIS output interpreter allowing you to get information about most domain name extensions.

Home Page: http://mattlightner.com/blog/a-universal-whois-client-for-ruby/

License: MIT License

Ruby 100.00%

universal_ruby_whois's Introduction

Universal Whois Server

Author: Matt Lightner <[email protected]>

License: MIT

RDoc: universalwhois.rubyforge.org

*RubyForge URL*: rubyforge.org/projects/universalwhois

*GitHub URL*: github.com/mlightner/universal_ruby_whois/tree/master

This library attempts to interpret WHOIS output from a variety of different registrars. The ultimate goal is to have a complete “dictionary” of all of the TLD registrars (including double domain TLDs such as .co.uk) on the Internet, and corresponding regular expressions to parse the unique output format for each one.

This package requires a command line whois utility to retrieve output. It will then attempt to interpret that output based on a series of regular expressions.

DEFINING WHOIS SERVERS

Whois servers can be defined on a per-TLD basis, so each registrar can have a unique set of regular expressions to match its particular output format. Whois servers are defined in the file server_list.rb.

If you’re using this module and come across a TLD that isn’t yet supported or isn’t working quite right, I highly encourage you to fork the project and commit your updates. The more people we have working on the list, the more comprehensive and effective it becomes!

TLD SEARCH PRIORITY

When deciding which whois server to use, the script will always choose the most specific server entry it can find. For instance, if you have defined a server for .uk domains, but also a server for .co.uk domains, the domain name “test.co.uk” will always use the latter whois server.

EXAMPLE USAGE

Here is the output from a sample IRB session using this library:

require 'universal_ruby_whois'
=> true
domain = Whois.find("mattlightner.com")
=> #<Whois::Domain:0xb7a3b014 @domain="mattlightner.com", @server_tld_key="com">
domain.status
=> :registered
domain.available?
=> false
domain.registered?
=> true
domain.creation_date
=> Mon Aug 28 00:00:00 EDT 2006
domain.expiration_date
=> Fri Aug 28 00:00:00 EDT 2009
domain = Whois.find("9384jf398ejf9832ej.com")            
=> #<Whois::Domain:0xb7a1ab34 @domain="9384jf398ejf9832ej.com", @server_tld_key="com">
domain.status      
=> :free

NOTES

Some registrars are relatively unreliable or may add a server to a blacklist after a certain number of queries. In particular, the registrars for these domains:

  • es and related TLDs: They only provide an HTTP whois access interface, which is unreliable at best (although this module supports HTTP lookups quite well).

  • asn.au com.au id.au net.au org.au: ‘whois.aunic.net’, seems as though they will blacklist a server making too many queries. Not sure about their blacklist removal policy.

TODO

  • Add better support for creation date parsing for major registrars.

  • Find a more reliable way to look up domains from registrars not providing a whois server.

CONTRIBUTIONS

Contribution is encouraged! Grab the source from: git://github.com/mlightner/universal_ruby_whois.git

universal_ruby_whois's People

Contributors

atourino avatar jjohnsen avatar mlightner avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

universal_ruby_whois's Issues

activesupport dependency with rails 3

Hi, I'm trying update a rails 2.0.2 to rails 3.0.7 and I get this problem when I add the lib as a plugin:

.rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in require': no such file to load -- activesupport (LoadError) from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency' from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:innew_constants_in'
from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency' from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from Sites/project/vendor/plugins/universal_ruby_whois/lib/universal_ruby_whois.rb:2
from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in require' from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency' from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:innew_constants_in'
from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency' from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from Sites/project/vendor/plugins/universal_ruby_whois/init.rb:3
from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/plugin.rb:81
from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/initializable.rb:25:in instance_exec' from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/initializable.rb:25:inrun'
from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/initializable.rb:50:in run_initializers' from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/initializable.rb:49:ineach'
from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/initializable.rb:49:in run_initializers' from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/application.rb:134:ininitialize!'
from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/application.rb:77:in send' from .rvm/gems/ruby-1.8.7-p330@project/gems/railties-3.0.7/lib/rails/application.rb:77:inmethod_missing'
from Sites/project/config/environment.rb:5
from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in require' from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency' from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:innew_constants_in'
from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in load_dependency' from .rvm/gems/ruby-1.8.7-p330@project/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:inrequire'
from Sites/project/config.ru:3
from .rvm/gems/ruby-1.8.7-p330@project/gems/rack-1.2.2/lib/rack/builder.rb:46:in instance_eval' from .rvm/gems/ruby-1.8.7-p330@project/gems/rack-1.2.2/lib/rack/builder.rb:46:ininitialize'
from Sites/project/config.ru:1:in `new'
from Sites/project/config.ru:1

I notice there is a require 'activesupport' here universal_ruby_whois/lib/universal_ruby_whois.rb:2
There is any way to fix this problem???

Thanks

problem of some domains

It's cool library! But I have a problem for some domains.

$ irb

irb(main):001:0> require 'rubygems'

=> true

irb(main):002:0> require 'universal_ruby_whois'

=> true

irb(main):003:0> d = Whois.find("google.co.jp")

=> #<Whois::Domain:0xb7993da4 @Domain="google.co.jp", @server_tld_key="co.jp">

irb(main):004:0> d.registered?

=> true

irb(main):005:0> d.creation_date

=> nil

irb(main):006:0>

Correct value of creation_date is 2001/03/22.

I found same problems for *.ne.jp (ex. goo.ne.jp).
What's wrong??

Domains with multiple TLD entries don't show creation/expiration dates

Doing a query with a domain like yahoo.com or google.com can give back a bunch of entries, like this:

YAHOO.COM.ZZZZZZ.MORE.INFO.AT.WWW.BEYONDWHOIS.COM
YAHOO.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM
YAHOO.COM.ZZZZZ.DOWNLOAD.MOVIE.ONLINE.ZML2.COM
YAHOO.COM.ZOMBIED.AND.HACKED.BY.WWW.WEB-HACK.COM
YAHOO.COM.VN
YAHOO.COM.VIRGINCHASSIS.COM
YAHOO.COM.TWIXTEARS.COM
YAHOO.COM.TW
YAHOO.COM.SG
YAHOO.COM.MX
YAHOO.COM.MORE.INFO.AT.WWW.BEYONDWHOIS.COM
YAHOO.COM.JTNELECTRIC.COM
YAHOO.COM.JENNINGSASSOCIATES.NET
YAHOO.COM.IS.N0T.AS.1337.AS.SEARCH.GULLI.COM
YAHOO.COM.HK
YAHOO.COM.ELPOV.COM
YAHOO.COM.EATINGFORJOY.NET
YAHOO.COM.DALLARIVA.COM
YAHOO.COM.CHRISIMAMURAPHOTOWORKS.COM
YAHOO.COM.BR
YAHOO.COM.BGPETERSON.COM
YAHOO.COM.AU
YAHOO.COM

When a domain gives entries like this, the creation and expiration dates can't be found. Is there a way to query only for YAHOO.COM and ignore the others?

Some whois servers tell you this:

To single out one record, look it up with "xxx", where xxx is one of the
of the records displayed above. If the records are the same, look them up
with "=xxx" to receive a full display for each record.

But I haven't been able to do this from the ruby client.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.