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

Decrypt in oleobj #798

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
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
7 changes: 4 additions & 3 deletions oletools/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ def decrypt(filename, passwords=None, **temp_file_args):
None
:type passwords: iterable or str or None
:param temp_file_args: arguments for :py:func:`tempfile.mkstemp` e.g.,
`dirname` or `prefix`. `suffix` will default to
`dir` or `prefix`. `suffix` will default to
suffix of input `filename`, `prefix` defaults to
`oletools-decrypt-`; `text` will be ignored
:returns: name of the decrypted temporary file (type str) or `None`
Expand Down Expand Up @@ -385,6 +385,7 @@ def decrypt(filename, passwords=None, **temp_file_args):
crypto_file.decrypt(write_handle)

# decryption was successfull; clean up and return
log.debug('Decrypt successfull')
write_handle.close()
write_handle = None
break
Expand All @@ -399,6 +400,6 @@ def decrypt(filename, passwords=None, **temp_file_args):
if decrypt_file and isfile(decrypt_file):
os.unlink(decrypt_file)
decrypt_file = None
# if we reach this, all passwords were tried without success
log.debug('All passwords failed')
if decrypt_file is None:
log.debug('All passwords failed')
return decrypt_file
Loading