diff --git a/volatility/framework/interfaces/symbols.py b/volatility/framework/interfaces/symbols.py index 37b3870e7..0671c133d 100644 --- a/volatility/framework/interfaces/symbols.py +++ b/volatility/framework/interfaces/symbols.py @@ -223,7 +223,7 @@ class SymbolSpaceInterface(collections.abc.Mapping): """Look-up a symbol name across all the contained symbol tables""" @abstractmethod - def get_enumeration(self, enum_name: str) -> Dict[str, Any]: + def get_enumeration(self, enum_name: str) -> objects.Template: """Look-up an enumeration across all the contained symbol tables""" @abstractmethod @@ -268,14 +268,14 @@ class SymbolTableInterface(BaseSymbolTableInterface, configuration.ConfigurableI class NativeTableInterface(BaseSymbolTableInterface): """Class to distinguish NativeSymbolLists from other symbol lists""" - def get_symbol(self, name: str): + def get_symbol(self, name: str) -> objects.Template: raise exceptions.SymbolError("NativeTables never hold symbols") @property def symbols(self) -> Iterable[str]: return [] - def get_enumeration(self, name: str) -> Dict[str, Any]: + def get_enumeration(self, name: str) -> objects.Template: raise exceptions.SymbolError("NativeTables never hold enumerations") @property diff --git a/volatility/framework/objects/__init__.py b/volatility/framework/objects/__init__.py index 027d06c34..b71a4ad02 100644 --- a/volatility/framework/objects/__init__.py +++ b/volatility/framework/objects/__init__.py @@ -424,8 +424,10 @@ class Enumeration(interfaces.objects.ObjectInterface, int): inverse_choices[v] = k return inverse_choices - def lookup(self, value: int) -> str: + def lookup(self, value: int = None) -> str: """Looks up an individual value and returns the associated name""" + if value is None: + return self.lookup(self) if value in self._inverse_choices: return self._inverse_choices[value] raise ValueError("The value of the enumeration is outside the possible choices") diff --git a/volatility/framework/symbols/__init__.py b/volatility/framework/symbols/__init__.py index e74e9e89c..15a4b3c4e 100644 --- a/volatility/framework/symbols/__init__.py +++ b/volatility/framework/symbols/__init__.py @@ -207,10 +207,10 @@ class SymbolSpace(interfaces.symbols.SymbolSpaceInterface): raise exceptions.SymbolError("Unresolvable Symbol: {}".format(symbol_name)) return retval - def get_enumeration(self, enum_name: str) -> Dict[str, Any]: + def get_enumeration(self, enum_name: str) -> interfaces.objects.Template: """Look-up a set of enumeration choices from a specific symbol table""" retval = self._weak_resolve(SymbolType.ENUM, enum_name) - if not isinstance(retval, dict): + if not isinstance(retval, interfaces.objects.Template): raise exceptions.SymbolError("Unresolvable Enumeration: {}".format(enum_name)) return retval