diff --git a/oletools/oledir.py b/oletools/oledir.py index 8d6ef2c..adeae1d 100755 --- a/oletools/oledir.py +++ b/oletools/oledir.py @@ -94,7 +94,7 @@ STATUS_COLORS = { if __name__ == '__main__': # print banner with version - print 'oledir %s - http://decalage.info/python/oletools' % __version__ + print('oledir %s - http://decalage.info/python/oletools' % __version__) if os.name == 'nt': colorclass.Windows.enable(auto_colors=True, reset_atexit=True) @@ -126,7 +126,7 @@ if __name__ == '__main__': # TODO: oledir option to hexdump the raw direntries # TODO: olefile should be less picky about incorrect directory structures - for id in xrange(len(ole.direntries)): + for id in range(len(ole.direntries)): d = ole.direntries[id] if d is None: # this direntry is not part of the tree: either unused or an orphan diff --git a/oletools/olevba.py b/oletools/olevba.py index 1e3d78e..633e17f 100755 --- a/oletools/olevba.py +++ b/oletools/olevba.py @@ -2180,7 +2180,7 @@ class VBA_Parser(object): if data is None: data = open(filename, 'rb').read() # check if it is a Word 2003 XML file (WordProcessingML): must contain the namespace - if 'http://schemas.microsoft.com/office/word/2003/wordml' in data: + if b'http://schemas.microsoft.com/office/word/2003/wordml' in data: self.open_word2003xml(data) # store a lowercase version for the next tests: data_lowercase = data.lower() @@ -2190,14 +2190,14 @@ class VBA_Parser(object): # and even whitespaces in between "MIME", "-", "Version" and ":". The version number is ignored. # And the line is case insensitive. # so we'll just check the presence of mime, version and multipart anywhere: - if self.type is None and 'mime' in data_lowercase and 'version' in data_lowercase \ - and 'multipart' in data_lowercase: + if self.type is None and b'mime' in data_lowercase and b'version' in data_lowercase \ + and b'multipart' in data_lowercase: self.open_mht(data) #TODO: handle exceptions #TODO: Excel 2003 XML # Check if this is a plain text VBA or VBScript file: # To avoid scanning binary files, we simply check for some control chars: - if self.type is None and '\x00' not in data: + if self.type is None and b'\x00' not in data: self.open_text(data) if self.type is None: # At this stage, could not match a known format: