From bb2dd859d533dbfa7c11faeb314332b6ec4f9c0f Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Fri, 29 Jul 2016 02:36:56 +0100 Subject: [PATCH] Refactor the get_schema call to make more sense. --- volatility/framework/configuration/depresolver.py | 2 +- volatility/framework/interfaces/configuration.py | 2 +- volatility/framework/interfaces/layers.py | 6 +++--- volatility/framework/interfaces/plugins.py | 4 ++-- volatility/framework/layers/intel.py | 2 +- volatility/framework/layers/lime.py | 2 +- volatility/framework/layers/physical.py | 4 ++-- volatility/framework/symbols/windows/xp_sp2.py | 2 +- volatility/plugins/windows/pslist.py | 2 +- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/volatility/framework/configuration/depresolver.py b/volatility/framework/configuration/depresolver.py index 323dde0f6..9f2dde29b 100644 --- a/volatility/framework/configuration/depresolver.py +++ b/volatility/framework/configuration/depresolver.py @@ -78,7 +78,7 @@ class DependencyResolver(validity.ValidityRoutines): deptree = [] - for subreq in configurable.get_schema(): + for subreq in configurable.get_requirements(): # Find all the different ways to fulfill it (recursively) # TODO: Ensure no cycles or loops if not isinstance(subreq, interfaces.configuration.ConstraintInterface): diff --git a/volatility/framework/interfaces/configuration.py b/volatility/framework/interfaces/configuration.py index 9ba6a1f25..a312addaf 100644 --- a/volatility/framework/interfaces/configuration.py +++ b/volatility/framework/interfaces/configuration.py @@ -72,7 +72,7 @@ class ConfigurableInterface(validity.ValidityRoutines): return self._config_path @classmethod - def get_schema(cls): + def get_requirements(cls): """Returns a list of configuration schema nodes for this object""" return [] diff --git a/volatility/framework/interfaces/layers.py b/volatility/framework/interfaces/layers.py index 49a787597..47ba2fe8f 100644 --- a/volatility/framework/interfaces/layers.py +++ b/volatility/framework/interfaces/layers.py @@ -116,8 +116,8 @@ class DataLayerInterface(configuration.ProviderInterface, validity.ValidityRouti pass @classmethod - def get_schema(cls): - """Returns a list of requirements for this type of layer""" + def get_requirements(cls): + """Returns a list of Requirement objects for this type of layer""" return [] @classmethod @@ -132,7 +132,7 @@ class DataLayerInterface(configuration.ProviderInterface, validity.ValidityRouti # Construct the layer requirement_dict = {} - for req in cls.get_schema(): + for req in cls.get_requirements(): if req.name in node_config.data: requirement_dict[req.name] = node_config.data[req.name] # Fulfillment must happen, exceptions happening here mean the requirements aren't correct diff --git a/volatility/framework/interfaces/plugins.py b/volatility/framework/interfaces/plugins.py index dd6f1db32..cf1872f42 100644 --- a/volatility/framework/interfaces/plugins.py +++ b/volatility/framework/interfaces/plugins.py @@ -37,8 +37,8 @@ class PluginInterface(configuration_interface.ConfigurableInterface, validity.Va return self._context @classmethod - def get_schema(cls): - """Returns a list of configuration schema items""" + def get_requirements(cls): + """Returns a list of Requirement objects for this plugin""" return [] def validate_inputs(self): diff --git a/volatility/framework/layers/intel.py b/volatility/framework/layers/intel.py index cfc7b5749..36d8f2ec0 100644 --- a/volatility/framework/layers/intel.py +++ b/volatility/framework/layers/intel.py @@ -140,7 +140,7 @@ class Intel(interfaces.layers.TranslationLayerInterface): return [self._base_layer] @classmethod - def get_schema(cls): + def get_requirements(cls): return [volatility.framework.configuration.requirements.TranslationLayerRequirement(name = 'memory_layer', constraints = { "type": "physical"}, diff --git a/volatility/framework/layers/lime.py b/volatility/framework/layers/lime.py index c569ad9b9..6dc48a2fe 100644 --- a/volatility/framework/layers/lime.py +++ b/volatility/framework/layers/lime.py @@ -139,7 +139,7 @@ class LimeLayer(interfaces.layers.TranslationLayerInterface): return [self._base_layer] @classmethod - def get_schema(cls): + def get_requirements(cls): return [requirements.TranslationLayerRequirement(name = 'base_layer', constraints = {"type": "physical"}, optional = False)] diff --git a/volatility/framework/layers/physical.py b/volatility/framework/layers/physical.py index aa3c4122e..2a32401f0 100644 --- a/volatility/framework/layers/physical.py +++ b/volatility/framework/layers/physical.py @@ -51,7 +51,7 @@ class BufferDataLayer(interfaces.layers.DataLayerInterface): self._buffer = self._buffer[:address] + data + self._buffer[address + len(data):] @classmethod - def get_schema(cls): + def get_requirements(cls): # No real requirements (only the buffer). Need to figure out if there's a better way of representing this return [requirements.BytesRequirement(name = 'buffer', description = "The direct bytes to interact with", optional = False)] @@ -127,5 +127,5 @@ class FileLayer(interfaces.layers.DataLayerInterface): self._file.close() @classmethod - def get_schema(cls): + def get_requirements(cls): return [requirements.StringRequirement(name = 'filename', optional = False)] diff --git a/volatility/framework/symbols/windows/xp_sp2.py b/volatility/framework/symbols/windows/xp_sp2.py index 6e9119bd5..ac380a7dc 100644 --- a/volatility/framework/symbols/windows/xp_sp2.py +++ b/volatility/framework/symbols/windows/xp_sp2.py @@ -59,7 +59,7 @@ class XPSP2WindowsKernelSymbolProvider(WindowsKernelSymbolProvider): space_name = 'ntkrnlmp' @classmethod - def get_schema(cls): + def get_requirements(cls): return [requirements.NativeSymbolRequirement("natives", description = "Native Symbols for x86", constraints = {"type": "natives", "architecture": "ia32"})] diff --git a/volatility/plugins/windows/pslist.py b/volatility/plugins/windows/pslist.py index 23ae6cf32..9311f1170 100644 --- a/volatility/plugins/windows/pslist.py +++ b/volatility/plugins/windows/pslist.py @@ -5,7 +5,7 @@ from volatility.framework.renderers import TreeGrid class PsList(plugins.PluginInterface): @classmethod - def get_schema(cls): + def get_requirements(cls): return [requirements.TranslationLayerRequirement(name = 'primary', description = 'Kernel Address Space', constraints = {"type": "memory",