From 9e355a9d79489b76a81f9f796bc80e135be92a0a Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Wed, 27 Apr 2016 14:40:36 +0200 Subject: [PATCH] deal with case that offset in mso_file_extract might not be found, --- oletools/olevba.py | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/oletools/olevba.py b/oletools/olevba.py index 24eff4a..d85f743 100755 --- a/oletools/olevba.py +++ b/oletools/olevba.py @@ -871,25 +871,29 @@ def mso_file_extract(data): """ # check the magic: assert is_mso_file(data) + + # In all the samples seen so far, Word always uses an offset of 0x32, + # and Excel 0x22A. But we read the offset from the header to be more + # generic. + offsets = [0x32, 0x22A] + # First, attempt to get the compressed data offset from the header # According to my tests, it should be an unsigned 16 bits integer, # at offset 0x1E (little endian) + add 46: try: offset = struct.unpack_from('