From 6e0f785ccc04cae1b7aaa974c9d480953da6bae0 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Sat, 30 Jan 2021 14:15:11 +0000 Subject: [PATCH] CLI: Add the ability to set the CACHE_PATH --- volatility3/cli/__init__.py | 7 +++++++ volatility3/cli/volshell/__init__.py | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/volatility3/cli/__init__.py b/volatility3/cli/__init__.py index 96d4bc599..290e08ddc 100644 --- a/volatility3/cli/__init__.py +++ b/volatility3/cli/__init__.py @@ -160,6 +160,10 @@ class CommandLine: help = "Clears out all short-term cached items", default = False, action = 'store_true') + parser.add_argument("--cache-path", + help = "Change the default path ({}) used to store the cache".format(constants.CACHE_PATH), + default = constants.CACHE_PATH, + type = str) # We have to filter out help, otherwise parse_known_args will trigger the help message before having # processed the plugin choice or had the plugin subparser added. @@ -179,6 +183,9 @@ class CommandLine: volatility3.symbols.__path__ = [os.path.abspath(p) for p in partial_args.symbol_dirs.split(";")] + constants.SYMBOL_BASEPATHS + if partial_args.cache_path: + constants.CACHE_PATH = partial_args.cache_path + if partial_args.log: file_logger = logging.FileHandler(partial_args.log) file_logger.setLevel(1) diff --git a/volatility3/cli/volshell/__init__.py b/volatility3/cli/volshell/__init__.py index 6dde83905..b67cc8a6c 100644 --- a/volatility3/cli/volshell/__init__.py +++ b/volatility3/cli/volshell/__init__.py @@ -90,6 +90,10 @@ class VolShell(cli.CommandLine): help = "Clears out all short-term cached items", default = False, action = 'store_true') + parser.add_argument("--cache-path", + help = "Change the default path ({}) used to store the cache".format(constants.CACHE_PATH), + default = constants.CACHE_PATH, + type = str) # Volshell specific flags os_specific = parser.add_mutually_exclusive_group(required = False) @@ -113,6 +117,9 @@ class VolShell(cli.CommandLine): volatility3.symbols.__path__ = [os.path.abspath(p) for p in partial_args.symbol_dirs.split(";")] + constants.SYMBOL_BASEPATHS + if partial_args.cache_path: + constants.CACHE_PATH = partial_args.cache_path + vollog.info("Volatility plugins path: {}".format(volatility3.plugins.__path__)) vollog.info("Volatility symbols path: {}".format(volatility3.symbols.__path__))