SymbolTables: Clear out the clone method and tidy up inheritance

This commit is contained in:
Mike Auty
2020-06-10 19:39:20 +01:00
committed by ikelos
parent d11ffa1f23
commit d6741435ef
5 changed files with 12 additions and 24 deletions
@@ -210,9 +210,6 @@ class BaseSymbolTableInterface:
yield sort_symbols[result][1]
result += 1
def clone(self, new_name: str):
"""Constructs a new copy of the symbol_table under a different name"""
class SymbolSpaceInterface(collections.abc.Mapping):
"""An interface for the container that holds all the symbol-containing
+6 -12
View File
@@ -83,7 +83,8 @@ class IntermediateSymbolTable(interfaces.symbols.SymbolTableInterface):
native_types: interfaces.symbols.NativeTableInterface = None,
table_mapping: Optional[Dict[str, str]] = None,
validate: bool = True,
class_types: Optional[Mapping[str, Type[interfaces.objects.ObjectInterface]]] = None) -> None:
class_types: Optional[Mapping[str, Type[interfaces.objects.ObjectInterface]]] = None,
symbol_shift: int = 0) -> None:
"""Instantiates a SymbolTable based on an IntermediateSymbolFormat JSON file. This is validated against the
appropriate schema. The validation can be disabled by passing validate = False, but this should almost never be
done.
@@ -208,7 +209,8 @@ class IntermediateSymbolTable(interfaces.symbols.SymbolTableInterface):
filename: str,
native_types: Optional[interfaces.symbols.NativeTableInterface] = None,
table_mapping: Optional[Dict[str, str]] = None,
class_types: Optional[Mapping[str, Type[interfaces.objects.ObjectInterface]]] = None) -> str:
class_types: Optional[Mapping[str, Type[interfaces.objects.ObjectInterface]]] = None,
symbol_shift: int = 0) -> str:
"""Takes a context and loads an intermediate symbol table based on a
filename.
@@ -233,7 +235,8 @@ class IntermediateSymbolTable(interfaces.symbols.SymbolTableInterface):
isf_url = urls[0],
native_types = native_types,
table_mapping = table_mapping,
class_types = class_types)
class_types = class_types,
symbol_shift = symbol_shift)
context.symbol_space.append(table)
return table_name
@@ -246,15 +249,6 @@ class IntermediateSymbolTable(interfaces.symbols.SymbolTableInterface):
name = 'symbol_shift', description = 'Symbol Shift', optional = True, default = 0)
]
def clone(self, new_name: str):
return IntermediateSymbolTable(self._context,
self.config_path,
new_name,
isf_url = self._isf_url,
native_types = self._native_types,
table_mapping = self.table_mapping,
class_types = self._delegate._overrides)
class ISFormatTable(interfaces.symbols.SymbolTableInterface, metaclass = ABCMeta):
"""Provide a base class to identify all subclasses."""
@@ -2,7 +2,6 @@
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
#
from volatility.framework import interfaces
from volatility.framework.symbols import intermed
from volatility.framework.symbols.linux import extensions
@@ -10,8 +9,8 @@ from volatility.framework.symbols.linux import extensions
class LinuxKernelIntermedSymbols(intermed.IntermediateSymbolTable):
provides = {"type": "interface"}
def __init__(self, context: interfaces.context.ContextInterface, config_path: str, name: str, isf_url: str) -> None:
super().__init__(context = context, config_path = config_path, name = name, isf_url = isf_url)
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
# Set-up Linux specific types
self.set_type_class('file', extensions.struct_file)
+2 -3
View File
@@ -2,7 +2,6 @@
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
#
from volatility.framework import interfaces
from volatility.framework.symbols import intermed
from volatility.framework.symbols.mac import extensions
@@ -10,8 +9,8 @@ from volatility.framework.symbols.mac import extensions
class MacKernelIntermedSymbols(intermed.IntermediateSymbolTable):
provides = {"type": "interface"}
def __init__(self, context: interfaces.context.ContextInterface, config_path: str, name: str, isf_url: str) -> None:
super().__init__(context = context, config_path = config_path, name = name, isf_url = isf_url)
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.set_type_class('proc', extensions.proc)
self.set_type_class('fileglob', extensions.fileglob)
@@ -2,7 +2,6 @@
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
#
import volatility.framework.symbols.windows.extensions.pool
from volatility.framework import interfaces
from volatility.framework.symbols import intermed
from volatility.framework.symbols.windows import extensions
from volatility.framework.symbols.windows.extensions import registry, pool
@@ -10,8 +9,8 @@ from volatility.framework.symbols.windows.extensions import registry, pool
class WindowsKernelIntermedSymbols(intermed.IntermediateSymbolTable):
def __init__(self, context: interfaces.context.ContextInterface, config_path: str, name: str, isf_url: str) -> None:
super().__init__(context = context, config_path = config_path, name = name, isf_url = isf_url)
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)
# Set-up windows specific types
self.set_type_class('_ETHREAD', extensions.ETHREAD)