Add in initial requirements for plugins to state their inputs.

This commit is contained in:
Mike Auty
2014-07-08 11:17:39 +01:00
parent d6b131980b
commit 58e2365788
2 changed files with 26 additions and 2 deletions
+21 -1
View File
@@ -30,11 +30,31 @@ class PluginInterface(validity.ValidityRoutines):
def context(self):
return self._context
@abstractmethod
@classmethod
def determine_inputs(cls):
"""Returns the accepted inputs
This should be a dictionary of TranslationLayer names matched to TranslationLayer types
"""
def verify_inputs(self):
"""Verifies the inputs basedo on the output of determine_inputs"""
inputs = self.determine_inputs()
for tl_name, tl_type in inputs.items():
layer = self.context.memory.get(tl_name, None)
if layer is not None:
if layer.__class__.__name__ != tl_type:
raise TypeError("Layer " + tl_name + " is not of type " + tl_type + " (" +
layer.__class__.__name__ + " instead).")
else:
raise TypeError("Layer " + tl_name + " has not been populated.")
@abstractmethod
def establish_context(self):
"""Alters the context to ensure the plugin can run.
This function constructs the necessary address spaces and symbol spaces that the plugin will need.
This function constructs the necessary symbol spaces that the plugin will need.
"""
@abstractmethod
+5 -1
View File
@@ -2,4 +2,8 @@
import volatility.framework.interfaces.plugins as plugins
class pslist(plugins.PluginInterface):
pass
@classmethod
def determine_inputs(cls):
return {"primary":"Intel"}