From 4045b6cc8e99a9610d1b39370b3fb2a80f666741 Mon Sep 17 00:00:00 2001 From: David McDonald Date: Tue, 8 Apr 2025 09:30:31 -0500 Subject: [PATCH] InodePages: Add output column and render when dumped Previously, the InodePages plugin wasn't rendering treegrid columns when the `--dump` flag was passed. This fixes that, and adds an additional `Output File` column that displays the name of the file containing the dumped data. --- volatility3/framework/plugins/linux/pagecache.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/volatility3/framework/plugins/linux/pagecache.py b/volatility3/framework/plugins/linux/pagecache.py index 0bb3b9263..60b8b066b 100644 --- a/volatility3/framework/plugins/linux/pagecache.py +++ b/volatility3/framework/plugins/linux/pagecache.py @@ -8,7 +8,7 @@ import datetime import time import tarfile from dataclasses import dataclass, astuple -from typing import IO, List, Set, Type, Iterable, Tuple +from typing import IO, List, Set, Type, Iterable, Tuple, Union from io import BytesIO from pathlib import PurePath @@ -541,6 +541,7 @@ class InodePages(plugins.PluginInterface): self, inode: interfaces.objects.ObjectInterface, vmlinux_layer: interfaces.layers.TranslationLayerInterface, + filename: Union[renderers.NotApplicableValue, str], ) -> Iterable[Tuple[int, int, int, int, bool, str]]: inode_size = inode.i_size try: @@ -569,6 +570,7 @@ class InodePages(plugins.PluginInterface): page_index, dump_safe, page_flags, + filename, ) yield 0, fields @@ -610,6 +612,7 @@ class InodePages(plugins.PluginInterface): vollog.error("The inode is not a regular file") return None + filename = renderers.NotApplicableValue() if self.config["dump"]: open_method = self.open inode_address = inode.vol.offset @@ -618,8 +621,7 @@ class InodePages(plugins.PluginInterface): self.write_inode_content_to_file( self.context, vmlinux_layer.name, inode, filename, open_method ) - else: - yield from self._generate_inode_fields(inode, vmlinux_layer) + yield from self._generate_inode_fields(inode, vmlinux_layer, filename) def run(self): headers = [ @@ -629,6 +631,7 @@ class InodePages(plugins.PluginInterface): ("Index", int), ("DumpSafe", bool), ("Flags", str), + ("Output File", str), ] return renderers.TreeGrid(