|
2 | 2 | # which is available at https://www.volatilityfoundation.org/license/vsl-v1.0 |
3 | 3 | # |
4 | 4 |
|
5 | | -import logging |
6 | | - |
7 | 5 | from volatility3.framework import interfaces, renderers |
| 6 | +from volatility3.framework.renderers import format_hints |
8 | 7 | from volatility3.framework.configuration import requirements |
9 | 8 | from volatility3.plugins.linux import pslist |
10 | 9 |
|
11 | | -vollog = logging.getLogger(__name__) |
12 | | - |
13 | 10 |
|
14 | 11 | class Check_creds(interfaces.plugins.PluginInterface): |
15 | 12 | """Checks if any processes are sharing credential structures""" |
16 | 13 |
|
17 | 14 | _required_framework_version = (2, 0, 0) |
18 | 15 |
|
19 | | - _version = (1, 0, 1) |
| 16 | + _version = (1, 1, 0) |
20 | 17 |
|
21 | 18 | @classmethod |
22 | 19 | def get_requirements(cls): |
@@ -54,18 +51,22 @@ def _generator(self): |
54 | 51 |
|
55 | 52 | cred_addr = task_cred_ptr.dereference().vol.offset |
56 | 53 |
|
57 | | - if cred_addr not in creds: |
58 | | - creds[cred_addr] = [] |
59 | | - |
| 54 | + creds.setdefault(cred_addr, []) |
60 | 55 | creds[cred_addr].append(task.pid) |
61 | 56 |
|
62 | | - for _, pids in creds.items(): |
| 57 | + for cred_addr, pids in creds.items(): |
63 | 58 | 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) |
69 | 66 |
|
70 | 67 | 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