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