From e500e87fc6bf57a42833391dc574ee788e997268 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Fri, 5 Oct 2018 00:20:44 +0100 Subject: [PATCH] Add in type annotations for the poolscanner plugin. --- volatility/plugins/windows/poolscanner.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/volatility/plugins/windows/poolscanner.py b/volatility/plugins/windows/poolscanner.py index d19b4e96d..0d20e0fe9 100644 --- a/volatility/plugins/windows/poolscanner.py +++ b/volatility/plugins/windows/poolscanner.py @@ -2,7 +2,7 @@ import enum import logging import typing -from volatility.framework import constants, interfaces, objects, renderers, validity, exceptions +from volatility.framework import constants, interfaces, renderers, validity, exceptions from volatility.framework.configuration import requirements from volatility.framework.interfaces import plugins, configuration from volatility.framework.layers import scanners @@ -42,7 +42,7 @@ class PoolConstraint(validity.ValidityRoutines): page_type: typing.Optional[PoolType] = None, size: typing.Optional[typing.Tuple[typing.Optional[int], typing.Optional[int]]] = None, index: typing.Optional[typing.Tuple[typing.Optional[int], typing.Optional[int]]] = None, - alignment: typing.Optional[int] = 1): + alignment: typing.Optional[int] = 1) -> None: self.tag = self._check_type(tag, bytes) self.type_name = type_name self.object_type = object_type @@ -128,11 +128,12 @@ class PoolScanner(plugins.PluginInterface): layer_name: str, symbol_table: str, pool_constraints: typing.List[PoolConstraint], - alignment: int = 8) -> typing.Generator[objects.Struct, None, None]: + alignment: int = 8) -> typing.Generator[typing.Tuple[PoolConstraint, + interfaces.objects.ObjectInterface], None, None]: """Returns the _POOL_HEADER object (based on the symbol_table template) after scanning through layer_name returning all headers that match any of the constraints provided. Only one constraint can be provided per tag""" # Setup the pattern - constraint_lookup = {} + constraint_lookup = {} # type: typing.Dict[bytes, typing.List[PoolConstraint]] for constraint in pool_constraints: temp_list = constraint_lookup.get(constraint.tag, []) temp_list.append(constraint)