Commit 22951d138449ad09e08e445c69d44420ea061fbc
Committed by
GitHub
Merge pull request #111 from christian-intra2net/ppt-parser-import-fix
Ppt parser import fix
Showing
2 changed files
with
3 additions
and
8 deletions
oletools/olevba.py
| ... | ... | @@ -2532,7 +2532,7 @@ class VBA_Parser(object): |
| 2532 | 2532 | self.ole_file.close() # just in case |
| 2533 | 2533 | self.ole_file = None # required to make other methods look at ole_subfiles |
| 2534 | 2534 | self.type = TYPE_PPT |
| 2535 | - except Exception as exc: | |
| 2535 | + except (ppt_parser.PptUnexpectedData, ValueError) as exc: | |
| 2536 | 2536 | if self.container == 'PptParser': |
| 2537 | 2537 | # this is a subfile of a ppt --> to be expected that is no ppt |
| 2538 | 2538 | log.debug('PPT subfile is not a PPT file') | ... | ... |
oletools/ppt_parser.py
| ... | ... | @@ -40,12 +40,7 @@ import struct |
| 40 | 40 | import traceback |
| 41 | 41 | import os |
| 42 | 42 | |
| 43 | -try: | |
| 44 | - # absolute import when oletools is installed | |
| 45 | - import oletools.thirdparty.olefile as olefile | |
| 46 | -except: | |
| 47 | - # relative import otherwise | |
| 48 | - import thirdparty.olefile as olefile | |
| 43 | +import thirdparty.olefile as olefile | |
| 49 | 44 | |
| 50 | 45 | import zlib |
| 51 | 46 | |
| ... | ... | @@ -1130,7 +1125,7 @@ class PptParser(object): |
| 1130 | 1125 | log.debug('using open OleFileIO') |
| 1131 | 1126 | self.ole = ole |
| 1132 | 1127 | else: |
| 1133 | - log.debug('Opening file ' + ole) | |
| 1128 | + log.debug('Opening file {0}'.format(ole)) | |
| 1134 | 1129 | self.ole = olefile.OleFileIO(ole) |
| 1135 | 1130 | |
| 1136 | 1131 | self.fast_fail = fast_fail | ... | ... |