jschauma / jswhois

whois lookup results in json format
Other
71 stars 4 forks source link

jwhois doesn't notify if a domain isn't found. #4

Open bdmorin opened 1 month ago

bdmorin commented 1 month ago

I get output no matter what domain, and it's not saying the domain isn't found.

❯ ./jswhois jdfskjfdk32849329.com
[{"chain":["whois.iana.org","whois.verisign-grs.com"],"query":"jdfskjfdk32849329.com","whois.iana.org":{"contact":[{"address":["12061 Bluemont Way","Reston VA 20190","United States of America (the)"],"contact":"administrative","e-mail":"info@verisign-grs.com","fax-no":"+1 703 948 3978","name":"Registry Customer Service","organisation":"VeriSign Global Registry Services","phone":"+1 703 925-6999"},{"address":["12061 Bluemont Way","Reston VA 20190","United States of America (the)"],"contact":"technical","e-mail":"info@verisign-grs.com","fax-no":"+1 703 948 3978","name":"Registry Customer Service","organisation":"VeriSign Global Registry Services","phone":"+1 703 925-6999"}],"created":{"changed":"2023-12-07","created":"1985-01-01","source":"IANA"},"domain":"COM","nserver":{"ds-rdata":"19718 13 2 8acbb0cd28f41250a80a491389424d341522d946b0da0c0291f2d3d771d7805a","nserver":{"A.GTLD-SERVERS.NET":["192.5.6.30","2001:503:a83e:0:0:0:2:30"],"B.GTLD-SERVERS.NET":["192.33.14.30","2001:503:231d:0:0:0:2:30"],"C.GTLD-SERVERS.NET":["192.26.92.30","2001:503:83eb:0:0:0:0:30"],"D.GTLD-SERVERS.NET":["192.31.80.30","2001:500:856e:0:0:0:0:30"],"E.GTLD-SERVERS.NET":["192.12.94.30","2001:502:1ca1:0:0:0:0:30"],"F.GTLD-SERVERS.NET":["192.35.51.30","2001:503:d414:0:0:0:0:30"],"G.GTLD-SERVERS.NET":["192.42.93.30","2001:503:eea3:0:0:0:0:30"],"H.GTLD-SERVERS.NET":["192.54.112.30","2001:502:8cc:0:0:0:0:30"],"I.GTLD-SERVERS.NET":["192.43.172.30","2001:503:39c1:0:0:0:0:30"],"J.GTLD-SERVERS.NET":["192.48.79.30","2001:502:7094:0:0:0:0:30"],"K.GTLD-SERVERS.NET":["192.52.178.30","2001:503:d2d:0:0:0:0:30"],"L.GTLD-SERVERS.NET":["192.41.162.30","2001:500:d937:0:0:0:0:30"],"M.GTLD-SERVERS.NET":["192.55.83.30","2001:501:b1f9:0:0:0:0:30"]}},"organisation":{"address":["12061 Bluemont Way","Reston VA 20190","United States of America (the)"],"organisation":"VeriSign Global Registry Services"},"refer":"whois.verisign-grs.com","status":{"remarks":"Registration information: http://www.verisigninc.com","status":"ACTIVE"},"whois":"whois.verisign-grs.com"},"whois.verisign-grs.com":{}}]

Regular whois:

❯ whois jdfskjfdk32849329.com
% IANA WHOIS server
% for more information on IANA, visit http://www.iana.org
% This query returned 1 object

refer:        whois.verisign-grs.com

domain:       COM

organisation: VeriSign Global Registry Services
address:      12061 Bluemont Way
address:      Reston VA 20190
address:      United States of America (the)

contact:      administrative
name:         Registry Customer Service
organisation: VeriSign Global Registry Services
address:      12061 Bluemont Way
address:      Reston VA 20190
address:      United States of America (the)
phone:        +1 703 925-6999
fax-no:       +1 703 948 3978
e-mail:       info@verisign-grs.com

contact:      technical
name:         Registry Customer Service
organisation: VeriSign Global Registry Services
address:      12061 Bluemont Way
address:      Reston VA 20190
address:      United States of America (the)
phone:        +1 703 925-6999
fax-no:       +1 703 948 3978
e-mail:       info@verisign-grs.com

nserver:      A.GTLD-SERVERS.NET 192.5.6.30 2001:503:a83e:0:0:0:2:30
nserver:      B.GTLD-SERVERS.NET 192.33.14.30 2001:503:231d:0:0:0:2:30
nserver:      C.GTLD-SERVERS.NET 192.26.92.30 2001:503:83eb:0:0:0:0:30
nserver:      D.GTLD-SERVERS.NET 192.31.80.30 2001:500:856e:0:0:0:0:30
nserver:      E.GTLD-SERVERS.NET 192.12.94.30 2001:502:1ca1:0:0:0:0:30
nserver:      F.GTLD-SERVERS.NET 192.35.51.30 2001:503:d414:0:0:0:0:30
nserver:      G.GTLD-SERVERS.NET 192.42.93.30 2001:503:eea3:0:0:0:0:30
nserver:      H.GTLD-SERVERS.NET 192.54.112.30 2001:502:8cc:0:0:0:0:30
nserver:      I.GTLD-SERVERS.NET 192.43.172.30 2001:503:39c1:0:0:0:0:30
nserver:      J.GTLD-SERVERS.NET 192.48.79.30 2001:502:7094:0:0:0:0:30
nserver:      K.GTLD-SERVERS.NET 192.52.178.30 2001:503:d2d:0:0:0:0:30
nserver:      L.GTLD-SERVERS.NET 192.41.162.30 2001:500:d937:0:0:0:0:30
nserver:      M.GTLD-SERVERS.NET 192.55.83.30 2001:501:b1f9:0:0:0:0:30
ds-rdata:     19718 13 2 8acbb0cd28f41250a80a491389424d341522d946b0da0c0291f2d3d771d7805a

whois:        whois.verisign-grs.com

status:       ACTIVE
remarks:      Registration information: http://www.verisigninc.com

created:      1985-01-01
changed:      2023-12-07
source:       IANA

# whois.verisign-grs.com

No match for domain "JDFSKJFDK32849329.COM".
>>> Last update of whois database: 2024-05-24T17:14:29Z <<<

No match for domain "JDFSKJFDK32849329.COM".

I don't know if this is intentional or a bug.

I guess the lack of a nameserver might be a clue, but it's not obvious.

valid domain

json[0]["whois.verisign-grs.com"]["Name Server"][0] = "ELISA.NS.CLOUDFLARE.COM";
json[0]["whois.verisign-grs.com"]["Name Server"][1] = "GIANCARLO.NS.CLOUDFLARE.COM";

Cool tool though, thank you!

jschauma commented 1 month ago

Hey, thanks for the report. I think this is kinda in between a bug and intended: it can be useful to get whatever information is in whois even if the name doesn't resolve (or isn't an IP address), but I also can see how one might want the tool to bail out early.

So I just committed https://github.com/jschauma/jswhois/commit/18bd02c9bff9e86985627d6d60cbb9dc1ed9bcf7, which checks at start time if the given argument is either an IP address or resolves; if neither is the case, we bail. But the user can override this using a new '-f' flag if they really want the whois query to be sent anyway.

Does that sound reasonable?

bdmorin commented 1 month ago

I'll recompile on Tuesday, I'm sure it's fine, thank you!