From c102c2f21c54d58663638726d4ea333a4b45c920 Mon Sep 17 00:00:00 2001 From: Sean Whalen Date: Wed, 26 Sep 2018 12:32:39 -0400 Subject: [PATCH] Fix splunk HEC submission and --outgoing-ssl option Changed --outgoing-SSL to --outgoing-ssl --- README.rst | 2 +- docs/index.rst | 2 +- parsedmarc/cli.py | 8 +++++--- parsedmarc/splunk.py | 6 ++---- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/README.rst b/README.rst index 8285db4c..98d8bf33 100644 --- a/README.rst +++ b/README.rst @@ -125,7 +125,7 @@ CLI help Email the results using this password --outgoing-port OUTGOING_PORT Email the results using this port - --outgoing-SSL OUTGOING_SSL + --outgoing-ssl OUTGOING_SSL Use SSL/TLS instead of STARTTLS (more secure, and required by some providers, like Gmail) -F OUTGOING_FROM, --outgoing-from OUTGOING_FROM diff --git a/docs/index.rst b/docs/index.rst index 891e3479..d20d4d1b 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -106,7 +106,7 @@ CLI help Email the results using this password --outgoing-port OUTGOING_PORT Email the results using this port - --outgoing-SSL OUTGOING_SSL + --outgoing-ssl OUTGOING_SSL Use SSL/TLS instead of STARTTLS (more secure, and required by some providers, like Gmail) -F OUTGOING_FROM, --outgoing-from OUTGOING_FROM diff --git a/parsedmarc/cli.py b/parsedmarc/cli.py index 8e141328..ef9635fe 100644 --- a/parsedmarc/cli.py +++ b/parsedmarc/cli.py @@ -121,7 +121,7 @@ def _main(): help="Email the results using this password") arg_parser.add_argument("--outgoing-port", help="Email the results using this port") - arg_parser.add_argument("--outgoing-SSL", + arg_parser.add_argument("--outgoing-ssl", help="Use SSL/TLS instead of STARTTLS (more " "secure, and required by some providers, " "like Gmail)") @@ -227,7 +227,8 @@ def _main(): forensic_reports += reports["forensic_reports"] except IMAPError as error: - logger.error("IMAP Error: {0}".format(error.__str__())) + error_str = error.__str__().replace("b'", "").lstrip("'") + logger.error("IMAP Error: {0}".format(error_str)) exit(1) results = OrderedDict([("aggregate_reports", aggregate_reports), @@ -263,7 +264,8 @@ def _main(): test=args.test, nameservers=args.nameservers, dns_timeout=args.timeout) except IMAPError as error: - logger.error("IMAP Error: {0}".format(error.__str__())) + error_str = error.__str__().replace("b'", "").lstrip("'") + logger.error("IMAP Error: {0}".format(error_str)) exit(1) diff --git a/parsedmarc/splunk.py b/parsedmarc/splunk.py index cf19051c..b7aad75d 100644 --- a/parsedmarc/splunk.py +++ b/parsedmarc/splunk.py @@ -96,9 +96,8 @@ class HECClient(object): data["sourcetype"] = "dmarc:aggregate" data["event"] = new_report.copy() json_str += "{0}\n".format(json.dumps(data)) - try: - response = self.session.post(self.url, json=json_str).json() + response = self.session.post(self.url, data=json_str).json() except Exception as e: raise SplunkError(e.__str__()) if response["code"] != 0: @@ -125,9 +124,8 @@ class HECClient(object): data["sourcetype"] = "dmarc:forensic" data["event"] = report.copy() json_str += "{0}\n".format(json.dumps(data)) - try: - response = self.session.post(self.url, json=json_str).json() + response = self.session.post(self.url, data=json_str).json() except Exception as e: raise SplunkError(e.__str__()) if response["code"] != 0: