mirror of
https://github.com/domainaware/parsedmarc.git
synced 2026-05-19 18:35:24 +00:00
It's actually 3.4.0
This commit is contained in:
+1
-3
@@ -496,9 +496,7 @@ setting to suit your needs.
|
||||
Documentation=https://domainaware.github.io/parsedmarc/
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/parsedmarc --watch --save-aggregate -H "outlook.office365.com" -u "dmarc@example.com" -p "FooBar!" --save-aggregate
|
||||
User=nobody
|
||||
Group=nobody
|
||||
ExecStart=/usr/local/bin/parsedmarc --watch --silent --save-aggregate --save-forensic -H "outlook.office365.com" -u "dmarc@example.com" -p "FooBar!" --save-aggregate
|
||||
Restart=always
|
||||
RestartSec=5m
|
||||
|
||||
|
||||
+15
-4
@@ -6,6 +6,7 @@
|
||||
|
||||
from argparse import ArgumentParser
|
||||
from glob import glob
|
||||
import logging
|
||||
from collections import OrderedDict
|
||||
import json
|
||||
|
||||
@@ -19,7 +20,7 @@ from parsedmarc import logger, IMAPError, get_dmarc_reports_from_inbox, \
|
||||
def _main():
|
||||
"""Called when the module is executed"""
|
||||
def process_reports(reports_):
|
||||
print(json.dumps(reports_, ensure_ascii=False, indent=2), "\n")
|
||||
logger.info(json.dumps(reports_, ensure_ascii=False, indent=2), "\n")
|
||||
if args.save_aggregate:
|
||||
for report in reports_["aggregate_reports"]:
|
||||
try:
|
||||
@@ -99,9 +100,13 @@ def _main():
|
||||
arg_parser.add_argument("-w", "--watch", action="store_true",
|
||||
help="Use an IMAP IDLE connection to process "
|
||||
"reports as they arrive in the inbox")
|
||||
arg_parser.add_argument("--test",
|
||||
arg_parser.add_argument("-t", "--test",
|
||||
help="Do not move or delete IMAP messages",
|
||||
action="store_true", default=False)
|
||||
arg_parser.add_argument("-s", "--silent", action="store_true",
|
||||
help="Only print errors")
|
||||
arg_parser.add_argument("-d", "--debug", action="store_true",
|
||||
help="Print debugging information")
|
||||
arg_parser.add_argument("-v", "--version", action="version",
|
||||
version=__version__)
|
||||
|
||||
@@ -110,6 +115,12 @@ def _main():
|
||||
|
||||
args = arg_parser.parse_args()
|
||||
|
||||
logger.setLevel(logger.setLevel(logging.INFO))
|
||||
if args.silent:
|
||||
logger.setLevel(logging.ERROR)
|
||||
if args.debug:
|
||||
logger.setLevel(logging.DEBUG)
|
||||
|
||||
if args.host is None and len(args.file_path) == 0:
|
||||
arg_parser.print_help()
|
||||
exit(1)
|
||||
@@ -188,8 +199,8 @@ def _main():
|
||||
exit(1)
|
||||
|
||||
if args.host and args.watch:
|
||||
logger.warning("Watching for email\n"
|
||||
"Quit with ^c")
|
||||
logger.info("Watching for email\n"
|
||||
"Quit with ^c")
|
||||
try:
|
||||
watch_inbox(args.host, args.user, args.password, process_reports,
|
||||
reports_folder=args.reports_folder,
|
||||
|
||||
Reference in New Issue
Block a user