From e013455f4069e539d53ecd0fd124d003f72fc1cb Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Tue, 7 Apr 2015 17:27:57 -0500 Subject: [PATCH] Fix up input validation and start the CLI code. --- volatility/cli/__init__.py | 12 ++++++++++++ volatility/framework/config.py | 2 +- volatility/framework/interfaces/plugins.py | 4 ++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/volatility/cli/__init__.py b/volatility/cli/__init__.py index b9675ceac..584c49d0d 100644 --- a/volatility/cli/__init__.py +++ b/volatility/cli/__init__.py @@ -1 +1,13 @@ __author__ = 'mike' + +import volatility.framework + +class CommandLine(): + def __init__(self): + pass + + def run(self): + sys.stdout.write("Volatility Framework 3 (version "+ "{0}.{1}.{2}".format(volatility.framework.version()) + ")") + +def main(): + CommandLine().run() \ No newline at end of file diff --git a/volatility/framework/config.py b/volatility/framework/config.py index 96c5497a8..3cc0c1318 100644 --- a/volatility/framework/config.py +++ b/volatility/framework/config.py @@ -54,7 +54,7 @@ class TranslationLayerInput(GenericInput): """Validate that the value is a valid layer name and that the layer adheres to the requirements""" if value not in context.memory: raise IndexError(value + " is not memory layer") - + class ChoiceInput(GenericInput): """Allows one from a choice of strings diff --git a/volatility/framework/interfaces/plugins.py b/volatility/framework/interfaces/plugins.py index 8a0879bbd..98d9056a3 100644 --- a/volatility/framework/interfaces/plugins.py +++ b/volatility/framework/interfaces/plugins.py @@ -33,8 +33,8 @@ class PluginInterface(validity.ValidityRoutines, metaclass = ABCMeta): def context(self): return self._context - @abstractmethod @classmethod + @abstractmethod def inputs(cls): """Returns a list of requirements options""" return [] @@ -46,7 +46,7 @@ class PluginInterface(validity.ValidityRoutines, metaclass = ABCMeta): def validate_inputs(self): for option in self.inputs(): - option.validate_input(option.value, self.context) + option.validate_input(self.get_input(option.name).value, self.context) @abstractmethod def __call__(self):