Skip to content

Commit db55f23

Browse files
committed
Windows: Callbacks - fix breaking API change
Moves as much of the `is_parseable` check as possible back into an `is_valid` method to avoid breaking API changes.
1 parent 8ad592a commit db55f23

File tree

1 file changed

+25
-8
lines changed
  • volatility3/framework/symbols/windows/extensions

1 file changed

+25
-8
lines changed

volatility3/framework/symbols/windows/extensions/callbacks.py

Lines changed: 25 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ class _SHUTDOWN_PACKET(objects.StructType, pool.ExecutiveObject):
1515
It exposes a function which sanity-checks structure members.
1616
"""
1717

18-
def is_parseable(self, type_map: Dict[int, str]) -> bool:
18+
def is_valid(self) -> bool:
1919
"""
2020
Perform some checks.
2121
"""
@@ -30,20 +30,32 @@ def is_parseable(self, type_map: Dict[int, str]) -> bool:
3030
)
3131
return False
3232

33-
device = self.DeviceObject
34-
if not device or not (device.DriverObject.DriverStart % 0x1000 == 0):
35-
vollog.debug(
36-
f"callback obj 0x{self.vol.offset:x} invalid due to invalid device object"
37-
)
38-
return False
39-
4033
except exceptions.InvalidAddressException:
4134
vollog.debug(
4235
f"callback obj 0x{self.vol.offset:x} invalid due to invalid address access"
4336
)
4437
return False
4538

39+
return True
40+
41+
def is_parseable(self, type_map: Dict[int, str]) -> bool:
42+
"""
43+
Determines whether or not this `_SHUTDOWN_PACKET` callback can be reliably parsed.
44+
Requires a `type_map` that maps NT executive object type indices to string representations.
45+
This type map can be acquired via the `handles.Handles.get_type_map` classmethod.
46+
"""
47+
if not self.is_valid():
48+
return False
49+
4650
try:
51+
52+
device = self.DeviceObject
53+
if not device or not (device.DriverObject.DriverStart % 0x1000 == 0):
54+
vollog.debug(
55+
f"callback obj 0x{self.vol.offset:x} invalid due to invalid device object"
56+
)
57+
return False
58+
4759
header = device.get_object_header()
4860
object_type = header.get_object_type(type_map)
4961
is_valid = object_type == "Device"
@@ -52,6 +64,11 @@ def is_parseable(self, type_map: Dict[int, str]) -> bool:
5264
f"Callback obj 0x{self.vol.offset:x} invalid due to invalid device type: wanted 'Device', found '{object_type}'"
5365
)
5466
return is_valid
67+
except exceptions.InvalidAddressException:
68+
vollog.debug(
69+
f"callback obj 0x{self.vol.offset:x} invalid due to invalid address access"
70+
)
71+
return False
5572
except ValueError:
5673
vollog.debug(
5774
f"Could not get object type for object at 0x{self.vol.offset:x}"

0 commit comments

Comments
 (0)