Skip to content

Commit 9e84717

Browse files
committed
Improving code and adding the credential virtual addresses to the output.
1 parent 037eb1c commit 9e84717

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

volatility3/framework/plugins/linux/check_creds.py

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,18 @@
22
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
33
#
44

5-
import logging
6-
75
from volatility3.framework import interfaces, renderers
6+
from volatility3.framework.renderers import format_hints
87
from volatility3.framework.configuration import requirements
98
from volatility3.plugins.linux import pslist
109

11-
vollog = logging.getLogger(__name__)
12-
1310

1411
class Check_creds(interfaces.plugins.PluginInterface):
1512
"""Checks if any processes are sharing credential structures"""
1613

1714
_required_framework_version = (2, 0, 0)
1815

19-
_version = (1, 0, 1)
16+
_version = (1, 1, 0)
2017

2118
@classmethod
2219
def get_requirements(cls):
@@ -54,18 +51,22 @@ def _generator(self):
5451

5552
cred_addr = task_cred_ptr.dereference().vol.offset
5653

57-
if cred_addr not in creds:
58-
creds[cred_addr] = []
59-
54+
creds.setdefault(cred_addr, [])
6055
creds[cred_addr].append(task.pid)
6156

62-
for _, pids in creds.items():
57+
for cred_addr, pids in creds.items():
6358
if len(pids) > 1:
64-
pid_str = ""
65-
for pid in pids:
66-
pid_str = pid_str + f"{pid:d}, "
67-
pid_str = pid_str[:-2]
68-
yield (0, [str(pid_str)])
59+
pid_str = ", ".join([str(pid) for pid in pids])
60+
61+
fields = [
62+
format_hints.Hex(cred_addr),
63+
pid_str,
64+
]
65+
yield (0, fields)
6966

7067
def run(self):
71-
return renderers.TreeGrid([("PIDs", str)], self._generator())
68+
headers = [
69+
("CredVAddr", format_hints.Hex),
70+
("PIDs", str),
71+
]
72+
return renderers.TreeGrid(headers, self._generator())

0 commit comments

Comments
 (0)