From 48e839947bf97d55d4a76d597aa5328ec61c309c Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sat, 5 Apr 2014 19:39:48 +0100 Subject: [PATCH] Tweak the documentation in certain files, and remove the overly changable workspace.xml. --- .idea/workspace.xml | 864 --------------------- volatility/framework/__init__.py | 32 +- volatility/framework/interfaces/context.py | 2 +- volatility/framework/layers/__init__.py | 4 +- 4 files changed, 30 insertions(+), 872 deletions(-) delete mode 100644 .idea/workspace.xml diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 86544e346..000000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,864 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - HTML - - - Python - - - - - Buildout - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1395489341752 - 1395489341752 - - - 1396140391030 - 1396140391030 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/volatility/framework/__init__.py b/volatility/framework/__init__.py index 8f31cbf41..0185b4dc2 100644 --- a/volatility/framework/__init__.py +++ b/volatility/framework/__init__.py @@ -34,9 +34,22 @@ def require_version(*args): from volatility.framework import interfaces, symbols, layers class Context(interfaces.context.ContextInterface): - """Maintains the context within which to construct objects""" + """Maintains the context within which to construct objects + + The context object is the main method of carrying around state that's been constructed for the purposes of + investigating memory. It contains a symbol_space of all the symbols that can be accessed by plugins using the + context. It also contains the memory made up of data and translation layers, and it contains a factory method + for creating new objects. + """ def __init__(self, natives): + """Initializes the context. + + This initializes the context and provides a default set of native types for the empty symbol space. + + :param natives: Defines the native types such as integers, floats, arrays and addresses. + :type natives: interfaces.symbols.NativeTableInterface + """ interfaces.context.ContextInterface.__init__(self) self._symbol_space = symbols.SymbolSpace(natives) self._memory = layers.Memory() @@ -45,16 +58,24 @@ class Context(interfaces.context.ContextInterface): @property def symbol_space(self): + """The space of all symbols that can be accessed within this context. + """ return self._symbol_space @property def memory(self): + """A Memory object, allowing access to all data and translation layers currently available within the context""" return self._memory ### Address Space Functions def add_translation_layer(self, layer): - """Adds a named translation layer to the context""" + """Adds a named translation layer to the context + + :param layer: The layer to be added to the memory + :type layer: volatility.framework.interfaces.layers.DataLayerInterface + :raises volatility.framework.exceptions.LayerException: if the layer is already present, or has unmet dependencies + """ self._memory.add_layer(layer) ### Object Factory Functions @@ -62,10 +83,11 @@ class Context(interfaces.context.ContextInterface): def object(self, symbol, layer_name, offset): """Object factory, takes a context, symbol, offset and optional layername - Looks up the layername in the context, finds the object template based on the symbol, - and constructs an object using the object template on the layer at the offset. + Looks up the layername in the context, finds the object template based on the symbol, + and constructs an object using the object template on the layer at the offset. - Returns a fully constructed object + :return: A fully constructed object + :rtype: :py:class:`volatility.framework.interfaces.objects.ObjectInterface` """ object_template = self._symbol_space.get_structure(symbol) return object_template(self, layer_name = layer_name, offset = offset) diff --git a/volatility/framework/interfaces/context.py b/volatility/framework/interfaces/context.py index 186f01aaf..e9c589ad1 100644 --- a/volatility/framework/interfaces/context.py +++ b/volatility/framework/interfaces/context.py @@ -6,7 +6,7 @@ Created on 6 May 2013 class ContextInterface(object): - """Class for providing the interface for the Context object""" + """All context-like objects must adhere to the following interface.""" def __init__(self): """Initializes the context with a symbol_space""" diff --git a/volatility/framework/layers/__init__.py b/volatility/framework/layers/__init__.py index ed0102136..56bbf125d 100644 --- a/volatility/framework/layers/__init__.py +++ b/volatility/framework/layers/__init__.py @@ -32,11 +32,11 @@ class Memory(validity.ValidityRoutines): self.type_check(layer, interfaces.layers.DataLayerInterface) if isinstance(layer, interfaces.layers.TranslationLayerInterface): if layer.name in self._layers: - raise exceptions.LayerException("") + raise exceptions.LayerException("Layer " + layer.name + " already exists.") missing_list = [sublayer for sublayer in layer.dependencies if sublayer not in self._layers] if missing_list: raise exceptions.LayerException("Layer " + layer.name + - " has unmet dependencies of " + ", ".join(missing_list)) + " has unmet dependencies of " + ", ".join(missing_list + ".")) self._layers[layer.name] = layer def del_layer(self, name):