From d183de8a8d80a21bb8a94381d12e1d23becfdb28 Mon Sep 17 00:00:00 2001 From: decalage2 Date: Tue, 13 Sep 2016 18:45:26 +0200 Subject: [PATCH] olevba: enabled packrat to improve pyparsing performance --- oletools/olevba.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/oletools/olevba.py b/oletools/olevba.py index 7e9f622..80f296c 100755 --- a/oletools/olevba.py +++ b/oletools/olevba.py @@ -183,6 +183,7 @@ https://github.com/unixfreak0037/officeparser # - detect_autoexec now returns the exact keyword found # 2016-09-05 PL: - added autoexec keywords for MS Publisher (.pub) # 2016-09-06 PL: - fixed issue #20, is_zipfile on Python 2.6 +# 2016-09-12 PL: - enabled packrat to improve pyparsing performance __version__ = '0.50' @@ -256,7 +257,7 @@ from thirdparty.pyparsing.pyparsing import \ CaselessKeyword, CaselessLiteral, Combine, Forward, Literal, \ Optional, QuotedString,Regex, Suppress, Word, WordStart, \ alphanums, alphas, hexnums,nums, opAssoc, srange, \ - infixNotation + infixNotation, ParserElement import ppt_parser # monkeypatch email to fix issue #32: @@ -671,6 +672,10 @@ re_printable_string = re.compile(r'[\t\r\n\x20-\xFF]{5,}') # TODO: set whitespaces according to VBA # TODO: merge extended lines before parsing +# Enable PackRat for better performance: +# (see https://pythonhosted.org/pyparsing/pyparsing.ParserElement-class.html#enablePackrat) +ParserElement.enablePackrat() + # VBA identifier chars (from MS-VBAL 3.3.5) vba_identifier_chars = alphanums + '_' -- libgit2 0.21.4