Skip to content

Commit 62aa9c1

Browse files
authored
Merge pull request #1318 from Abyss-W4tcher/use_volshell_additional_locals
Allow to import external locals in volshell environment
2 parents 1500d2e + 7f2d8ea commit 62aa9c1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

volatility3/cli/volshell/generic.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
5858
]
5959

6060
def run(
61-
self, additional_locals: Dict[str, Any] = None
61+
self, additional_locals: Dict[str, Any] = {}
6262
) -> interfaces.renderers.TreeGrid:
6363
"""Runs the interactive volshell plugin.
6464
@@ -94,7 +94,10 @@ def run(
9494
"""
9595

9696
sys.ps1 = f"({self.current_layer}) >>> "
97-
self.__console = code.InteractiveConsole(locals=self._construct_locals_dict())
97+
# Dict self._construct_locals_dict() will have priority on keys
98+
combined_locals = additional_locals.copy()
99+
combined_locals.update(self._construct_locals_dict())
100+
self.__console = code.InteractiveConsole(locals=combined_locals)
98101
# Since we have to do work to add the option only once for all different modes of volshell, we can't
99102
# rely on the default having been set
100103
if self.config.get("script", None) is not None:

0 commit comments

Comments
 (0)