11import logging
2+ from typing import Dict
23
34from volatility3 .framework import exceptions , objects
45from volatility3 .framework .symbols .windows .extensions import pool
@@ -24,27 +25,54 @@ def is_valid(self) -> bool:
2425 and self .Entry .Blink .is_readable ()
2526 and self .DeviceObject .is_readable ()
2627 ):
28+ vollog .debug (
29+ f"Callback obj 0x{ self .vol .offset :x} invalid due to unreadable structure members"
30+ )
2731 return False
2832
33+ except exceptions .InvalidAddressException :
34+ vollog .debug (
35+ f"callback obj 0x{ self .vol .offset :x} invalid due to invalid address access"
36+ )
37+ return False
38+
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+
50+ try :
51+
2952 device = self .DeviceObject
3053 if not device or not (device .DriverObject .DriverStart % 0x1000 == 0 ):
3154 vollog .debug (
3255 f"callback obj 0x{ self .vol .offset :x} invalid due to invalid device object"
3356 )
3457 return False
3558
59+ header = device .get_object_header ()
60+ object_type = header .get_object_type (type_map )
61+ is_valid = object_type == "Device"
62+ if not is_valid :
63+ vollog .debug (
64+ f"Callback obj 0x{ self .vol .offset :x} invalid due to invalid device type: wanted 'Device', found '{ object_type } '"
65+ )
66+ return is_valid
3667 except exceptions .InvalidAddressException :
3768 vollog .debug (
3869 f"callback obj 0x{ self .vol .offset :x} invalid due to invalid address access"
3970 )
4071 return False
41-
42- try :
43- header = device .get_object_header ()
44- valid = header .NameInfo .Name == "Device"
45- return valid
4672 except ValueError :
47- vollog .debug (f"Could not get NameInfo for object at 0x{ self .vol .offset :x} " )
73+ vollog .debug (
74+ f"Could not get object type for object at 0x{ self .vol .offset :x} "
75+ )
4876 return False
4977
5078
0 commit comments