From 3d4ca097cc8891811a9239308bf3e844441258de Mon Sep 17 00:00:00 2001 From: Sean Whalen Date: Mon, 5 Mar 2018 18:13:02 -0500 Subject: [PATCH] 2.1.0 --- _modules/index.html | 8 +- _modules/parsedmarc.html | 223 +++++++++++++++++++++++++++++++++++---- _sources/index.rst.txt | 30 +++++- genindex.html | 20 +++- index.html | 95 +++++++++++++++-- objects.inv | Bin 455 -> 476 bytes py-modindex.html | 8 +- search.html | 8 +- searchindex.js | 2 +- 9 files changed, 343 insertions(+), 51 deletions(-) diff --git a/_modules/index.html b/_modules/index.html index 6569573..d486ae4 100644 --- a/_modules/index.html +++ b/_modules/index.html @@ -8,7 +8,7 @@ - Overview: module code — parsedmarc 2.0.1 documentation + Overview: module code — parsedmarc 2.1.0 documentation @@ -35,7 +35,7 @@ - + @@ -64,7 +64,7 @@
- 2.0.1 + 2.1.0
@@ -187,7 +187,7 @@ @@ -65,7 +65,7 @@
- 2.0.1 + 2.1.0
@@ -165,6 +165,10 @@

E

+
  • extract_xml() (in module parsedmarc)
  • @@ -175,6 +179,10 @@ +
    @@ -231,6 +239,10 @@ +
    @@ -279,7 +291,7 @@ @@ -64,7 +64,7 @@
    - 2.0.1 + 2.1.0
    @@ -184,13 +184,18 @@
  • Transparently handles gzip or zip compressed reports
  • Consistent data structures
  • Simple JSON and/or CSV output
  • +
  • Optionally email the results

CLI help

usage: parsedmarc [-h] [-o OUTPUT] [-n NAMESERVERS [NAMESERVERS ...]]
-                  [-t TIMEOUT] [-H HOST] [-U USERNAME] [-p PASSWORD]
-                  [-a ARCHIVE_FOLDER] [-d] [-i] [-T] [-v]
+                  [-t TIMEOUT] [-H HOST] [-u USER] [-p PASSWORD]
+                  [-a ARCHIVE_FOLDER] [-d] [-O OUTGOING_HOST]
+                  [-U OUTGOING_USER] [-P OUTGOING_PASSWORD]
+                  [-F OUTGOING_FROM] [-T OUTGOING_TO [OUTGOING_TO ...]]
+                  [-S OUTGOING_SUBJECT] [-A OUTGOING_ATTACHMENT]
+                  [-M OUTGOING_MESSAGE] [-i] [--test] [-v]
                   [file_path [file_path ...]]
 
 Parses DMARC reports
@@ -209,17 +214,32 @@
                         number of seconds to wait for an answer from DNS
                         (default 6.0)
   -H HOST, --host HOST  IMAP hostname or IP address
-  -U USERNAME, --username USERNAME
-                        IMAP username
+  -u USER, --user USER  IMAP user
   -p PASSWORD, --password PASSWORD
                         IMAP password
   -a ARCHIVE_FOLDER, --archive-folder ARCHIVE_FOLDER
                         Specifies the IMAP folder to move messages to after
                         processing them (default: Archive)
   -d, --delete          Delete the reports after processing them
+  -O OUTGOING_HOST, --outgoing-host OUTGOING_HOST
+                        Email the results using this host
+  -U OUTGOING_USER, --outgoing-user OUTGOING_USER
+                        Email the results using this user
+  -P OUTGOING_PASSWORD, --outgoing-password OUTGOING_PASSWORD
+                        Email the results using this password
+  -F OUTGOING_FROM, --outgoing-from OUTGOING_FROM
+                        Email the results using this from address
+  -T OUTGOING_TO [OUTGOING_TO ...], --outgoing-to OUTGOING_TO [OUTGOING_TO ...]
+                        Email the results to these addresses
+  -S OUTGOING_SUBJECT, --outgoing-subject OUTGOING_SUBJECT
+                        Email the results using this subject
+  -A OUTGOING_ATTACHMENT, --outgoing-attachment OUTGOING_ATTACHMENT
+                        Email the results using this filename
+  -M OUTGOING_MESSAGE, --outgoing-message OUTGOING_MESSAGE
+                        Email the results using this message
   -i, --idle            Use an IMAP IDLE connection to process reports as they
                         arrive in the inbox
-  -T, --test            Do not move or delete IMAP messages
+  --test                Do not move or delete IMAP messages
   -v, --version         show program's version number and exit
 
@@ -382,6 +402,41 @@ above commands.

Raised whenever the parser fails for some reason

+
+
+exception parsedmarc.SMTPError[source]
+

Raised when a SMTP error occurs

+
+ +
+
+parsedmarc.email_results(results, host, mail_from, mail_to, port=0, starttls=True, use_ssl=False, user=None, password=None, subject=None, attachment_filename=None, message=None, ssl_context=None)[source]
+

Emails parsing results as a zip file

+ +++ + + + +
Parameters:
    +
  • results (OrderedDict) – Parsing results
  • +
  • host – Mail server hostname or IP address
  • +
  • mail_from – The value of the message from header
  • +
  • mail_to – A list of addresses to mail to
  • +
  • port (int) – Port to use
  • +
  • starttls (bool) – use STARTTLS
  • +
  • use_ssl (bool) – Require an SSL connection from the start
  • +
  • user – An optional username
  • +
  • password – An optional password
  • +
  • subject – Overrides the default message subject
  • +
  • attachment_filename – Override the default attachment filename
  • +
  • message – Override the default plain text body
  • +
  • ssl_context – SSL context options
  • +
+
+
+
parsedmarc.extract_xml(input_)[source]
@@ -403,7 +458,7 @@ or bytes.

-parsedmarc.get_dmarc_reports_from_inbox(host, username, password, archive_folder='Archive', delete=False, test=False, nameservers=None, dns_timeout=6.0)[source]
+parsedmarc.get_dmarc_reports_from_inbox(host, user, password, archive_folder='Archive', delete=False, test=False, nameservers=None, dns_timeout=6.0)[source]

Fetches and parses DMARC reports from sn inbox

@@ -411,7 +466,7 @@ or bytes.

Parameters:
  • host – The mail server hostname or IP address
  • -
  • username – The mail server username
  • +
  • user – The mail server user
  • password – The mail server password
  • archive_folder – The folder to move processed mail to
  • delete (bool) – Delete messages after processing them
  • @@ -431,6 +486,24 @@ or bytes.

+
+
+parsedmarc.get_report_zip(results)[source]
+

Creates a zip file of parsed report output

+ +++ + + + + + + + +
Parameters:results (OrderedDict) – The parsed results
Returns:zip file bytes
Return type:bytes
+
+
parsedmarc.human_timestamp_to_datetime(human_timestamp)[source]
@@ -694,7 +767,7 @@ to a callback function

@@ -64,7 +64,7 @@
- 2.0.1 + 2.1.0
@@ -195,7 +195,7 @@