From a1f141d84cd094030f50bdceecf19f1675a37b51 Mon Sep 17 00:00:00 2001 From: Sean Whalen Date: Mon, 19 Feb 2024 19:05:12 -0500 Subject: [PATCH] Code cleanup --- parsedmarc/__init__.py | 7 ++++--- parsedmarc/cli.py | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/parsedmarc/__init__.py b/parsedmarc/__init__.py index f2d7125..c5d5ea1 100644 --- a/parsedmarc/__init__.py +++ b/parsedmarc/__init__.py @@ -1016,7 +1016,8 @@ def parse_report_email(input_, offline=False, ip_db_path=None, smtp_tls_report = None sample = None if "From" in msg_headers: - logger.info("Parsing mail from {0} on {1}".format(msg_headers["From"], date)) + logger.info("Parsing mail from {0} on {1}".format(msg_headers["From"], + date)) if "Subject" in msg_headers: subject = msg_headers["Subject"] for part in msg.walk(): @@ -1065,8 +1066,8 @@ def parse_report_email(input_, offline=False, ip_db_path=None, fields[field_name] = match[1].strip() feedback_report = "Arrival-Date: {}\n" \ - "Source-IP: {}" \ - "".format(fields["received-date"], + "Source-IP: {}" \ + "".format(fields["received-date"], fields["sender-ip-address"]) except Exception as e: error = 'Unable to parse message with ' \ diff --git a/parsedmarc/cli.py b/parsedmarc/cli.py index d34cf6a..0f01bbd 100644 --- a/parsedmarc/cli.py +++ b/parsedmarc/cli.py @@ -594,10 +594,10 @@ def _main(): logger.critical("password setting missing from the " "msgraph config section") exit(-1) - + if opts.graph_auth_method == AuthMethod.DeviceCode.name: if "user" in graph_config: - opts.graph_user = graph_config["user"] + opts.graph_user = graph_config["user"] if opts.graph_auth_method != AuthMethod.UsernamePassword.name: if "tenant_id" in graph_config: