Commit 04a633a6bb7c1438ce7d6b1ed4b1639e267f836e

Authored by Christian Herdtweck
1 parent f4b2a304

oleobj: Minor improvement to log messages

Firstly, not all zip files are ooxml files;
Secondly, show in debug mode that ole file is analyzed by debug-logging
  stream names
Showing 1 changed file with 4 additions and 4 deletions
oletools/oleobj.py
@@ -750,13 +750,13 @@ def process_file(filename, data, output_dir=None): @@ -750,13 +750,13 @@ def process_file(filename, data, output_dir=None):
750 750
751 xml_parser = None 751 xml_parser = None
752 if is_zipfile(filename): 752 if is_zipfile(filename):
753 - log.info('file is a OOXML file, looking for relationships with external links') 753 + log.info('file could be an OOXML file, looking for relationships with '
  754 + 'external links')
754 xml_parser = XmlParser(filename) 755 xml_parser = XmlParser(filename)
755 for relationship, target in find_external_relationships(xml_parser): 756 for relationship, target in find_external_relationships(xml_parser):
756 did_dump = True 757 did_dump = True
757 print("Found relationship '%s' with external link %s" % (relationship, target)) 758 print("Found relationship '%s' with external link %s" % (relationship, target))
758 759
759 -  
760 # look for ole files inside file (e.g. unzip docx) 760 # look for ole files inside file (e.g. unzip docx)
761 # have to finish work on every ole stream inside iteration, since handles 761 # have to finish work on every ole stream inside iteration, since handles
762 # are closed in find_ole 762 # are closed in find_ole
@@ -765,9 +765,9 @@ def process_file(filename, data, output_dir=None): @@ -765,9 +765,9 @@ def process_file(filename, data, output_dir=None):
765 continue 765 continue
766 766
767 for path_parts in ole.listdir(): 767 for path_parts in ole.listdir():
  768 + stream_path = '/'.join(path_parts)
  769 + log.debug('Checking stream %r', stream_path)
768 if path_parts[-1] == '\x01Ole10Native': 770 if path_parts[-1] == '\x01Ole10Native':
769 - stream_path = '/'.join(path_parts)  
770 - log.debug('Checking stream %r', stream_path)  
771 stream = None 771 stream = None
772 try: 772 try:
773 stream = ole.openstream(path_parts) 773 stream = ole.openstream(path_parts)