From c914583797a42809c6b77277a36b48637f3eb51c Mon Sep 17 00:00:00 2001 From: "Mariusz B. / mgeeky" Date: Thu, 18 Nov 2021 20:43:50 -0400 Subject: [PATCH] Fixes issues/1 with case-sensitivity issue in gethostbyname --- decode-spam-headers.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/decode-spam-headers.py b/decode-spam-headers.py index 5fb4c7f..2af7955 100644 --- a/decode-spam-headers.py +++ b/decode-spam-headers.py @@ -1813,10 +1813,11 @@ class SMTPHeadersAnalysis: @staticmethod def gethostbyname(name, important = True): + name = name.lower() if not important or options['dont_resolve'] or len(name) == 0: return '' - if name.lower() in SMTPHeadersAnalysis.resolved.keys(): + if name in SMTPHeadersAnalysis.resolved.keys(): logger.dbg(f'Returning cached gethostbyname entry for: "{name}"') return SMTPHeadersAnalysis.resolved[name] @@ -1824,8 +1825,8 @@ class SMTPHeadersAnalysis: logger.dbg(f'gethostbyname("{name}")...') res = socket.gethostbyname(name) if len(res) > 0: - logger.dbg(f'Cached gethostbyname("{name.lower()}") = "{res}"') - SMTPHeadersAnalysis.resolved[name.lower()] = res + logger.dbg(f'Cached gethostbyname("{name}") = "{res}"') + SMTPHeadersAnalysis.resolved[name] = res return res except: pass