elceef / dnstwist

Domain name permutation engine for detecting homograph phishing attacks, typo squatting, and brand impersonation
https://dnstwist.it
Apache License 2.0
4.85k stars 767 forks source link

Ignore return code on whois #197

Closed nuno-andre closed 1 year ago

nuno-andre commented 1 year ago

The whois command uses getaddrinfo to perform a domain name resolution on the NIC server. This may cause errors in mistakenly registered domains and cause whois.query() to break.

Ignoring the return code allows you to retrieve the previously parsed information. E.g. (on a Rocky Linux 9.1)

>>> import whois
>>> q = whois.query('deamsa.com')
...
whois.exceptions.WhoisCommandFailed: getaddrinfo(https://www.arsys.es/dominios/whois): Name or service not known
...
>>> q = whois.query('deamsa.com', ignore_returncode=True)
>>> q.creation_date
datetime.datetime(2000, 1, 31, 9, 43, 41)
>>> q.registrar
'Arsys Internet, S.L. dba NICLINE.COM'