Commit 3f0e4f5e9fb7968cdfeea29db55c2d782377bb5e
1 parent
26f1ea72
added chance to decrypt with custom passwords
Showing
1 changed file
with
5 additions
and
2 deletions
oletools/olevba.py
| @@ -3287,13 +3287,16 @@ class VBA_Parser(object): | @@ -3287,13 +3287,16 @@ class VBA_Parser(object): | ||
| 3287 | return False | 3287 | return False |
| 3288 | 3288 | ||
| 3289 | def detect_is_encrypted(self): | 3289 | def detect_is_encrypted(self): |
| 3290 | - self.is_encrypted = crypto.is_encrypted(self.ole_file) | 3290 | + if self.ole_file: |
| 3291 | + self.is_encrypted = crypto.is_encrypted(self.ole_file) | ||
| 3291 | return self.is_encrypted | 3292 | return self.is_encrypted |
| 3292 | 3293 | ||
| 3293 | - def decrypt_file(self): | 3294 | + def decrypt_file(self, passwords_list=None): |
| 3294 | decrypted_file = None | 3295 | decrypted_file = None |
| 3295 | if self.detect_is_encrypted(): | 3296 | if self.detect_is_encrypted(): |
| 3296 | passwords = crypto.DEFAULT_PASSWORDS | 3297 | passwords = crypto.DEFAULT_PASSWORDS |
| 3298 | + if passwords_list and isinstance(passwords_list, list): | ||
| 3299 | + passwords.extend(passwords_list) | ||
| 3297 | decrypted_file = crypto.decrypt(self.filename, passwords) | 3300 | decrypted_file = crypto.decrypt(self.filename, passwords) |
| 3298 | 3301 | ||
| 3299 | return decrypted_file | 3302 | return decrypted_file |