From d9a13e56c8348b93f15980e139c9d28af673670f Mon Sep 17 00:00:00 2001 From: Christian Herdtweck Date: Fri, 19 Jan 2018 10:48:29 +0100 Subject: [PATCH] ooxml: Mention other file-like classes in ZipSubFile --- oletools/ooxml.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/oletools/ooxml.py b/oletools/ooxml.py index 6bf5d8d..0d15a44 100644 --- a/oletools/ooxml.py +++ b/oletools/ooxml.py @@ -95,11 +95,11 @@ def get_type(filename): logging.debug(u' ' + debug_str(elem)) try: is_xls |= elem.attrib['ContentType'].startswith( - CONTENT_TYPES_EXCEL) + CONTENT_TYPES_EXCEL) is_doc |= elem.attrib['ContentType'].startswith( - CONTENT_TYPES_WORD) + CONTENT_TYPES_WORD) is_ppt |= elem.attrib['ContentType'].startswith( - CONTENT_TYPES_PPT) + CONTENT_TYPES_PPT) except KeyError: # ContentType not an attr pass @@ -153,6 +153,9 @@ class ZipSubFile(object): handle: direct handle to subfile stream, created by ZipFile.open() pos: current position within stream (can deviate from actual position in self.handle if we fake jump to end) + + See also (and maybe could some day merge with): + ppt_record_parser.IterStream; also: oleobj.FakeFile """ def __init__(self, container, filename, mode='r', size=None): @@ -172,6 +175,15 @@ class ZipSubFile(object): self.pos = None self.closed = True + def readable(self): + return True + + def writable(self): + return False + + def seekable(self): + return True + def open(self): """ open subfile for reading; open mode given to constructor before """ if self.handle is not None: -- libgit2 0.21.4