Skip to content
New issue

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

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parser apparently doesnt work for Ipv4 addresses #162

Open
maaz-munir opened this issue Jul 28, 2024 · 3 comments
Open

Parser apparently doesnt work for Ipv4 addresses #162

maaz-munir opened this issue Jul 28, 2024 · 3 comments

Comments

@maaz-munir
Copy link

Is there not a parser for ipv4 whois records?

This is the code i am currently trying to run to output the properties returned from the parser.

client = Whois::Client.new(:timeout => 40)
domain = client.lookup("1.1.1.1")
p = domain.parser
msg = {}    
puts "Parser class: #{p.class}"

Whois::Parser::PROPERTIES.each do |x_prop|
  begin
     value = p.send(x_prop)
      puts "Property #{x_prop}: #{value.inspect}"
      msg[x_prop] = value if value
  rescue => e
    puts "Error accessing #{x_prop}: #{e.message}"
  end
end 

puts "Final msg: #{msg.inspect}"

And it returns unable to return a parser for property [disclaimer(example)]

This works fine for domains.

@jarthod
Copy link

jarthod commented Jul 28, 2024

For IPs it would be more robust to use RDAP instead anyway (see https://github.com/jarthod/rdap)
As the whois-parser project will never be able to support and maintain all whois server formats in existence.
And unlike domains, all IPs are supported by RDAP already.

@maaz-munir
Copy link
Author

Thanks! I'm still new to this, i'll look into the RDAP protocol.
But in theory shouldn't there be only 5 WHOIS server formats - corresponding to the relevant RIRs? Or am I missing something

@jarthod
Copy link

jarthod commented Jul 29, 2024

I think you are right, but that's still 5 more parsers to maintain. If you want to contribute them feel free but @weppos stopped maintaining this gem so you can't get the fix upstream AFAIK. I maintain a fork in https://github.com/jarthod/whois-parser which is much more up-to-date, but I personally use it as fallback only for TLD which do not support RDAP yet. So I believe for a use-case (IP only) which is already 100% supported by RDAP (I haven't tested all IPs but I think it is), it would be much easier and more reliable to use RDAP (you get structured and machine-readable JSON instead of text intended for human eyes).

Nonetheless if for some reason you prefer to implement the whois parser for RIR IPs, I'll happily accept a PR in my fork :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants