From 8b3453dd29fe0ae1dd55a14d31270f5c5d08496b Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Thu, 26 Sep 2019 21:18:23 +0100 Subject: [PATCH] Ensure we use the cache rathe rather than just saying we will. --- volatility/framework/exceptions.py | 2 +- volatility/framework/layers/resources.py | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/volatility/framework/exceptions.py b/volatility/framework/exceptions.py index ebbea2927..8d11d19bd 100644 --- a/volatility/framework/exceptions.py +++ b/volatility/framework/exceptions.py @@ -77,7 +77,7 @@ class InvalidDataException(VolatilityException): class SymbolSpaceError(VolatilityException): - """Thrown when an error occurs dealing with Symbols and Symbolspaces.""" + """Thrown when an error occurs dealing with Symbolspaces and SymbolTables.""" class LayerException(VolatilityException): diff --git a/volatility/framework/layers/resources.py b/volatility/framework/layers/resources.py index 37ef37bdf..c1f3f50b6 100644 --- a/volatility/framework/layers/resources.py +++ b/volatility/framework/layers/resources.py @@ -13,7 +13,7 @@ import ssl import urllib.parse import urllib.request import zipfile -from typing import List, Optional +from typing import Optional from volatility import framework from volatility.framework import constants @@ -49,7 +49,6 @@ class ResourceAccessor(object): """ self._progress_callback = progress_callback self._context = context - self._cached_files = [] # type: List[str] self._handlers = list(framework.class_subclasses(urllib.request.BaseHandler)) vollog.log(constants.LOGLEVEL_VVV, "Available URL handlers: {}".format(", ".join([x.__name__ for x in self._handlers]))) @@ -71,8 +70,8 @@ class ResourceAccessor(object): temp_filename = os.path.join(constants.CACHE_PATH, "data_" + hashlib.sha512(bytes(url, 'latin-1')).hexdigest()) - if temp_filename not in self._cached_files or not os.path.exists(temp_filename): - vollog.info("Caching file at: {}".format(temp_filename)) + if not os.path.exists(temp_filename): + vollog.debug("Caching file at: {}".format(temp_filename)) try: content_length = fp.info().get('Content-Length', -1) @@ -92,8 +91,6 @@ class ResourceAccessor(object): "Reading file {}".format(url)) cache_file.write(block) cache_file.close() - # Globally stash the file as cached this python session - self._cached_files += [temp_filename] # Re-open the cache with a different mode curfile = open(temp_filename, mode = "rb")