Commit 246ade44c1686d03fdf6a85cd467d0b89f91dc7c
1 parent
95468654
msodde: Raise proper error when decrypt fails
Showing
1 changed file
with
3 additions
and
0 deletions
oletools/msodde.py
| ... | ... | @@ -987,6 +987,9 @@ def process_maybe_encrypted(filepath, passwords=None, crypto_nesting=0, |
| 987 | 987 | try: |
| 988 | 988 | logger.debug('Trying to decrypt file') |
| 989 | 989 | decrypted_file = crypto.decrypt(filepath, passwords) |
| 990 | + if not decrypted_file: | |
| 991 | + logger.error('Decrypt failed, run with debug output to get details') | |
| 992 | + raise crypto.WrongEncryptionPassword(filepath) | |
| 990 | 993 | logger.info('Analyze decrypted file') |
| 991 | 994 | result = process_maybe_encrypted(decrypted_file, passwords, |
| 992 | 995 | crypto_nesting+1, **kwargs) | ... | ... |