From 84ea7425939d691d82e096bad655587fcc8cb502 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Mon, 25 Mar 2019 11:29:08 +0100 Subject: [PATCH] msodde: Make password list optional for processing function --- oletools/msodde.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/oletools/msodde.py b/oletools/msodde.py index 7f387ca..457a506 100644 --- a/oletools/msodde.py +++ b/oletools/msodde.py @@ -935,7 +935,8 @@ def process_file(filepath, field_filter_mode=None): # === MAIN ================================================================= -def process_maybe_encrypted(filepath, passwords, crypto_nesting=0, **kwargs): +def process_maybe_encrypted(filepath, passwords=None, crypto_nesting=0, + **kwargs): """ Process a file that might be encrypted. @@ -944,7 +945,7 @@ def process_maybe_encrypted(filepath, passwords, crypto_nesting=0, **kwargs): :py:mod:`oletools.crypto`. :param str filepath: path to file on disc. - :param passwords: list of passwords (str) to try for decryption + :param passwords: list of passwords (str) to try for decryption or None :param int crypto_nesting: How many decryption layers were already used to get the given file. :param kwargs: same as :py:func:`process_file` @@ -965,6 +966,11 @@ def process_maybe_encrypted(filepath, passwords, crypto_nesting=0, **kwargs): raise crypto.MaxCryptoNestingReached(crypto_nesting, filepath) decrypted_file = None + if passwords is None: + passwords = [crypto.WRITE_PROTECT_ENCRYPTION_PASSWORD, ] + else: + passwords = list(passwords) + \ + [crypto.WRITE_PROTECT_ENCRYPTION_PASSWORD, ] try: logger.debug('Trying to decrypt file') decrypted_file = crypto.decrypt(filepath, passwords) -- libgit2 0.21.4