From bf6bea14565b1ca4317ac9345ebde48be30d1312 Mon Sep 17 00:00:00 2001 From: Sean Whalen Date: Sun, 22 Sep 2019 12:41:07 -0400 Subject: [PATCH] Add support for detecting mbox files --- parsedmarc/utils.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/parsedmarc/utils.py b/parsedmarc/utils.py index b9bc151..ec25d9f 100644 --- a/parsedmarc/utils.py +++ b/parsedmarc/utils.py @@ -422,6 +422,20 @@ def get_filename_safe_string(string): return string +def is_mbox(content): + """ + Checks if the given content is a MBOX mailbox file + + Args: + content: Content to check + + Returns: + bool: A flag the indicates if a file is a MBOX mailbox file + """ + return type(content) == bytes and content.startswith( + b"\xD0\x0D\xBB\xAD") + + def is_outlook_msg(content): """ Checks if the given content is a Outlook msg OLE file