Skip to content

instantiating OleID with data fails #695

@jloehel

Description

@jloehel

Error:

...
     oid = oletools.oleid.OleID(filename=self.filename, data=self.filedata)
  File "/opt/hostedtoolcache/Python/3.6.13/x64/lib/python3.6/site-packages/oletools/oleid.py", line 238, in __init__
    self.data_bytesio = io.BytesIO(self.data)
AttributeError: 'OleID' object has no attribute 'data'

Code:

oletools/oletools/oleid.py

Lines 234 to 238 in 75c0696

if data is None:
self.file_on_disk = True # useful for some check that don't work in memory
with open(filename, 'rb') as f:
self.data = f.read()
self.data_bytesio = io.BytesIO(self.data)

Fix:

if data is None: 
     self.file_on_disk = True  # useful for some check that don't work in memory 
     with open(filename, 'rb') as f: 
         self.data = f.read()
else:
     self.data = data
 self.data_bytesio = io.BytesIO(self.data)  

Metadata

Metadata

Assignees

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions