Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix new config variables previously not propagated in the code #524

Merged
merged 1 commit into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading