Skip to content

Commit

Permalink
Merge pull request #1318 from Abyss-W4tcher/use_volshell_additional_l…
Browse files Browse the repository at this point in the history
…ocals

Allow to import external locals in volshell environment
  • Loading branch information
ikelos authored Oct 23, 2024
2 parents 1500d2e + 7f2d8ea commit 62aa9c1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions volatility3/cli/volshell/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def get_requirements(cls) -> List[interfaces.configuration.RequirementInterface]
]

def run(
self, additional_locals: Dict[str, Any] = None
self, additional_locals: Dict[str, Any] = {}
) -> interfaces.renderers.TreeGrid:
"""Runs the interactive volshell plugin.
Expand Down Expand Up @@ -94,7 +94,10 @@ def run(
"""

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

0 comments on commit 62aa9c1

Please sign in to comment.