diff --git a/volatility/cli/__init__.py b/volatility/cli/__init__.py index f93909f13..c11f7bfd1 100644 --- a/volatility/cli/__init__.py +++ b/volatility/cli/__init__.py @@ -41,7 +41,7 @@ class CommandLine(object): # Determine the selected plugin # Resolve the dependencies on that plugin dldr = depresolver.DependencyResolver() - dependencies = dldr.build_tree(plugin) + deptree = dldr.build_tree(plugin) # UI fills in the config: ctx = contexts.Context() @@ -51,8 +51,7 @@ class CommandLine(object): # Walk down the tree attempting to fulfil each requirement (recursive) and backtrack when necessary # Translate the parsed args to a context configuration - config_path = plugin.__name__.lower() - if dldr.validate_dependencies(dependencies, context = ctx, path = config_path): + if dldr.validate_dependencies(deptree, context = ctx, path = config_path): # Construct and run the plugin TextRenderer().render(plugin(ctx, config_path).run()) else: diff --git a/volatility/framework/configuration/depresolver.py b/volatility/framework/configuration/depresolver.py index 54adbaeed..bee00b0c1 100644 --- a/volatility/framework/configuration/depresolver.py +++ b/volatility/framework/configuration/depresolver.py @@ -60,6 +60,9 @@ class DependencyResolver(validity.ValidityRoutines): # TODO: Improve logging/output of this code to diagnose errors if path is None: path = "" + + self._check_type(deptree, RequirementTreeList) + for node in deptree.children: node_path = path + interfaces.configuration.CONFIG_SEPARATOR + node.requirement.name if isinstance(node, RequirementTreeChoice) and not node.requirement.optional: @@ -179,18 +182,8 @@ class ValidateDependenciesVisitor(TreeVisitor): # Requirement tree classes ########################## -class RequirementTreeNode(validity.ValidityRoutines): - @property - def optional(self): - """Determines whether the elements within this tree are required for proper operation""" - return False - def accept(self, visitor): - """Takes in a vistor and applies to itself and any child nodes appropriately""" - return visitor.visit(self) - - -class RequirementTreeReq(RequirementTreeNode): +class RequirementTreeReq(interfaces.configuration.RequirementTreeNode): def __init__(self, requirement = None): validity.ValidityRoutines.__init__(self) self._check_type(requirement, interfaces.configuration.RequirementInterface) diff --git a/volatility/framework/interfaces/configuration.py b/volatility/framework/interfaces/configuration.py index c4cbfeae2..3e484e43f 100644 --- a/volatility/framework/interfaces/configuration.py +++ b/volatility/framework/interfaces/configuration.py @@ -109,3 +109,14 @@ class ProviderInterface(ConfigurableInterface): @classmethod def fulfill(cls, context, requirement, config_path): """Fulfills a context's requirement, altering the context appropriately""" + + +class ConfigurableVisitorInterface(validity.ValidityRoutines): + pass + + +class RequirementTreeNode(validity.ValidityRoutines): + @property + def optional(self): + """Determines whether the elements within this tree are required for proper operation""" + return False \ No newline at end of file