Skip to content

Commit

Permalink
Fix new config variables previously not propagated in the code (#524)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryuksan authored May 22, 2024
1 parent ed92e0f commit f8ee9bd
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
30 changes: 30 additions & 0 deletions parsedmarc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,9 @@ def parse_report_file(input_, nameservers=None, dns_timeout=2.0,
def get_dmarc_reports_from_mbox(input_, nameservers=None, dns_timeout=2.0,
strip_attachment_payloads=False,
ip_db_path=None,
always_use_local_files=False,
reverse_dns_map_path=None,
reverse_dns_map_url=None,
offline=False):
"""Parses a mailbox in mbox format containing e-mails with attached
DMARC reports
Expand All @@ -1301,6 +1304,9 @@ def get_dmarc_reports_from_mbox(input_, nameservers=None, dns_timeout=2.0,
dns_timeout (float): Sets the DNS timeout in seconds
strip_attachment_payloads (bool): Remove attachment payloads from
forensic report results
always_use_local_files (bool): Do not download files
reverse_dns_map_path (str): Path to a reverse DNS map file
reverse_dns_map_url (str): URL to a reverse DNS map file
ip_db_path (str): Path to a MMDB file from MaxMind or DBIP
offline (bool): Do not make online queries for geolocation or DNS
Expand All @@ -1327,6 +1333,9 @@ def get_dmarc_reports_from_mbox(input_, nameservers=None, dns_timeout=2.0,
sa = strip_attachment_payloads
parsed_email = parse_report_email(msg_content,
ip_db_path=ip_db_path,
always_use_local_files=always_use_local_files,
reverse_dns_map_path=reverse_dns_map_path,
reverse_dns_map_url=reverse_dns_map_url,
offline=offline,
nameservers=nameservers,
dns_timeout=dns_timeout,
Expand All @@ -1352,6 +1361,9 @@ def get_dmarc_reports_from_mailbox(connection: MailboxConnection,
delete=False,
test=False,
ip_db_path=None,
always_use_local_files=False,
reverse_dns_map_path=None,
reverse_dns_map_url=None,
offline=False,
nameservers=None,
dns_timeout=6.0,
Expand All @@ -1369,6 +1381,9 @@ def get_dmarc_reports_from_mailbox(connection: MailboxConnection,
delete (bool): Delete messages after processing them
test (bool): Do not move or delete messages after processing them
ip_db_path (str): Path to a MMDB file from MaxMind or DBIP
always_use_local_files (bool): Do not download files
reverse_dns_map_path (str): Path to a reverse DNS map file
reverse_dns_map_url (str): URL to a reverse DNS map file
offline (bool): Do not query online for geolocation or DNS
nameservers (list): A list of DNS nameservers to query
dns_timeout (float): Set the DNS query timeout
Expand Down Expand Up @@ -1436,6 +1451,9 @@ def get_dmarc_reports_from_mailbox(connection: MailboxConnection,
nameservers=nameservers,
dns_timeout=dns_timeout,
ip_db_path=ip_db_path,
always_use_local_files=always_use_local_files,
reverse_dns_map_path=reverse_dns_map_path,
reverse_dns_map_url=reverse_dns_map_url,
offline=offline,
strip_attachment_payloads=sa,
keep_alive=connection.keepalive)
Expand Down Expand Up @@ -1559,6 +1577,9 @@ def get_dmarc_reports_from_mailbox(connection: MailboxConnection,
strip_attachment_payloads=strip_attachment_payloads,
results=results,
ip_db_path=ip_db_path,
always_use_local_files=always_use_local_files,
reverse_dns_map_path=reverse_dns_map_path,
reverse_dns_map_url=reverse_dns_map_url,
offline=offline
)

Expand All @@ -1570,6 +1591,9 @@ def watch_inbox(mailbox_connection: MailboxConnection,
reports_folder="INBOX",
archive_folder="Archive", delete=False, test=False,
check_timeout=30, ip_db_path=None,
always_use_local_files=False,
reverse_dns_map_path=None,
reverse_dns_map_url=None,
offline=False, nameservers=None,
dns_timeout=6.0, strip_attachment_payloads=False,
batch_size=None):
Expand All @@ -1587,6 +1611,9 @@ def watch_inbox(mailbox_connection: MailboxConnection,
check_timeout (int): Number of seconds to wait for a IMAP IDLE response
or the number of seconds until the next mail check
ip_db_path (str): Path to a MMDB file from MaxMind or DBIP
always_use_local_files (bool): Do not download files
reverse_dns_map_path (str): Path to a reverse DNS map file
reverse_dns_map_url (str): URL to a reverse DNS map file
offline (bool): Do not query online for geolocation or DNS
nameservers (list): A list of one or more nameservers to use
(Cloudflare's public DNS resolvers by default)
Expand All @@ -1604,6 +1631,9 @@ def check_callback(connection):
delete=delete,
test=test,
ip_db_path=ip_db_path,
always_use_local_files=always_use_local_files,
reverse_dns_map_path=reverse_dns_map_path,
reverse_dns_map_url=reverse_dns_map_url,
offline=offline,
nameservers=nameservers,
dns_timeout=dns_timeout,
Expand Down
9 changes: 9 additions & 0 deletions parsedmarc/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -1222,6 +1222,9 @@ def process_reports(reports_):
dns_timeout=opts.dns_timeout,
strip_attachment_payloads=strip,
ip_db_path=opts.ip_db_path,
always_use_local_files=opts.always_use_local_files,
reverse_dns_map_path=opts.reverse_dns_map_path,
reverse_dns_map_url=opts.reverse_dns_map_url,
offline=opts.offline)
aggregate_reports += reports["aggregate_reports"]
forensic_reports += reports["forensic_reports"]
Expand Down Expand Up @@ -1309,6 +1312,9 @@ def process_reports(reports_):
reports_folder=opts.mailbox_reports_folder,
archive_folder=opts.mailbox_archive_folder,
ip_db_path=opts.ip_db_path,
always_use_local_files=opts.always_use_local_files,
reverse_dns_map_path=opts.reverse_dns_map_path,
reverse_dns_map_url=opts.reverse_dns_map_url,
offline=opts.offline,
nameservers=opts.nameservers,
test=opts.mailbox_test,
Expand Down Expand Up @@ -1360,6 +1366,9 @@ def process_reports(reports_):
strip_attachment_payloads=opts.strip_attachment_payloads,
batch_size=opts.mailbox_batch_size,
ip_db_path=opts.ip_db_path,
always_use_local_files=opts.always_use_local_files,
reverse_dns_map_path=opts.reverse_dns_map_path,
reverse_dns_map_url=opts.reverse_dns_map_url,
offline=opts.offline)
except FileExistsError as error:
logger.error("{0}".format(error.__str__()))
Expand Down

0 comments on commit f8ee9bd

Please sign in to comment.