From f3b6b5311fa7f61bd32c992f38f2a66b6cbd9773 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sat, 10 Feb 2018 22:51:56 +0000 Subject: [PATCH] Fix up a couple extra typing issues, improving code quality. --- volatility/framework/automagic/pdbscan.py | 6 +++--- volatility/framework/interfaces/symbols.py | 4 ++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/volatility/framework/automagic/pdbscan.py b/volatility/framework/automagic/pdbscan.py index 9853ecf50..8d040d0e4 100644 --- a/volatility/framework/automagic/pdbscan.py +++ b/volatility/framework/automagic/pdbscan.py @@ -255,9 +255,9 @@ class KernelPDBScanner(interfaces.automagic.AutomagicInterface): for virtual_layer_name in potential_kernels: kernels = potential_kernels[virtual_layer_name] virtual_config_path = context.memory[virtual_layer_name].config_path - if virtual_layer_name and isinstance(context.memory[virtual_layer_name], layers.intel.Intel): + vlayer = context.memory[virtual_layer_name] + if virtual_layer_name and isinstance(vlayer, layers.intel.Intel): # TODO: Verify this is a windows image - vlayer = context.memory[virtual_layer_name] join = interfaces.configuration.path_join physical_layer_name = context.config.get(join(vlayer.config_path, 'memory_layer'), None) kvo_path = join(virtual_config_path, 'kernel_virtual_offset') @@ -271,7 +271,7 @@ class KernelPDBScanner(interfaces.automagic.AutomagicInterface): else: kvo = kernel['mz_offset'] + (1 << (vlayer.bits_per_register - 1)) try: - kvp = context.memory[virtual_layer_name].mapping(kvo, 0) + kvp = vlayer.mapping(kvo, 0) if (any([(p == kernel['mz_offset'] and l == physical_layer_name) for (_, p, _, l) in kvp])): valid_kernels[virtual_layer_name] = (kvo, kernel) diff --git a/volatility/framework/interfaces/symbols.py b/volatility/framework/interfaces/symbols.py index cb8f8e05f..8bf36212f 100644 --- a/volatility/framework/interfaces/symbols.py +++ b/volatility/framework/interfaces/symbols.py @@ -99,6 +99,10 @@ class SymbolSpaceInterface(collections.abc.Mapping): def has_enumeration(self, name: str) -> bool: """Determines whether an enumeration choice exists in the contained symbol tables""" + @abstractmethod + def append(self, value: interfaces.symbols.BaseSymbolTableInterface) -> None: + """Adds a symbol_list to the end of the space""" + class BaseSymbolTableInterface(validity.ValidityRoutines): """The base interface, inherited by both NativeTables and SymbolTables