From 673c6a027043bf0d476d85c8822dc1c5cb3de15c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rapha=C3=ABl=20Vinot?= Date: Thu, 21 Nov 2024 13:41:07 +0100 Subject: [PATCH] fix: Avoid endless recursive call --- lookyloo/modules/uwhois.py | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/lookyloo/modules/uwhois.py b/lookyloo/modules/uwhois.py index 2c36505b..e046e1fe 100644 --- a/lookyloo/modules/uwhois.py +++ b/lookyloo/modules/uwhois.py @@ -94,15 +94,16 @@ class UniversalWhois(AbstractModule): if abuse_c and abuse_c.lastindex: # make sure we have a match and avoid exception on None or missing group 1 # The whois entry has an abuse-c object _obj_name: str = abuse_c.group(1).decode() - abuse_c_query = self.whois(_obj_name, contact_email_only) - # The object exists - if abuse_c_query and contact_email_only: - # The object exists and we only want the email(s), the response is a list of emails - return abuse_c_query - elif abuse_c_query: - # The object exists and we want the full whois entry, contatenate with a new line. - # contact_email_only is False, so the response is a string, ignore the typing warning accordingy - return '\n'.join([bytes_whois.decode(), abuse_c_query]) # type: ignore[list-item] + if _obj_name != query: + abuse_c_query = self.whois(_obj_name, contact_email_only) + # The object exists + if abuse_c_query and contact_email_only: + # The object exists and we only want the email(s), the response is a list of emails + return abuse_c_query + elif abuse_c_query: + # The object exists and we want the full whois entry, contatenate with a new line. + # contact_email_only is False, so the response is a string, ignore the typing warning accordingy + return '\n'.join([bytes_whois.decode(), abuse_c_query]) # type: ignore[list-item] # We either dont have an abuse-c object or it does not exist if not contact_email_only: return bytes_whois.decode()