likexian / whois-parser

Whois parser for domain whois information parsing in Go(Golang).
Apache License 2.0
284 stars 86 forks source link

Incorrect registration date result #74

Closed nbanmp closed 6 months ago

nbanmp commented 9 months ago
% whois contosocorporation.com whois.iana.org | grep created
created:      1985-01-01
created:      1985-01-01
% whois contosocorporation.com whois.iana.org | grep "Creation Date"
Creation Date: 2022-05-07T20:55:28Z
Creation Date: 2022-05-07T20:55:28.00Z

It looks like the last created result is overwriting the actual registration date of the domain, whois-parser is returning 1984-01-01. My hacky suggestion would to be to ignore dates that are exactly 1985-01-01, if you don't have a clearly better solution.

This has happened with multiple domains, when the whois server is whois.iana.org

likexian commented 6 months ago

Hello @nbanmp The whois data in IANA WHOIS server is not the domain whois data, but of tld whois data.


If you think this repository is helpful, please share it with friends, thanks.

nbanmp commented 6 months ago

@likexian The Creation Date response from whois.iana.org is the creation date for the domain itself. created is the tld whois data. This parser doesn't correctly differentiate between whether it's supposed to be returning tld whois data or domain whois data, so some of the parsed data is from the tld, and some is for the domain.

More info:

The bug is caused because whois-parser will map multiple fields to created_date. For whois.iana.org, created is not the domain whois data, but creation date is. And only the first match for created_date is used.

https://github.com/likexian/whois-parser/blob/aac2045f6faaa237831d7759a49354fe1950cf48/rule.go#L55-L72

https://github.com/likexian/whois-parser/blob/aac2045f6faaa237831d7759a49354fe1950cf48/parser.go#L128-L134

likexian commented 6 months ago

Please try this whois client: https://github.com/likexian/whois .


If you think this repository is helpful, please share it with friends, thanks.

nbanmp commented 6 months ago

@likexian I had been using that client. Is there a reason the whois CLI client would be significantly different?

likexian commented 6 months ago

@likexian I had been using that client. Is there a reason the whois CLI client would be significantly different?

Yes, some whois client mixed all content togther.


If you think this repository is helpful, please share it with friends, thanks.