Commit 55b75d0c1642f59ab8b0fcc5d167f4c4d238c95b

Authored by Christian Herdtweck
1 parent e07a649f

wrap long lines

Showing 1 changed file with 17 additions and 9 deletions
oletools/ppt_parser.py
@@ -133,7 +133,7 @@ class RecordHeader(object): @@ -133,7 +133,7 @@ class RecordHeader(object):
133 obj.rec_instance, obj.rec_ver = divmod(version_instance, 2**4) 133 obj.rec_instance, obj.rec_ver = divmod(version_instance, 2**4)
134 obj.rec_type, = struct.unpack('<H', stream.read(2)) 134 obj.rec_type, = struct.unpack('<H', stream.read(2))
135 obj.rec_len, = struct.unpack('<L', stream.read(4)) 135 obj.rec_len, = struct.unpack('<L', stream.read(4))
136 - #log.debug('type is {0:04X}, instance {1:04X}, version {2:04X}, len {3}' 136 + #log.debug('type is {0:04X}, instance {1:04X}, version {2:04X},len {3}'
137 # .format(obj.rec_type, obj.rec_instance, obj.rec_ver, 137 # .format(obj.rec_type, obj.rec_instance, obj.rec_ver,
138 # obj.rec_len)) 138 # obj.rec_len))
139 return obj 139 return obj
@@ -743,20 +743,23 @@ class DocumentContainer(PptType): @@ -743,20 +743,23 @@ class DocumentContainer(PptType):
743 # specifies size information for presentation slides and notes slides. 743 # specifies size information for presentation slides and notes slides.
744 obj.document_atom = DummyType('DocumentAtom', 0x03E9, rec_ver=0x1, 744 obj.document_atom = DummyType('DocumentAtom', 0x03E9, rec_ver=0x1,
745 rec_len=0x28).extract_from(stream) 745 rec_len=0x28).extract_from(stream)
746 - log.info('validity: {} errs'.format(len(obj.document_atom.check_validity()))) 746 + log.info('validity: {} errs'
  747 + .format(len(obj.document_atom.check_validity())))
747 748
748 # exObjList (variable): An optional ExObjListContainer record (section 749 # exObjList (variable): An optional ExObjListContainer record (section
749 # 2.10.1) that specifies the list of external objects in the document. 750 # 2.10.1) that specifies the list of external objects in the document.
750 obj.ex_obj_list = DummyType('ExObjListContainer', 0x0409, rec_ver=0xF)\ 751 obj.ex_obj_list = DummyType('ExObjListContainer', 0x0409, rec_ver=0xF)\
751 .extract_from(stream) 752 .extract_from(stream)
752 - log.info('validity: {} errs'.format(len(obj.ex_obj_list.check_validity()))) 753 + log.info('validity: {} errs'
  754 + .format(len(obj.ex_obj_list.check_validity())))
753 755
754 # documentTextInfo (variable): A DocumentTextInfoContainer record 756 # documentTextInfo (variable): A DocumentTextInfoContainer record
755 # (section 2.9.1) that specifies the default text styles for the 757 # (section 2.9.1) that specifies the default text styles for the
756 # document. 758 # document.
757 obj.document_text_info = DummyType('DocumentTextInfoContainer', 0x03F2, 759 obj.document_text_info = DummyType('DocumentTextInfoContainer', 0x03F2,
758 rec_ver=0xF).extract_from(stream) 760 rec_ver=0xF).extract_from(stream)
759 - log.info('validity: {} errs'.format(len(obj.document_text_info.check_validity()))) 761 + log.info('validity: {} errs'
  762 + .format(len(obj.document_text_info.check_validity())))
