From 9e801c428b34cd3c300a8acfc70abff1af19656e Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sun, 11 Oct 2015 18:19:45 +0100 Subject: [PATCH] Rename ContextModifier.__call__ to ContextModifier.modify_context. --- test_rig.py | 2 +- volatility/framework/contexts/__init__.py | 4 ++-- volatility/framework/contexts/intel.py | 2 +- volatility/framework/contexts/physical.py | 2 +- volatility/framework/contexts/windows.py | 2 +- volatility/framework/interfaces/context.py | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test_rig.py b/test_rig.py index 91c4608cb..0fb6250ad 100644 --- a/test_rig.py +++ b/test_rig.py @@ -36,7 +36,7 @@ def utils_load_as(): factory = c.LayerFactory("name", "", [c.physical.PhysicalContextModifier, c.intel.IntelContextModifier, c.windows.WindowsContextModifier]) - return factory() + return factory(c.Context()) def test_memory(): diff --git a/volatility/framework/contexts/__init__.py b/volatility/framework/contexts/__init__.py index 477666f4f..8e7c4bccc 100644 --- a/volatility/framework/contexts/__init__.py +++ b/volatility/framework/contexts/__init__.py @@ -51,8 +51,8 @@ class LayerFactory(validity.ValidityRoutines, list): Returns a new context with all appropriate modifications (symbols, layers, etc) """ for index in range(len(self)): - modifier = self[index](interfaces.configuration.namespace_join([self.name, self[index].__name__ + str(index)])) - modifier(context = context) + namespace = interfaces.configuration.namespace_join([self.name, self[index].__name__ + str(index)]) + self[index](namespace).modify_context(context = context) return context diff --git a/volatility/framework/contexts/intel.py b/volatility/framework/contexts/intel.py index e46be7914..bb6e795d6 100644 --- a/volatility/framework/contexts/intel.py +++ b/volatility/framework/contexts/intel.py @@ -24,7 +24,7 @@ class IntelContextModifier(interfaces.context.ContextModifierInterface): description = "Layer name for the swap layer", optional = True)] - def __call__(self, context): + def modify_context(self, context): # TODO: Attempt to determine whether the image is 32, PAE or x64 (although the context must already know whether it is x64) config = self.config_get(context) diff --git a/volatility/framework/contexts/physical.py b/volatility/framework/contexts/physical.py index add6e6056..20b442815 100644 --- a/volatility/framework/contexts/physical.py +++ b/volatility/framework/contexts/physical.py @@ -13,7 +13,7 @@ class PhysicalContextModifier(interfaces.context.ContextModifierInterface): description = 'Layer name for the physical space', default = 'physical')] - def __call__(self, context): + def modify_context(self, context): # Ideally allow for the plugin to specify the layering, but if not then guess at the best one modconfig = self.config_get(context) base = layers.physical.FileLayer(context, diff --git a/volatility/framework/contexts/windows.py b/volatility/framework/contexts/windows.py index 508523299..3a294dc6b 100644 --- a/volatility/framework/contexts/windows.py +++ b/volatility/framework/contexts/windows.py @@ -15,7 +15,7 @@ class WindowsContextModifier(interfaces.context.ContextModifierInterface): def requirements(cls): return [] - def __call__(self, context): + def modify_context(self, context): virtual_types = self._virtual_types ntkrnlmp = vtypes.VTypeSymbolTable('ntkrnlmp', virtual_types, context.symbol_space.natives) ntkrnlmp.set_structure_class('_ETHREAD', windows._ETHREAD) diff --git a/volatility/framework/interfaces/context.py b/volatility/framework/interfaces/context.py index 1b56714f8..9e3c534d0 100644 --- a/volatility/framework/interfaces/context.py +++ b/volatility/framework/interfaces/context.py @@ -70,5 +70,5 @@ class ContextModifierInterface(validity.ValidityRoutines, metaclass = ABCMeta): return [] @abstractmethod - def __call__(self, context): + def modify_context(self, context): """Modifies the context in place"""