mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-08-17 20:35:40 +02:00
Volshell: Attempt to resolve requirement conflicts
This change sets the `script`, `script-only`, and `primary` requirements to only apply to the `generic.Volshell` class. `regex-scanner` is okay to be shared between the base and inherited classes, but `script` and `script-only` have to be generic-only in order to avoid conflicts when populating the argparse parser. `primary` must be generic-only in order to avoid ending up unsatisfied when superclass requirements require a module, suppressing construction of the `primary` layer.
This commit is contained in:
@@ -54,20 +54,24 @@ class Volshell(interfaces.plugins.PluginInterface):
|
||||
|
||||
@classmethod
|
||||
def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]:
|
||||
reqs: List[interfaces.configuration.RequirementInterface] = []
|
||||
reqs: List[interfaces.configuration.RequirementInterface] = [
|
||||
requirements.VersionRequirement(
|
||||
name="regex_scanner",
|
||||
component=scanners.RegExScanner,
|
||||
version=(1, 0, 0),
|
||||
),
|
||||
]
|
||||
if cls == Volshell:
|
||||
reqs = [
|
||||
reqs += [
|
||||
requirements.TranslationLayerRequirement(
|
||||
name="primary", description="Memory layer for the kernel"
|
||||
),
|
||||
requirements.URIRequirement(
|
||||
name="script",
|
||||
description="File to load and execute at start",
|
||||
default=None,
|
||||
optional=True,
|
||||
),
|
||||
requirements.VersionRequirement(
|
||||
name="regex_scanner",
|
||||
component=scanners.RegExScanner,
|
||||
version=(1, 0, 0),
|
||||
),
|
||||
requirements.BooleanRequirement(
|
||||
name="script-only",
|
||||
description="Exit volshell after the script specified in --script completes",
|
||||
@@ -75,11 +79,8 @@ class Volshell(interfaces.plugins.PluginInterface):
|
||||
optional=True,
|
||||
),
|
||||
]
|
||||
return reqs + [
|
||||
requirements.TranslationLayerRequirement(
|
||||
name="primary", description="Memory layer for the kernel"
|
||||
),
|
||||
]
|
||||
|
||||
return reqs
|
||||
|
||||
def run(
|
||||
self, additional_locals: Dict[str, Any] = {}
|
||||
|
||||
Reference in New Issue
Block a user