Commit 805c5a1bb6120608e6ddcc05b8d240ccedfde326

Authored by Christian Herdtweck
1 parent d966bbba

record_base: Do not care about encryption

Showing 1 changed file with 3 additions and 10 deletions
oletools/record_base.py
... ... @@ -74,7 +74,6 @@ PARENT_DIR = os.path.normpath(os.path.dirname(os.path.dirname(
74 74 if PARENT_DIR not in sys.path:
75 75 sys.path.insert(0, PARENT_DIR)
76 76 del PARENT_DIR
77   -from oletools.common.errors import FileIsEncryptedError
78 77 from oletools import oleid
79 78  
80 79  
... ... @@ -127,10 +126,9 @@ class OleRecordFile(olefile.OleFileIO):
127 126 """
128 127  
129 128 def open(self, filename, *args, **kwargs):
130   - """Call OleFileIO.open, raise error if is encrypted."""
  129 + """Call OleFileIO.open."""
131 130 #super(OleRecordFile, self).open(filename, *args, **kwargs)
132 131 OleFileIO.open(self, filename, *args, **kwargs)
133   - self.is_encrypted = oleid.OleID(self).check_encrypted().value
134 132  
135 133 @classmethod
136 134 def stream_class_for_name(cls, stream_name):
... ... @@ -163,8 +161,7 @@ class OleRecordFile(olefile.OleFileIO):
163 161 stream = clz(self._open(direntry.isectStart, direntry.size),
164 162 direntry.size,
165 163 None if is_orphan else direntry.name,
166   - direntry.entry_type,
167   - self.is_encrypted)
  164 + direntry.entry_type)
168 165 yield stream
169 166 stream.close()
170 167  
... ... @@ -177,14 +174,13 @@ class OleRecordStream(object):
177 174 abstract base class
178 175 """
179 176  
180   - def __init__(self, stream, size, name, stream_type, is_encrypted=False):
  177 + def __init__(self, stream, size, name, stream_type):
181 178 self.stream = stream
182 179 self.size = size
183 180 self.name = name
184 181 if stream_type not in ENTRY_TYPE2STR:
185 182 raise ValueError('Unknown stream type: {0}'.format(stream_type))
186 183 self.stream_type = stream_type
187   - self.is_encrypted = is_encrypted
188 184  
189 185 def read_record_head(self):
190 186 """ read first few bytes of record to determine size and type
... ... @@ -213,9 +209,6 @@ class OleRecordStream(object):
213 209  
214 210 Stream must be positioned at start of records (e.g. start of stream).
215 211 """
216   - if self.is_encrypted:
217   - raise FileIsEncryptedError()
218   -
219 212 while True:
220 213 # unpacking as in olevba._extract_vba
221 214 pos = self.stream.tell()
... ...