Commit 3f71600966179193a2b25a7912dd384bc28a7acc

Authored by decalage2
1 parent 5c8a35c9

olevba: avoid printing form strings when it is empty or "Tahoma"

Showing 1 changed file with 7 additions and 5 deletions
oletools/olevba.py
@@ -3298,7 +3298,8 @@ class VBA_Parser(object): @@ -3298,7 +3298,8 @@ class VBA_Parser(object):
3298 # Extract printable strings from the form object stream "o": 3298 # Extract printable strings from the form object stream "o":
3299 for m in re_printable_string.finditer(form_data): 3299 for m in re_printable_string.finditer(form_data):
3300 log.debug('Printable string found in form: %r' % m.group()) 3300 log.debug('Printable string found in form: %r' % m.group())
3301 - yield (self.filename, '/'.join(o_stream), m.group()) 3301 + if m.group() != b'Tahoma':
  3302 + yield (self.filename, '/'.join(o_stream), m.group())
3302 3303
3303 def extract_form_strings_extended(self): 3304 def extract_form_strings_extended(self):
3304 if self.ole_file is None: 3305 if self.ole_file is None:
@@ -3494,10 +3495,11 @@ class VBA_Parser_CLI(VBA_Parser): @@ -3494,10 +3495,11 @@ class VBA_Parser_CLI(VBA_Parser):
3494 log.error('Unicode conversion to be fixed before colorizing the output') 3495 log.error('Unicode conversion to be fixed before colorizing the output')
3495 print(vba_code_filtered) 3496 print(vba_code_filtered)
3496 for (subfilename, stream_path, form_string) in self.extract_form_strings(): 3497 for (subfilename, stream_path, form_string) in self.extract_form_strings():
3497 - print('-' * 79)  
3498 - print('VBA FORM STRING IN %r - OLE stream: %r' % (subfilename, stream_path))  
3499 - print('- ' * 39)  
3500 - print(form_string) 3498 + if form_string is not None:
  3499 + print('-' * 79)
  3500 + print('VBA FORM STRING IN %r - OLE stream: %r' % (subfilename, stream_path))
  3501 + print('- ' * 39)
  3502 + print(form_string)
3501 try: 3503 try:
3502 for (subfilename, stream_path, form_variables) in self.extract_form_strings_extended(): 3504 for (subfilename, stream_path, form_variables) in self.extract_form_strings_extended():
3503 if form_variables is not None: 3505 if form_variables is not None: