weppos / whois-parser

An intelligent — pure Ruby — WHOIS parser.
https://whoisrb.org
MIT License
99 stars 102 forks source link

Fails to parse gov.gi Unexpected token #127

Open The-Nutty opened 4 years ago

The-Nutty commented 4 years ago

When attempting to parse the response for gibraltar.gov.gi from whois.afilias-grs.info you get an Unexpected token error.

Running the code

require 'whois'
require 'whois-parser'

whois = Whois::Client.new
record =  whois.lookup("gibraltar.gov.gi")

parser = record.parser

puts parser.available?

Fails with the following error

Traceback (most recent call last):
        9: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
        8: from <internal:gem_prelude>:2:in `require'
        7: from D:/Ruby26-x64/lib/ruby/2.6.0/rubygems.rb:1375:in `<top (required)>'
        6: from D:/Ruby26-x64/lib/ruby/2.6.0/rubygems.rb:1375:in `require'
        5: from D:/Ruby26-x64/lib/ruby/2.6.0/rubygems/defaults/operating_system.rb:1:in `<top (required)>'
        4: from D:/Ruby26-x64/lib/ruby/2.6.0/rubygems/defaults/operating_system.rb:1:in `require'
        3: from D:/Ruby26-x64/lib/ruby/site_ruby/2.6.0/ruby_installer/runtime.rb:1:in `<top (required)>'
        2: from D:/Ruby26-x64/lib/ruby/site_ruby/2.6.0/ruby_installer/runtime.rb:2:in `<module:RubyInstaller>'
        1: from D:/Ruby26-x64/lib/ruby/site_ruby/2.6.0/ruby_installer/runtime.rb:15:in `<module:Runtime>'
D:/Ruby26-x64/lib/ruby/site_ruby/2.6.0/ruby_installer/runtime.rb:15:in `require': Interrupt
PS D:\other code\rb>
PS D:\other code\rb> ruby .\thing.rb
Traceback (most recent call last):
        15: from ./thing.rb:10:in `<main>'
        14: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/parser.rb:348:in `method_missing'
        13: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/parser.rb:327:in `available?'
        12: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/parser.rb:361:in `delegate_property_to_parsers'
        11: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/parsers/base.rb:240:in `available?'
        10: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/parsers/base.rb:396:in `handle_property'
         9: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/parsers/base.rb:371:in `cached_properties_fetch'
         8: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/parsers/base.rb:398:in `block in handle_property'
         7: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/parsers/base_afilias.rb:45:in `block in <class:BaseAfilias>'
         6: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/scanners/scannable.rb:42:in `node'
         5: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/scanners/scannable.rb:59:in `ast'
         4: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/scanners/scannable.rb:53:in `parse'
         3: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/scanners/base.rb:29:in `parse'
         2: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/scanners/base.rb:102:in `tokenize'
         1: from D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/scanners/base.rb:106:in `unexpected_token'
D:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/whois-parser-1.2.0/lib/whois/scanners/base.rb:110:in `error!': Unexpected token: Access to WHOIS information is provided to assist persons in determining the contents of a domain name registration record in the registry database. The data in this record is provided by The Registry Operator for informational purposes only, and accuracy is not guaranteed.  This service is intended only for query-based access. You agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to (a) allow, enable, or otherwise support the transmission by e-mail, telephone, or facsimile of mass unsolicited, commercial advertising or solicitations to entities other than the data recipient's own existing customers; or (b) enable high volume, automated, electronic processes that send queries or data to the systems of Registry Operator, a Registrar, or Afilias except as reasonably necessary to register domain names or modify existing registrations. All rights reserved. Registry Operator reserves the right to modify these terms at any time. By submitting this query, you agree to abide by this policy. (Whois::ParserError)

The Registrar of Record identified in this output may have an RDDS service that can be queried for additional information on how to contact the Registrant, Admin, or Tech contact of the queried domain name.