Skip to content

Commit 941e40c

Browse files
committed
Fix get_name API, fix malfind
1 parent 1f983ac commit 941e40c

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

volatility3/framework/plugins/linux/elfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def _generator(self, tasks):
177177
name,
178178
format_hints.Hex(vma.vm_start),
179179
format_hints.Hex(vma.vm_end),
180-
path,
180+
path or renderers.NotAvailableValue(),
181181
file_output,
182182
),
183183
)

volatility3/framework/plugins/linux/malfind.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ def _list_injections(self, task):
5656
)
5757
if (
5858
vma.is_suspicious(proc_layer)
59-
and vma.get_name(self.context, task) != "[vdso]"
59+
and vma_name != "[vdso]"
6060
):
6161
data = proc_layer.read(vma.vm_start, 64, pad=True)
62-
yield vma, data
62+
yield vma, vma_name, data
6363

6464
def _generator(self, tasks):
6565
# determine if we're on a 32 or 64 bit kernel
@@ -71,7 +71,7 @@ def _generator(self, tasks):
7171
for task in tasks:
7272
process_name = utility.array_to_string(task.comm)
7373

74-
for vma, data in self._list_injections(task):
74+
for vma, vma_name, data in self._list_injections(task):
7575
if is_32bit_arch:
7676
architecture = "intel"
7777
else:
@@ -88,6 +88,7 @@ def _generator(self, tasks):
8888
process_name,
8989
format_hints.Hex(vma.vm_start),
9090
format_hints.Hex(vma.vm_end),
91+
vma_name or renderers.NotAvailableValue(),
9192
vma.get_protection(),
9293
format_hints.HexBytes(data),
9394
disasm,
@@ -103,6 +104,7 @@ def run(self):
103104
("Process", str),
104105
("Start", format_hints.Hex),
105106
("End", format_hints.Hex),
107+
("Path", str),
106108
("Protection", str),
107109
("Hexdump", format_hints.HexBytes),
108110
("Disasm", interfaces.renderers.Disassembly),

volatility3/framework/plugins/linux/proc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ def vma_filter_function(x: interfaces.objects.ObjectInterface) -> bool:
246246
major,
247247
minor,
248248
inode_num,
249-
path,
249+
path or renderers.NotAvailableValue(),
250250
file_output,
251251
),
252252
)

volatility3/framework/symbols/linux/extensions/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1056,7 +1056,7 @@ def get_page_offset(self) -> int:
10561056
parent_layer = self._context.layers[self.vol.layer_name]
10571057
return self.vm_pgoff << parent_layer.page_shift
10581058

1059-
def get_name(self, context, task):
1059+
def _do_get_name(self, context, task) -> str:
10601060
if self.vm_file != 0:
10611061
fname = linux.LinuxUtilities.path_for_file(context, task, self.vm_file)
10621062
elif self.vm_start <= task.mm.start_brk and self.vm_end >= task.mm.brk:
@@ -1072,6 +1072,12 @@ def get_name(self, context, task):
10721072
fname = "Anonymous Mapping"
10731073
return fname
10741074

1075+
def get_name(self, context, task) -> Optional[str]:
1076+
try:
1077+
return self._do_get_name(context, task)
1078+
except exceptions.InvalidAddressException:
1079+
return None
1080+
10751081
# used by malfind
10761082
def is_suspicious(self, proclayer=None):
10771083
ret = False

0 commit comments

Comments
 (0)