Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

query returns plain text and no whois::answer object #12

Closed
gucki opened this Issue Feb 13, 2010 · 4 comments

Comments

Projects
None yet
2 participants

gucki commented Feb 13, 2010

No description provided.

gucki commented Feb 13, 2010

Using one of your examples and version 1.0.2:

Loading development environment (Rails 2.3.5)
** Erubis 2.6.5

w = Whois::Client.new
=> #<Whois::Client:0x7f5fda722c98 @timeout=10>
w.query("74.125.67.100")
=> "\nOrgName: Google Inc. \nOrgID: GOGL\nAddress: 1600 Amphitheatre Parkway\nCity: Mountain View\nStateProv: CA\nPostalCode: 94043\nCountry: US\n\nNetRange: 74.125.0.0 - 74.125.255.255 \nCIDR: 74.125.0.0/16 \nNetName: GOOGLE\nNetHandle: NET-74-125-0-0-1\nParent: NET-74-0-0-0-0\nNetType: Direct Allocation\nNameServer: NS1.GOOGLE.COM\nNameServer: NS2.GOOGLE.COM\nNameServer: NS3.GOOGLE.COM\nNameServer: NS4.GOOGLE.COM\nComment: \nRegDate: 2007-03-13\nUpdated: 2007-05-22\n\nOrgTechHandle: ZG39-ARIN\nOrgTechName: Google Inc. \nOrgTechPhone: +1-650-318-0200\nOrgTechEmail: arin-contact@google.com\n\n# ARIN WHOIS database, last updated 2010-02-12 20:00\n# Enter ? for additional hints on searching ARIN's WHOIS database.\n#\n# ARIN WHOIS data and services are subject to the Terms of Use\n# available at https://www.arin.net/whois_tou.html\n"

Owner

weppos commented Feb 13, 2010

The code you posted works perfectly. Whois::Answer acts as a String and its representation is almost exactly as a String.

Look at this

w = Whois::Client.new
w.query("74.125.67.100").class
# => Whois::Answer

gucki commented Feb 13, 2010

ok, your are right - sorry for the false bug report! but I wonder how to get for example the contact details for the query above?

a.contact
NoMethodError: undefined method contact' for #<Whois::Answer:0x7fde98000158> from /var/lib/gems/1.8/gems/whois-1.0.2/lib/whois/answer.rb:154:inmethod_missing'
from (irb):6

a.contacts
NoMethodError: undefined method contacts' for #<Whois::Answer:0x7fde98000158> from /var/lib/gems/1.8/gems/whois-1.0.2/lib/whois/answer.rb:154:inmethod_missing'
from (irb):7

Owner

weppos commented Feb 13, 2010

A Whois::Answer object responds to 3 "contact" methods:

  • registrant
  • admin
  • technical

For instance, you can get technical details with

w = Whois::Client.new
w.query("74.125.67.100").technical

In order to access response as an object, a parser needs to be available for the hostname which handle the Whois request.
Unfortunately, in your case there's no parser for whois.arin.net yet. This is the reason why the code above will return nil.

Here's an example with a supported server

w = Whois::Client.new
w.query("google.it").technical

tpalmer pushed a commit to tpalmer/whois that referenced this issue Oct 10, 2012

Merge pull request #12 from cramerdev/rrpproxy
Create whois.rrpproxy.net parser

This issue was closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment