Skip to content

Commit bceae67

Browse files
committed
Windows Handles: Update dependents
This updates the plugins that depend on `Handles` with the correct required version number, as well as calls to the new handles classmethods where needed.
1 parent bb91d68 commit bceae67

File tree

4 files changed

+23
-33
lines changed

4 files changed

+23
-33
lines changed

volatility3/framework/plugins/windows/callbacks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
4848
name="driverirp", component=driverirp.DriverIrp, version=(1, 0, 0)
4949
),
5050
requirements.VersionRequirement(
51-
name="handles", component=handles.Handles, version=(3, 0, 0)
51+
name="handles", component=handles.Handles, version=(4, 0, 0)
5252
),
5353
]
5454

volatility3/framework/plugins/windows/dumpfiles.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,12 @@
55
import logging
66
import ntpath
77
import re
8-
from typing import List, Tuple, Type, Optional, Generator
9-
10-
from volatility3.framework import (
11-
interfaces,
12-
exceptions,
13-
constants,
14-
renderers,
15-
)
8+
from typing import Generator, List, Optional, Tuple, Type
9+
10+
from volatility3.framework import constants, exceptions, interfaces, renderers
1611
from volatility3.framework.configuration import requirements
1712
from volatility3.framework.renderers import format_hints
18-
from volatility3.plugins.windows import handles
19-
from volatility3.plugins.windows import pslist
13+
from volatility3.plugins.windows import handles, pslist
2014

2115
vollog = logging.getLogger(__name__)
2216

@@ -76,7 +70,7 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
7670
name="pslist", component=pslist.PsList, version=(3, 0, 0)
7771
),
7872
requirements.VersionRequirement(
79-
name="handles", component=handles.Handles, version=(3, 0, 0)
73+
name="handles", component=handles.Handles, version=(4, 0, 0)
8074
),
8175
]
8276

@@ -231,14 +225,11 @@ def _generator(self, procs: List, offsets: List):
231225
# private variables, so we need an instance (for now, anyway). We _could_ call Handles._generator()
232226
# to do some of the other work that is duplicated here, but then we'd need to parse the TreeGrid
233227
# results instead of just dealing with them as direct objects here.
234-
handles_plugin = handles.Handles(
235-
context=self.context, config_path=self._config_path
236-
)
237-
type_map = handles_plugin.get_type_map(
228+
type_map = handles.Handles.get_type_map(
238229
context=self.context,
239230
kernel_module_name=self.config["kernel"],
240231
)
241-
cookie = handles_plugin.find_cookie(
232+
cookie = handles.Handles.find_cookie(
242233
context=self.context,
243234
kernel_module_name=self.config["kernel"],
244235
)
@@ -255,7 +246,11 @@ def _generator(self, procs: List, offsets: List):
255246
)
256247
continue
257248

258-
for entry in handles_plugin.handles(object_table):
249+
for entry in handles.Handles.handles(
250+
context=self.context,
251+
kernel_module_name=self.config["kernel"],
252+
handle_table=object_table,
253+
):
259254
try:
260255
obj_type = entry.get_object_type(type_map, cookie)
261256
if obj_type == "File":

volatility3/framework/plugins/windows/poolscanner.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
142142
architectures=["Intel32", "Intel64"],
143143
),
144144
requirements.VersionRequirement(
145-
name="handles", component=handles.Handles, version=(3, 0, 0)
145+
name="handles", component=handles.Handles, version=(4, 0, 0)
146146
),
147147
requirements.VersionRequirement(
148148
name="pool_header_scanner",

volatility3/framework/plugins/windows/psxview.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@
99
from volatility3.framework.interfaces import plugins
1010
from volatility3.framework.renderers import format_hints
1111
from volatility3.framework.symbols.windows import extensions
12-
from volatility3.plugins.windows import (
13-
handles,
14-
pslist,
15-
psscan,
16-
thrdscan,
17-
)
12+
from volatility3.plugins.windows import handles, pslist, psscan, thrdscan
1813

1914
vollog = logging.getLogger(__name__)
2015

@@ -58,7 +53,7 @@ def get_requirements(cls):
5853
name="thrdscan", component=thrdscan.ThrdScan, version=(2, 0, 0)
5954
),
6055
requirements.VersionRequirement(
61-
name="handles", component=handles.Handles, version=(3, 0, 0)
56+
name="handles", component=handles.Handles, version=(4, 0, 0)
6257
),
6358
requirements.BooleanRequirement(
6459
name="physical-offsets",
@@ -144,15 +139,11 @@ def _check_csrss_handles(
144139
) -> Dict[int, extensions.EPROCESS]:
145140
ret: List[extensions.EPROCESS] = []
146141

147-
handles_plugin = handles.Handles(
148-
context=self.context, config_path=self.config_path
149-
)
150-
151-
type_map = handles_plugin.get_type_map(
142+
type_map = handles.Handles.get_type_map(
152143
context=self.context, kernel_module_name=self.config["kernel"]
153144
)
154145

155-
cookie = handles_plugin.find_cookie(
146+
cookie = handles.Handles.find_cookie(
156147
context=self.context, kernel_module_name=self.config["kernel"]
157148
)
158149

@@ -164,7 +155,11 @@ def _check_csrss_handles(
164155
try:
165156
ret += [
166157
handle.Body.cast("_EPROCESS")
167-
for handle in handles_plugin.handles(p.ObjectTable)
158+
for handle in handles.Handles.handles(
159+
context=self.context,
160+
kernel_module_name=self.config["kernel"],
161+
handle_table=p.ObjectTable,
162+
)
168163
if handle.get_object_type(type_map, cookie) == "Process"
169164
]
170165
except exceptions.InvalidAddressException:

0 commit comments

Comments
 (0)