Commit 304db0e6d10503d4dcb7a40a952c0390622a082b

Authored by Christian Herdtweck
1 parent 171156df

ppt_record_parser: fail is_ppt if is encrypted

I had assumed that even in an encrypted file the "PowerPoint Document"
stream has to exist. But it does not (file could be embedded in other file)
Showing 1 changed file with 3 additions and 6 deletions
oletools/ppt_record_parser.py
... ... @@ -63,7 +63,7 @@ except ImportError:
63 63 sys.path.insert(0, PARENT_DIR)
64 64 del PARENT_DIR
65 65 from oletools import record_base
66   -from oletools.common.errors import FileIsEncryptedError
  66 +from oletools.common.errors import CryptoErrorBase
67 67  
68 68  
69 69 # types of relevant records (there are much more than listed here)
... ... @@ -181,11 +181,8 @@ def is_ppt(filename):
181 181 return True
182 182 else: # ignore other streams/storages since they are optional
183 183 continue
184   - except FileIsEncryptedError:
185   - assert ppt_file is not None, \
186   - 'Encryption error should not be raised from just opening OLE file.'
187   - # just rely on stream names, copied from oleid
188   - return ppt_file.exists('PowerPoint Document')
  184 + except CryptoErrorBase:
  185 + raise
189 186 except Exception:
190 187 pass
191 188 return False
... ...