Skip to content

Commit c285a9d

Browse files
committed
Store temporary symbols in user cache; not within shipped symbols
1 parent 98e2f7a commit c285a9d

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

volatility3/framework/constants/__init__.py

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,28 @@
2525

2626
REQUIRED_PYTHON_VERSION = (3, 8, 0)
2727

28+
CACHE_PATH = os.path.join(
29+
os.environ.get("XDG_CACHE_HOME") or os.path.join(os.path.expanduser("~"), ".cache"),
30+
"volatility3",
31+
)
32+
"""Default path to store cached data"""
33+
34+
if sys.platform == "win32":
35+
CACHE_PATH = os.path.realpath(
36+
os.path.join(os.environ.get("APPDATA", os.path.expanduser("~")), "volatility3")
37+
)
38+
os.makedirs(CACHE_PATH, exist_ok=True)
39+
2840
PLUGINS_PATH = [
2941
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "plugins")),
3042
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "plugins")),
3143
]
3244
"""Default list of paths to load plugins from (volatility3/plugins and volatility3/framework/plugins)"""
3345

3446
SYMBOL_BASEPATHS = [
47+
os.path.join(
48+
CACHE_PATH, "symbols"
49+
), # User cache for automatically downloaded temporary symbols; searched after --symbol-dirs
3550
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..", "symbols")),
3651
os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "symbols")),
3752
]
@@ -71,21 +86,9 @@
7186
"""Logging level for four levels of detail: -vvvvvv"""
7287

7388

74-
CACHE_PATH = os.path.join(
75-
os.environ.get("XDG_CACHE_HOME") or os.path.join(os.path.expanduser("~"), ".cache"),
76-
"volatility3",
77-
)
78-
"""Default path to store cached data"""
79-
8089
SQLITE_CACHE_PERIOD = "-3 days"
8190
"""SQLite time modifier for how long each item is valid in the cache for"""
8291

83-
if sys.platform == "win32":
84-
CACHE_PATH = os.path.realpath(
85-
os.path.join(os.environ.get("APPDATA", os.path.expanduser("~")), "volatility3")
86-
)
87-
os.makedirs(CACHE_PATH, exist_ok=True)
88-
8992
IDENTIFIERS_FILENAME = "identifier.cache"
9093
"""Default location to record information about available identifiers"""
9194

0 commit comments

Comments
 (0)