From 2a69ce37647c0f57a23f39cecf549f68bb02af85 Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 22 Jul 2016 16:16:58 +0200 Subject: [PATCH] check for mac codepages when decoding project codepage --- oletools/olevba.py | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/oletools/olevba.py b/oletools/olevba.py index 1dafcb5..fee76b9 100755 --- a/oletools/olevba.py +++ b/oletools/olevba.py @@ -380,6 +380,22 @@ RETURN_PARSE_ERROR = 6 RETURN_SEVERAL_ERRS = 7 RETURN_UNEXPECTED = 8 +# MAC codepages (from http://stackoverflow.com/questions/1592925/decoding-mac-os-text-in-python) +MAC_CODEPAGES = { + 10000: 'mac-roman', + 10001: 'shiftjis', # not found: 'mac-shift-jis', + 10003: 'ascii', # nothing appropriate found: 'mac-hangul', + 10008: 'gb2321', # not found: 'mac-gb2312', + 10002: 'big5', # not found: 'mac-big5', + 10005: 'hebrew', # not found: 'mac-hebrew', + 10004: 'mac-arabic', + 10006: 'mac-greek', + 10081: 'mac-turkish', + 10021: 'thai', # not found: mac-thai', + 10029: 'maccentraleurope', # not found: 'mac-east europe', + 10007: 'ascii', # nothing appropriate found: 'mac-russian', +} + # URL and message to report issues: URL_OLEVBA_ISSUES = 'https://github.com/decalage2/oletools/issues' MSG_OLEVBA_ISSUES = 'Please report this issue on %s' % URL_OLEVBA_ISSUES @@ -1347,7 +1363,9 @@ def _extract_vba(ole, vba_root, project_path, dir_path, relaxed=False): reference_sizeof_name = struct.unpack("