mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-08-31 12:19:42 +02:00
Add type hints/casts to _get_service_key method
This commit is contained in:
@@ -144,7 +144,7 @@ class SvcScan(interfaces.plugins.PluginInterface):
|
||||
native_types=native_types,
|
||||
)
|
||||
|
||||
def _get_service_key(self, kernel):
|
||||
def _get_service_key(self, kernel) -> Optional[objects.StructType]:
|
||||
for hive in hivelist.HiveList.list_hives(
|
||||
context=self.context,
|
||||
base_config_path=interfaces.configuration.path_join(
|
||||
@@ -156,10 +156,14 @@ class SvcScan(interfaces.plugins.PluginInterface):
|
||||
):
|
||||
# Get ControlSet\Services.
|
||||
try:
|
||||
return hive.get_key(r"CurrentControlSet\Services")
|
||||
return cast(
|
||||
objects.StructType, hive.get_key(r"CurrentControlSet\Services")
|
||||
)
|
||||
except (KeyError, exceptions.InvalidAddressException):
|
||||
try:
|
||||
return hive.get_key(r"ControlSet001\Services")
|
||||
return cast(
|
||||
objects.StructType, hive.get_key(r"ControlSet001\Services")
|
||||
)
|
||||
except (KeyError, exceptions.InvalidAddressException):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user