From 03c647790206267ecf4c3d4921b2a0164ea4dcd1 Mon Sep 17 00:00:00 2001 From: David McDonald Date: Fri, 28 Mar 2025 13:04:24 -0500 Subject: [PATCH] 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. --- volatility3/cli/volshell/generic.py | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/volatility3/cli/volshell/generic.py b/volatility3/cli/volshell/generic.py index 1b3ae59d1..39e4fc963 100644 --- a/volatility3/cli/volshell/generic.py +++ b/volatility3/cli/volshell/generic.py @@ -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] = {}