mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-10 03:37:39 +02:00
Core: Implement the ability to cache from the CLI
This commit is contained in:
@@ -10,6 +10,8 @@ from typing import List, TypeVar, Callable, Any, Optional
|
||||
_T = TypeVar("_T")
|
||||
_S = TypeVar("_S")
|
||||
|
||||
CACHING = True
|
||||
|
||||
|
||||
class classproperty(property):
|
||||
"""Class property decorator.
|
||||
|
||||
@@ -22,6 +22,11 @@ import traceback
|
||||
from typing import Dict, Type, Union, Any
|
||||
from urllib import parse, request
|
||||
|
||||
import volatility
|
||||
|
||||
if "--live" in sys.argv:
|
||||
volatility.CACHING = False
|
||||
|
||||
import volatility.plugins
|
||||
import volatility.symbols
|
||||
from volatility import framework
|
||||
@@ -134,6 +139,7 @@ class CommandLine:
|
||||
help = "Log output to a file as well as the console",
|
||||
default = None,
|
||||
type = str)
|
||||
parser.add_argument("--live", help = "Disable caching of layer reads", action = 'store_true')
|
||||
parser.add_argument("-o",
|
||||
"--output-dir",
|
||||
help = "Directory in which to output any generated files",
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import functools
|
||||
import volatility
|
||||
|
||||
|
||||
def lru_cache(*args, **kwargs):
|
||||
if not volatility.CACHING:
|
||||
return lambda x: x
|
||||
raise Exception
|
||||
return functools.lru_cache(*args, **kwargs)
|
||||
Reference in New Issue
Block a user