From 659bfc1670277b9aab220caed7707442d51d45ae Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sun, 22 May 2016 11:54:44 +0100 Subject: [PATCH] Add in Symbol class to properly represent programming symbols. --- volatility/framework/interfaces/symbols.py | 26 ++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/volatility/framework/interfaces/symbols.py b/volatility/framework/interfaces/symbols.py index 4e443702c..76dfb5f6b 100644 --- a/volatility/framework/interfaces/symbols.py +++ b/volatility/framework/interfaces/symbols.py @@ -8,6 +8,32 @@ from volatility.framework import validity, exceptions from volatility.framework.interfaces import configuration +class Symbol(validity.ValidityRoutines): + def __init__(self, name, offset, type_name = None): + self._name = self._check_type(name, str) + self._location = None + self._offset = self._check_type(offset, int) + if type_name is None: + type_name = name + self._type_name = self._check_type(type_name, str) + # Scope and location can be added at a later date + + @property + def name(self): + """Returns the name of the symbol""" + return self._name + + @property + def type_name(self): + """Returns the name of the type that the symbol represents""" + return self._type_name + + @property + def offset(self): + """Returns the relative offset of the symbol within the compilation unit""" + return self._offset + + class SymbolTableInterface(validity.ValidityRoutines): """Handles a table of symbols"""