From f7f1c1d5e09123f3d0394d93fb2d03052ed07c65 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Fri, 11 Aug 2017 08:49:49 +0100 Subject: [PATCH] Raise the right kind of exception in Intermediate Format SymbolTables. --- volatility/framework/automagic/linux_symbol_cache.py | 4 ++-- volatility/framework/symbols/intermed.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/volatility/framework/automagic/linux_symbol_cache.py b/volatility/framework/automagic/linux_symbol_cache.py index 98f73a1ca..e2a90ae69 100644 --- a/volatility/framework/automagic/linux_symbol_cache.py +++ b/volatility/framework/automagic/linux_symbol_cache.py @@ -4,7 +4,7 @@ import pathlib import pickle from urllib import parse -from volatility.framework import interfaces, constants +from volatility.framework import constants, exceptions, interfaces from volatility.framework.symbols import intermed vollog = logging.getLogger(__name__) @@ -78,7 +78,7 @@ class LinuxSymbolCache(interfaces.automagic.AutomagicInterface): bannerlist = linuxbanners.get(banner, []) bannerlist.append(isf_url) linuxbanners[banner] = bannerlist - except KeyError: + except exceptions.SymbolError: pass # Rewrite the cached linuxbanners each run, since writing is faster than the cache validation portion diff --git a/volatility/framework/symbols/intermed.py b/volatility/framework/symbols/intermed.py index db355f8c6..f226e7501 100644 --- a/volatility/framework/symbols/intermed.py +++ b/volatility/framework/symbols/intermed.py @@ -199,7 +199,7 @@ class Version1Format(ISFormatTable): """Returns the location offset given by the symbol name""" symbol = self._json_object['symbols'].get(name, None) if not symbol: - raise KeyError("Unknown symbol: {}".format(name)) + raise exceptions.SymbolError("Unknown symbol: {}".format(name)) return interfaces.symbols.Symbol(name = name, address = symbol['address']) @property @@ -369,7 +369,7 @@ class Version3Format(Version2Format): """Returns the location offset given by the symbol name""" symbol = self._json_object['symbols'].get(name, None) if not symbol: - raise KeyError("Unknown symbol: {}".format(name)) + raise exceptions.SymbolError("Unknown symbol: {}".format(name)) symbol_type = None if 'type' in symbol: symbol_type = self._interdict_to_template(symbol['type']) @@ -425,7 +425,7 @@ class Version5Format(Version4Format): """Returns the location offset given by the symbol name""" symbol = self._json_object['symbols'].get(name, None) if not symbol: - raise KeyError("Unknown symbol: {}".format(name)) + raise exceptions.SymbolError("Unknown symbol: {}".format(name)) symbol_type = None if 'type' in symbol: symbol_type = self._interdict_to_template(symbol['type'])