From 0c8c52ba329228931d9cfa59b6802799f581b971 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sat, 30 Jan 2021 16:16:49 +0000 Subject: [PATCH] Layers: Allow manual cache control and disable for PDB --- volatility3/framework/layers/resources.py | 3 +-- volatility3/framework/symbols/windows/pdbconv.py | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/volatility3/framework/layers/resources.py b/volatility3/framework/layers/resources.py index d25c8d5f1..a56d54dc3 100644 --- a/volatility3/framework/layers/resources.py +++ b/volatility3/framework/layers/resources.py @@ -79,7 +79,7 @@ class ResourceAccessor(object): """Determines whether a URLs contents should be cached""" parsed_url = urllib.parse.urlparse(url) - return not parsed_url.scheme in self._non_cached_schemes() + return self._enable_cache and not parsed_url.scheme in self._non_cached_schemes() @staticmethod def _non_cached_schemes() -> List[str]: @@ -225,7 +225,6 @@ class JarHandler(VolatilityHandler): Actual reference (found from https://www.w3.org/wiki/UriSchemes/jar) seemed not to return: http://developer.java.sun.com/developer/onlineTraining/protocolhandlers/ """ - @classmethod def non_cached_schemes(cls) -> List[str]: return ['jar'] diff --git a/volatility3/framework/symbols/windows/pdbconv.py b/volatility3/framework/symbols/windows/pdbconv.py index 7d8f8109f..6d50c9a58 100644 --- a/volatility3/framework/symbols/windows/pdbconv.py +++ b/volatility3/framework/symbols/windows/pdbconv.py @@ -937,7 +937,8 @@ class PdbRetreiver: for suffix in [file_name, file_name[:-1] + '_']: try: vollog.debug("Attempting to retrieve {}".format(url + suffix)) - result = resources.ResourceAccessor(progress_callback).open(url + suffix) + # Don't cache the PDB files since they might build up and there's little benefit + result = resources.ResourceAccessor(progress_callback, enable_cache = False).open(url + suffix) except (error.HTTPError, error.URLError) as excp: vollog.debug("Failed with {}".format(excp)) if result: