From aeba6ed90827829fac211b3ace2a8952f7441d60 Mon Sep 17 00:00:00 2001 From: decalage2 Date: Tue, 13 Sep 2016 21:56:22 +0200 Subject: [PATCH] ppt_parser: fixed olefile import for Python 2+3 --- oletools/ppt_parser.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/oletools/ppt_parser.py b/oletools/ppt_parser.py index a36867d..319160c 100644 --- a/oletools/ppt_parser.py +++ b/oletools/ppt_parser.py @@ -3,7 +3,7 @@ Based on olefile, parse the ppt-specific info Code much influenced by olevba._extract_vba but much more object-oriented -(possibly slightly excessivly so) +(possibly slightly excessively so) Currently quite narrowly focused on extracting VBA from ppt files, no slides or stuff, but built to be extended to parsing more/all of the file @@ -26,18 +26,27 @@ References: # CHANGELOG: # 2016-05-04 v0.01 CH: - start parsing "Current User" stream # 2016-07-20 v0.50 SL: - added Python 3 support +# 2016-09-13 PL: - fixed olefile import for Python 2+3 __version__ = '0.50' -#--- IMPORTS ------------------------------------------------------------------ +# --- IMPORTS ------------------------------------------------------------------ + import sys import logging import struct import traceback import os -import oletools.thirdparty.olefile as olefile +try: + # absolute import when oletools is installed + import oletools.thirdparty.olefile as olefile +except: + # relative import otherwise + import thirdparty.olefile as olefile + +# TODO: fix zlib import for Python 2.6 import zlib -- libgit2 0.21.4