Improve plugin and renderer interface documentation.

This commit is contained in:
Mike Auty
2016-12-30 02:44:01 +00:00
parent 8f6f5f6403
commit ba05632efd
2 changed files with 14 additions and 8 deletions
+8 -6
View File
@@ -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
"""
+6 -2
View File
@@ -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