Fix metaclass usage in python 3, and fill in some missing requirements.

This commit is contained in:
Mike Auty
2014-12-31 04:25:11 +00:00
parent 5655548d3f
commit 811858aba8
6 changed files with 47 additions and 13 deletions
+21 -2
View File
@@ -11,9 +11,8 @@ from volatility.framework import validity
from volatility.framework.interfaces import context as context_module
class ObjectInterface(validity.ValidityRoutines):
class ObjectInterface(validity.ValidityRoutines, metaclass = ABCMeta):
""" A base object required to be the ancestor of every object used in volatility """
__metaclass__ = ABCMeta
def __init__(self, context, layer_name, offset, structure_name, size, parent = None):
# Since objects are likely to be instantiated often,
@@ -40,6 +39,26 @@ class ObjectInterface(validity.ValidityRoutines):
object_template = self._context.symbol_space.resolve(new_structure_name)
return object_template(context = self._context, layer_name = self._layer_name, offset = self._offset)
@classmethod
@abstractmethod
def template_replace_child(cls, old_child, new_child, arguments):
"""Substitutes the old_child for the new_child"""
@classmethod
@abstractmethod
def template_size(cls, arguments):
"""Returns the size of the template object"""
@classmethod
@abstractmethod
def template_children(cls, arguments):
"""Returns the children of the template"""
@classmethod
@abstractmethod
def template_relative_child_offset(cls, arguments, child):
"""Returns the relative offset from the head of the parent data to the child member"""
class Template(object):
"""Class for all Factories that take offsets, and data layers and produce objects