mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-07 02:07:39 +02:00
Improve config.json handling, making single_location optional but bypasses the stacker automagic.
This commit is contained in:
@@ -98,6 +98,12 @@ class CommandLine(object):
|
||||
plugin = plugin_list[args.plugin]
|
||||
plugin_config_path = interfaces.configuration.path_join('plugins', plugin.__name__)
|
||||
|
||||
# UI fills in the config, here we load it from the config file and do it before we process the CL parameters
|
||||
if args.config:
|
||||
with open(args.config, "r") as f:
|
||||
json_val = json.load(f)
|
||||
ctx.config.splice(plugin_config_path, HierarchicalDict(json_val))
|
||||
|
||||
# Populate the context config based on the returned args
|
||||
# We have already determined these elements must be descended from ConfigurableInterface
|
||||
vargs = vars(args)
|
||||
@@ -113,12 +119,6 @@ class CommandLine(object):
|
||||
extended_path = interfaces.configuration.path_join(config_path, requirement.name)
|
||||
ctx.config[extended_path] = value
|
||||
|
||||
# UI fills in the config:
|
||||
if args.config:
|
||||
with open(args.config, "r") as f:
|
||||
json_val = json.load(f)
|
||||
ctx.config.splice(plugin_config_path, HierarchicalDict(json_val))
|
||||
|
||||
###
|
||||
# BACK TO THE FRAMEWORK
|
||||
###
|
||||
@@ -134,8 +134,10 @@ class CommandLine(object):
|
||||
|
||||
constructed = plugin(ctx, plugin_config_path)
|
||||
|
||||
with open("config.json", "w") as f:
|
||||
json.dump(dict(constructed.build_configuration()), f, sort_keys = True, indent = 2)
|
||||
if args.verbosity >= 2:
|
||||
vollog.debug("Writing out configuration data to config.json")
|
||||
with open("config.json", "w") as f:
|
||||
json.dump(dict(constructed.build_configuration()), f, sort_keys = True, indent = 2)
|
||||
|
||||
# Construct and run the plugin
|
||||
QuickTextRenderer().render(constructed.run())
|
||||
|
||||
@@ -11,8 +11,7 @@ import logging
|
||||
from urllib import parse
|
||||
|
||||
import volatility
|
||||
from volatility.framework import configuration
|
||||
from volatility.framework import interfaces
|
||||
from volatility.framework import configuration, interfaces
|
||||
from volatility.framework.automagic import construct_layers
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.framework.layers import physical
|
||||
@@ -48,6 +47,9 @@ class LayerStacker(interfaces.automagic.AutomagicInterface):
|
||||
vollog.info("Unable to run LayerStacker, unsatisfied requirement: {}".format(unsatisfied))
|
||||
return unsatisfied
|
||||
location = self.config["single_location"]
|
||||
if not location:
|
||||
vollog.info("Unable to run LayerStacker, single_location parameter not provided")
|
||||
return []
|
||||
self._check_type(location, str)
|
||||
self._check_type(requirement, interfaces.configuration.RequirementInterface)
|
||||
location = parse.urlparse(location)
|
||||
@@ -135,4 +137,4 @@ class LayerStacker(interfaces.automagic.AutomagicInterface):
|
||||
# This is not optional for the stacker to run, so optional must be marked as False
|
||||
return [requirements.StringRequirement("single_location",
|
||||
description = "Specifies a base location on which to stack",
|
||||
optional = False)]
|
||||
optional = True)]
|
||||
|
||||
Reference in New Issue
Block a user