Merge pull request #1362 from c0rydoras/fix/cache-dir

Follow XDG Base Directory Specification for cache directory
This commit is contained in:
ikelos
2024-11-22 11:32:57 +00:00
committed by GitHub
2 changed files with 7 additions and 2 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ How Volatility finds symbol tables
All files are stored as JSON data, they can be in pure JSON files as ``.json``, or compressed as ``.json.gz`` or ``.json.xz``.
Volatility will automatically decompress them on use. It will also cache their contents (compressed) when used, located
under the user's home directory, in :file:`.cache/volatility3`, along with other useful data. The cache directory currently
under the user's home directory, in :file:`.cache/volatility3` or when `XDG_CACHE_HOME` is set in :file:`${XDG_CACHE_HOME}/volatility3`, along with other useful data. The cache directory currently
cannot be altered.
Symbol table JSON files live, by default, under the :file:`volatility3/symbols` directory. The symbols directory is
+6 -1
View File
@@ -6,6 +6,7 @@
Stores all the constant values that are generally fixed throughout
volatility This includes default scanning block sizes, etc.
"""
import enum
import os.path
import sys
@@ -65,7 +66,11 @@ LOGLEVEL_VVV = 7
LOGLEVEL_VVVV = 6
"""Logging level for four levels of detail: -vvvvvv"""
CACHE_PATH = os.path.join(os.path.expanduser("~"), ".cache", "volatility3")
CACHE_PATH = os.path.join(
os.environ.get("XDG_CACHE_HOME") or os.path.join(os.path.expanduser("~"), ".cache"),
"volatility3",
)
"""Default path to store cached data"""
SQLITE_CACHE_PERIOD = "-3 days"