elceef / dnstwist

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

Do not fail if whois.query returns None #115

Closed bayandin closed 3 years ago

bayandin commented 3 years ago

This PR adds handling for None from whois.query (it looks like this is a legit behaviour https://github.com/DannyCork/python-whois/blob/0.9.7/whois/__init__.py#L73)

Originally, the error was caught in one of Homebrew CI runs:

==> /usr/local/Cellar/dnstwist/20201022/bin/dnstwist -rsw --thread=1 brew.sh
Traceback (most recent call last):
  File "/usr/local/Cellar/dnstwist/20201022/libexec/bin/dnstwist", line 962, in <module>
    main()
  File "/usr/local/Cellar/dnstwist/20201022/libexec/bin/dnstwist", line 936, in main
    if whoisq.creation_date:
AttributeError: 'NoneType' object has no attribute 'creation_date'
     _           _            _     _
  __| |_ __  ___| |___      _(_)___| |_
 / _` | '_ \/ __| __\ \ /\ / / / __| __|
| (_| | | | \__ \ |_ \ V  V /| \__ \ |_
 \__,_|_| |_|___/\__| \_/\_/ |_|___/\__| {20201022}

Fetching content from: http://brew.sh 200 OK (21.2 Kbytes)
Processing 910 permutations ···········21%···········44%·········64%··············86%······· 7 hits
Querying WHOIS servers ··

https://github.com/Homebrew/homebrew-core/pull/66472/checks?check_run_id=1517384199#step:6:3193

elceef commented 3 years ago

Although I can't reproduce this, you are right that it is possible to return None. Your change was committed in 5be920722b3bd9c25b2b6ff55704b432f84d7d4c. Thank you for contributing!

bayandin commented 3 years ago

Thanks!