From ebdb4e2d20ee635b2733be4b3222a1f74486d352 Mon Sep 17 00:00:00 2001 From: Philippe Lagadec Date: Sun, 11 Jan 2015 17:00:49 +0100 Subject: [PATCH] olevba: added new triage mode, options -t and -d --- oletools/olevba.py | 137 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 128 insertions(+), 9 deletions(-) diff --git a/oletools/olevba.py b/oletools/olevba.py index 8398eaa..6f48708 100644 --- a/oletools/olevba.py +++ b/oletools/olevba.py @@ -98,17 +98,18 @@ https://github.com/unixfreak0037/officeparser # 2015-01-08 v0.14 PL: - added hex strings detection and decoding # - fixed issue #2, decoding VBA stream names using # specified codepage and unicode stream names +# 2015-01-11 v0.15 PL: - added new triage mode, options -t and -d -__version__ = '0.14' +__version__ = '0.15' #------------------------------------------------------------------------------ # TODO: # + do not use logging, but a provided logger (null logger by default) # + setup logging (common with other oletools) -# + update readme, wiki and decalage.info, pypi (link to sample files) # TODO later: -# - append decoded hex strings to VBA code, in order to detect IOCs and suspicious keywords +# + append decoded hex strings to VBA code, in order to detect IOCs and suspicious keywords +# + do not show hex strings by default (add option --hex) # + performance improvement: instead of searching each keyword separately, # first split vba code into a list of words (per line), then check each # word against a dict. (or put vba words into a set/dict?) @@ -150,6 +151,9 @@ from thirdparty.xglob import xglob #--- CONSTANTS ---------------------------------------------------------------- +TYPE_OLE = 'OLE' +TYPE_OpenXML = 'OpenXML' + MODULE_EXTENSION = "bas" CLASS_EXTENSION = "cls" FORM_EXTENSION = "frm" @@ -237,7 +241,7 @@ RE_PATTERNS = ( ('URL', re.compile(r'(http|https|ftp)\://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(:[a-zA-Z0-9]*)?/?([a-zA-Z0-9\-\._\?\,\'/\\\+&%\$#\=~])*[^\.\,\)\(\s]')), ('IPv4 address', re.compile(r"\b(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\b")), ('E-mail address', re.compile(r'(?i)\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+(?:[A-Z]{2,12}|XN--[A-Z0-9]{4,18})\b')), - ('Domain name', re.compile(r'(?=^.{1,254}$)(^(?:(?!\d+\.|-)[a-zA-Z0-9_\-]{1,63}(?