Commit bcd944f568335ac6f3fa2cfe26e0d7abca57210a
1 parent
276fe51a
olevba: return encryption error return code when appropriate
Showing
1 changed file
with
7 additions
and
0 deletions
oletools/olevba.py
| ... | ... | @@ -3996,6 +3996,13 @@ def main(cmd_line_args=None): |
| 3996 | 3996 | print_json(type='MetaInformation', return_code=return_code, |
| 3997 | 3997 | n_processed=count, _json_is_last=True) |
| 3998 | 3998 | |
| 3999 | + except crypto.CryptoErrorBase as exc: | |
| 4000 | + log.exception('Problems with encryption in main: {}'.format(exc), | |
| 4001 | + exc_info=True) | |
| 4002 | + if return_code == RETURN_OK: | |
| 4003 | + return_code = RETURN_ENCRYPTED | |
| 4004 | + else: | |
| 4005 | + return_code == RETURN_SEVERAL_ERRS | |
| 3999 | 4006 | except Exception as exc: |
| 4000 | 4007 | # some unexpected error, maybe some of the types caught in except clauses |
| 4001 | 4008 | # above were not sufficient. This is very bad, so log complete trace at exception level | ... | ... |