From f5fd56860d5876e6090dbf9be5f75251ad274c45 Mon Sep 17 00:00:00 2001 From: PC-Admin Date: Wed, 2 Aug 2023 17:09:31 +0800 Subject: [PATCH] fix bug where a single whois email is returned as an array of letters. --- report_commands.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/report_commands.py b/report_commands.py index add8780..918f925 100644 --- a/report_commands.py +++ b/report_commands.py @@ -264,13 +264,17 @@ def lookup_homeserver_admin(preset_baseurl): try: w = whois.whois(baseurl) if w.emails: - #print("\nAdmin contact email(s) for " + baseurl + " are: " + str(w.emails)) - return {baseurl: list(w.emails)}, True + # Check if the emails field is a list + if isinstance(w.emails, list): + return {baseurl: list(w.emails)}, True + # If it's not a list, it must be a single string. So, we wrap it in a list + else: + return {baseurl: [w.emails]}, True else: - print(f"Error: Unable to collect admin email from WHOIS data for {baseurl}") + print(f"\t\tError: Unable to collect admin email from WHOIS data for {baseurl}") return None, False except: - print(f"Error: Unable to collect WHOIS data for {baseurl}") + print(f"\t\tError: Unable to collect WHOIS data for {baseurl}") return None, False def send_email(email_address, email_subject, email_content, email_attachments):