Skip to content

Commit ebbbe91

Browse files
committed
Convert remaining values to Python primitives
1 parent 1d20e65 commit ebbbe91

File tree

1 file changed

+30
-7
lines changed

1 file changed

+30
-7
lines changed

volatility3/framework/plugins/windows/mftscan.py

Lines changed: 30 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -224,11 +224,17 @@ def _generator(self):
224224
self.config_path,
225225
self.config["primary"],
226226
):
227+
# Convert all `objects.PrimitiveObject` to their simpler Python
228+
# types. This is normally not something we would do, since it's
229+
# lossy and prevents users from getting back to the data source,
230+
# but in this case memory usage is so extreme due to the number of
231+
# records that it becomes necessary. The rich types are still
232+
# exposed through classmethods.
227233
yield level, (
228234
record.offset,
229235
record.record_type,
230-
record.record_number,
231-
record.link_count,
236+
int(record.record_number),
237+
int(record.link_count),
232238
record.mft_type,
233239
record.permissions,
234240
record.attribute_type,
@@ -341,12 +347,16 @@ def _generator(self):
341347
self.config["primary"],
342348
):
343349
for record in self.parse_ads_data_records(mft_entry):
344-
# Convert to basic strings here __only__ because they'll use so
345-
# much memory in the tree otherwise.
350+
# Convert all `objects.PrimitiveObject` to their simpler Python
351+
# types. This is normally not something we would do, since it's
352+
# lossy and prevents users from getting back to the data source,
353+
# but in this case memory usage is so extreme due to the number of
354+
# records that it becomes necessary. The rich types are still
355+
# exposed through classmethods.
346356
yield 0, (
347357
record.offset,
348-
record.signature,
349-
record.record_number,
358+
str(record.signature),
359+
int(record.record_number),
350360
record.attribute_type,
351361
(
352362
str(record.filename)
@@ -447,7 +457,20 @@ def _generator(self):
447457
):
448458
resident_data_entry = self.parse_resident_data(mft_record)
449459
if resident_data_entry:
450-
yield 0, resident_data_entry
460+
# Convert all `objects.PrimitiveObject` to their simpler Python
461+
# types. This is normally not something we would do, since it's
462+
# lossy and prevents users from getting back to the data source,
463+
# but in this case memory usage is so extreme due to the number of
464+
# records that it becomes necessary. The rich types are still
465+
# exposed through classmethods.
466+
yield 0, (
467+
resident_data_entry.offset,
468+
resident_data_entry.signature,
469+
int(resident_data_entry.record_number),
470+
resident_data_entry.attribute_type,
471+
str(resident_data_entry.filename),
472+
resident_data_entry.content,
473+
)
451474

452475
def run(self):
453476
return renderers.TreeGrid(

0 commit comments

Comments
 (0)