weppos / whois-parser

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

Retrieving contacts when executing WHOIS command on French domains results in an error #158

Open ibalosh opened 1 year ago

ibalosh commented 1 year ago

Steps to reproduce

require "whois-parser"

response = Whois.whois("google.fr")
parser = response.parser
parser.contacts

Error message

...whois-parser-2.0.0/lib/whois/parsers/base_nic_fr.rb:139:in 
`utc': invalid value for Integer(): "2022-10-15T05:41:14.918179Z" (ArgumentError)

updated_on = values["changed"] ? Time.utc(*values["changed"].split(" ").first.split("/").reverse) : nil

Environment

Ruby: ruby-3.2.2 [ arm64 ] Gem version: latest whois (5.1.0), whois-parser (2.0.0)

Note

When using ruby-3.0.0 [ arm64 ] , error will not be thrown.

jarthod commented 1 year ago

@ibalosh this gem is not maintained at the moment so after asking the maintainer I ended up starting my fork in which I merged some of the pending PRs and provided a lot more fixes. This issue is not present in my fork:

irb(main):001:0> require "whois-parser"
=> true
irb(main):002:0> 
irb(main):003:0> response = Whois.whois("google.fr")
irb(main):004:0> parser = response.parser
=> 
#<Whois::Parser:0x00007efcb86b56c8
...
irb(main):005:0> parser.contacts
=> 
[#<struct Whois::Parser::Contact
  id="GIHU100-FRNIC",
  type=1,
  city=nil,
  zip=nil,
  state=nil,
  country=nil,
  country_code="IE",
  phone="+353.14361000",
  fax=nil,
  email="dns-admin@google.com",
  url=nil,
  created_on=nil,
  updated_on=Sat, 15 Oct 2022 05:41:14.000000000 UTC +00:00>,
 #<struct Whois::Parser::Contact
  id="GIHU101-FRNIC",
  type=2,
  name=nil,
  organization="Google Ireland Holdings Unlimited Company",
  address="70 Sir John Rogerson's Quay\n2 Dublin",
  city=nil,
  zip=nil,
  state=nil,
  country=nil,
  country_code="IE",
  phone="+353.14361000",
  fax=nil,
  email="dns-admin@google.com",
  url=nil,
  created_on=nil,
  updated_on=nil>,
 #<struct Whois::Parser::Contact
  id="MI3669-FRNIC",
  type=3,
  name=nil,
  organization="MarkMonitor Inc.",
  address="2150 S. Bonito Way, Suite 150\n83642 Meridian",
  city=nil,
  zip=nil,
  state=nil,
  country=nil,
  country_code="US",
  phone="+1.2083895740",
  fax="+1.2083895771",
  email="ccops@markmonitor.com",
  url=nil,
  created_on=nil,
  updated_on=Tue, 01 Aug 2023 16:08:06.000000000 UTC +00:00>]

So you can use my fork in the meantime and hopefully one day we'll be able to merge upstream:

gem 'whois-parser', github: 'jarthod/whois-parser' # Unofficial but more up-to-date fork, check status at https://github.com/jarthod/whois-parser