760 763
761 # soundCollection (variable): An optional SoundCollectionContainer 764 # soundCollection (variable): An optional SoundCollectionContainer
762 # record (section 2.4.16.1) that specifies the list of sounds in the 765 # record (section 2.4.16.1) that specifies the list of sounds in the
@@ -764,20 +767,23 @@ class DocumentContainer(PptType): @@ -764,20 +767,23 @@ class DocumentContainer(PptType):
764 obj.sound_collection = DummyType('SoundCollectionContainer', 0x07E4, 767 obj.sound_collection = DummyType('SoundCollectionContainer', 0x07E4,
765 rec_ver=0xF, rec_instance=0x005)\ 768 rec_ver=0xF, rec_instance=0x005)\
766 .extract_from(stream) 769 .extract_from(stream)
767 - log.info('validity: {} errs'.format(len(obj.sound_collection.check_validity()))) 770 + log.info('validity: {} errs'
  771 + .format(len(obj.sound_collection.check_validity())))
768 772
769 # drawingGroup (variable): A DrawingGroupContainer record (section 773 # drawingGroup (variable): A DrawingGroupContainer record (section
770 # 2.4.3) that specifies drawing information for the document. 774 # 2.4.3) that specifies drawing information for the document.
771 obj.drawing_group = DummyType('DrawingGroupContainer', 0x040B, 775 obj.drawing_group = DummyType('DrawingGroupContainer', 0x040B,
772 rec_ver=0xF).extract_from(stream) 776 rec_ver=0xF).extract_from(stream)
773 - log.info('validity: {} errs'.format(len(obj.drawing_group.check_validity()))) 777 + log.info('validity: {} errs'
  778 + .format(len(obj.drawing_group.check_validity())))
774 779
775 # masterList (variable): A MasterListWithTextContainer record (section 780 # masterList (variable): A MasterListWithTextContainer record (section
776 # 2.4.14.1) that specifies the list of main master slides and title 781 # 2.4.14.1) that specifies the list of main master slides and title
777 # master slides. 782 # master slides.
778 obj.master_list = DummyType('MasterListWithContainer', 0x0FF0, 783 obj.master_list = DummyType('MasterListWithContainer', 0x0FF0,
779 rec_ver=0xF).extract_from(stream) 784 rec_ver=0xF).extract_from(stream)
780 - log.info('validity: {} errs'.format(len(obj.master_list.check_validity()))) 785 + log.info('validity: {} errs'
  786 + .format(len(obj.master_list.check_validity())))
781 787
782 # docInfoList (variable): An optional DocInfoListContainer record 788 # docInfoList (variable): An optional DocInfoListContainer record
783 # (section 2.4.4) that specifies additional document information. 789 # (section 2.4.4) that specifies additional document information.
@@ -1364,7 +1370,8 @@ class PptParser(object): @@ -1364,7 +1370,8 @@ class PptParser(object):
1364 1370
1365 errs = container.check_validity() 1371 errs = container.check_validity()
1366 if errs: 1372 if errs:
1367 - log.warning('check_validity found {} issues'.format(len(errs))) 1373 + log.warning('check_validity found {} issues'
  1374 + .format(len(errs)))
1368 else: 1375 else:
1369 log.debug('container is ok') 1376 log.debug('container is ok')
1370 atom = container.vba_info_atom 1377 atom = container.vba_info_atom
@@ -1562,7 +1569,8 @@ def test(): @@ -1562,7 +1569,8 @@ def test():
1562 for storage in storages: 1569 for storage in storages:
1563 parser = VBA_Parser(None, ppt.decompress_vba_storage(storage), 1570 parser = VBA_Parser(None, ppt.decompress_vba_storage(storage),
1564 container='PptParser') 1571 container='PptParser')
1565 - for vba_root, project_path, dir_path in parser.find_vba_projects(): 1572 + for vba_root, project_path, dir_path in \
  1573 + parser.find_vba_projects():
1566 log.info('found vba project: root={}, proj={}, dir={}' 1574 log.info('found vba project: root={}, proj={}, dir={}'
1567 .format(vba_root, project_path, dir_path)) 1575 .format(vba_root, project_path, dir_path))
1568 for subfilename, stream_path, vba_filename, vba_code in \ 1576 for subfilename, stream_path, vba_filename, vba_code in \