Commit 957ac61c790df66f690120a94b78118d4b213756

Authored by Philippe Lagadec
1 parent 45ffe2d1

olevba: detect_autoexec() is now case-insensitive

Showing 1 changed file with 5 additions and 2 deletions
oletools/olevba.py
@@ -84,8 +84,9 @@ Usage: olevba.py <file> @@ -84,8 +84,9 @@ Usage: olevba.py <file>
84 # 2014-12-10 v0.06 PL: - hide first lines with VB attributes 84 # 2014-12-10 v0.06 PL: - hide first lines with VB attributes
85 # - detect auto-executable macros 85 # - detect auto-executable macros
86 # - ignore empty macros 86 # - ignore empty macros
  87 +# 2014-12-14 v0.07 PL: - detect_autoexec() is now case-insensitive
87 88
88 -__version__ = '0.06' 89 +__version__ = '0.07'
89 90
90 #------------------------------------------------------------------------------ 91 #------------------------------------------------------------------------------
91 # TODO: 92 # TODO:
@@ -694,10 +695,12 @@ def detect_autoexec(vba_code): @@ -694,10 +695,12 @@ def detect_autoexec(vba_code):
694 :param vba_code: str, VBA source code 695 :param vba_code: str, VBA source code
695 :return: list of str tuples (keyword, description) 696 :return: list of str tuples (keyword, description)
696 """ 697 """
  698 + # case-insensitive search
  699 + vba_code = vba_code.lower()
697 results = [] 700 results = []
698 for description, keywords in AUTOEXEC_KEYWORDS.items(): 701 for description, keywords in AUTOEXEC_KEYWORDS.items():
699 for keyword in keywords: 702 for keyword in keywords:
700 - if keyword in vba_code: 703 + if keyword.lower() in vba_code:
701 results.append((keyword, description)) 704 results.append((keyword, description))
702 return results 705 return results
703 706