Commit eecabc2a586f2540efcc3aec6a6175452b6291e5
1 parent
6a7e74cc
olevba: raise exception instead of sys.exit (issue #180)
Showing
1 changed file
with
5 additions
and
2 deletions
oletools/olevba.py
| @@ -196,8 +196,9 @@ from __future__ import print_function | @@ -196,8 +196,9 @@ from __future__ import print_function | ||
| 196 | # 2017-05-31 c1fe: - PR #135 fixing issue #132 for some Mac files | 196 | # 2017-05-31 c1fe: - PR #135 fixing issue #132 for some Mac files |
| 197 | # 2017-06-08 PL: - fixed issue #122 Chr() with negative numbers | 197 | # 2017-06-08 PL: - fixed issue #122 Chr() with negative numbers |
| 198 | # 2017-06-15 PL: - deobfuscation line by line to handle large files | 198 | # 2017-06-15 PL: - deobfuscation line by line to handle large files |
| 199 | +# 2017-07-11 v0.51.1 PL: - raise exception instead of sys.exit (issue #180) | ||
| 199 | 200 | ||
| 200 | -__version__ = '0.51' | 201 | +__version__ = '0.51.1dev1' |
| 201 | 202 | ||
| 202 | #------------------------------------------------------------------------------ | 203 | #------------------------------------------------------------------------------ |
| 203 | # TODO: | 204 | # TODO: |
| @@ -1574,7 +1575,9 @@ def _extract_vba(ole, vba_root, project_path, dir_path, relaxed=False): | @@ -1574,7 +1575,9 @@ def _extract_vba(ole, vba_root, project_path, dir_path, relaxed=False): | ||
| 1574 | continue | 1575 | continue |
| 1575 | 1576 | ||
| 1576 | log.error('invalid or unknown check Id {0:04X}'.format(check)) | 1577 | log.error('invalid or unknown check Id {0:04X}'.format(check)) |
| 1577 | - sys.exit(0) | 1578 | + # raise an exception instead of stopping abruptly (issue #180) |
| 1579 | + raise UnexpectedDataError(dir_path, 'reference type', (0x0F, 0x16, 0x33, 0x2F, 0x0D, 0x0E), check) | ||
| 1580 | + #sys.exit(0) | ||
| 1578 | 1581 | ||
| 1579 | projectmodules_id = check #struct.unpack("<H", dir_stream.read(2))[0] | 1582 | projectmodules_id = check #struct.unpack("<H", dir_stream.read(2))[0] |
| 1580 | check_value('PROJECTMODULES_Id', 0x000F, projectmodules_id) | 1583 | check_value('PROJECTMODULES_Id', 0x000F, projectmodules_id) |