From ba05632efd07946b15c7e277af5de68fc25e8f1d Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Fri, 30 Dec 2016 02:44:01 +0000 Subject: [PATCH] Improve plugin and renderer interface documentation. --- volatility/framework/interfaces/plugins.py | 14 ++++++++------ volatility/framework/interfaces/renderers.py | 8 ++++++-- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/volatility/framework/interfaces/plugins.py b/volatility/framework/interfaces/plugins.py index ab75bc2d6..3879a32e3 100644 --- a/volatility/framework/interfaces/plugins.py +++ b/volatility/framework/interfaces/plugins.py @@ -1,7 +1,6 @@ -""" -Created on 6 May 2013 +"""Plugins are the `functions` of the volatility framework. -@author: mike +They are called and carry out some algorithms on data stored in layers using objects constructed from symbols. """ # Configuration interfaces must be imported separately, since we're part of interfaces and can't import ourselves @@ -25,7 +24,11 @@ from volatility.framework.interfaces import configuration as interfaces_configur # The plugin runs and produces a TreeGrid output class PluginInterface(interfaces_configuration.ConfigurableInterface, validity.ValidityRoutines, metaclass = ABCMeta): - """Class that defines the interface all Plugins must maintain""" + """Class that defines the basic interface that all Plugins must maintain. + The constructor must only take a `context` and `config_path`, so that plugins can be launched automatically. As + such all configuration information must be provided through the requirements and configuration information in the + context it is passed. + """ def __init__(self, context, config_path): super().__init__(context, config_path) @@ -38,6 +41,7 @@ class PluginInterface(interfaces_configuration.ConfigurableInterface, validity.V @classmethod def validate(self, context, config_path): + """Ensures that the plugin's requirements have been met appropriately""" result_set = [(config_path + "." + requirement.name, requirement.validate(context, config_path)) for requirement in self.get_requirements() if not requirement.optional] return all([r for _, r in result_set]) @@ -46,8 +50,6 @@ class PluginInterface(interfaces_configuration.ConfigurableInterface, validity.V def run(self): """Executes the functionality of the code - @:param - :return: a TreeGrid object that can then be passed to a Renderer. :rtype: interfaces.renderers.TreeGrid """ diff --git a/volatility/framework/interfaces/renderers.py b/volatility/framework/interfaces/renderers.py index 2e6c8d593..127ca044a 100644 --- a/volatility/framework/interfaces/renderers.py +++ b/volatility/framework/interfaces/renderers.py @@ -1,14 +1,18 @@ +"""All plugins output a TreeGrid object which must then be rendered (eithe by a GUI, or as text output, html output +or in some other form. This module defines both the output format (:class:`TreeGrid`) and the renderer interface +which can interact with a TreeGrid to produce suitable output.""" + import collections from abc import abstractmethod, ABCMeta from volatility.framework import validity -__author__ = 'mike' - Column = collections.namedtuple('Column', ['index', 'name', 'type']) class Renderer(validity.ValidityRoutines, metaclass = ABCMeta): + """Class that defines the interface that all output renderers must support""" + def __init__(self, options): """Accepts an options object to configure the renderers""" # FIXME: Once the config option objects are in place, put the _type_check in place