mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-23 10:04:52 +02:00
Refactor the location of the linux banner cache.
This commit is contained in:
@@ -8,8 +8,6 @@ from volatility.framework.symbols import intermed
|
||||
|
||||
vollog = logging.getLogger(__name__)
|
||||
|
||||
cached_linuxbanner_filepath = os.path.join(constants.CACHE_PATH, "linux_banners.cache")
|
||||
|
||||
|
||||
class LinuxSymbolCache(interfaces.automagic.AutomagicInterface):
|
||||
"""Class to run through all Linux symbols tables and cache their banners"""
|
||||
@@ -19,8 +17,8 @@ class LinuxSymbolCache(interfaces.automagic.AutomagicInterface):
|
||||
# We only need to be called once, so no recursion necessary
|
||||
|
||||
linuxbanners = {}
|
||||
if os.path.exists(cached_linuxbanner_filepath):
|
||||
with open(cached_linuxbanner_filepath, "rb") as f:
|
||||
if os.path.exists(constants.LINUX_BANNERS_PATH):
|
||||
with open(constants.LINUX_BANNERS_PATH, "rb") as f:
|
||||
# We use pickle over JSON because we're dealing with bytes objects
|
||||
linuxbanners.update(pickle.load(f))
|
||||
|
||||
@@ -59,5 +57,5 @@ class LinuxSymbolCache(interfaces.automagic.AutomagicInterface):
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
with open(cached_linuxbanner_filepath, "wb") as f:
|
||||
with open(constants.LINUX_BANNERS_PATH, "wb") as f:
|
||||
pickle.dump(linuxbanners, f)
|
||||
|
||||
@@ -23,3 +23,5 @@ if sys.platform == 'windows':
|
||||
else:
|
||||
CACHE_PATH = os.path.join(os.path.expanduser("~"), ".cache", "volatility3")
|
||||
os.makedirs(CACHE_PATH, exist_ok = True)
|
||||
|
||||
LINUX_BANNERS_PATH = os.path.join(CACHE_PATH, "linux_banners.cache")
|
||||
|
||||
Reference in New Issue
Block a user