Tidy up the config namespace around automagic a little.

This commit is contained in:
Mike Auty
2016-12-11 13:58:17 +00:00
parent e51c15ceb0
commit 5d15f810e1
3 changed files with 13 additions and 16 deletions
+4 -12
View File
@@ -65,19 +65,11 @@ class CommandLine(object):
# UI fills in the config:
ctx = contexts.Context()
if not args.file:
ctx.config["ui.single_location"] = "file:///home/memory/xp-laptop-2005-07-04-1430.img"
ctx.config["ui.single_location"] = "file:///home/memory/private/jon-fres.dmp"
if not args.file or not os.path.exists(args.file):
raise RuntimeError("Please provide a valid filename")
else:
ctx.config["ui.single_location"] = "file://" + os.path.abspath(args.file)
# ctx.config[
# "plugins.pslist.ntkrnlmp.class"] = "volatility.framework.symbols.windows.WindowsKernelIntermedSymbols"
# ctx.config[
# "plugins.pslist.ntkrnlmp.idd_filepath"] = "file:///home/mike/workspace/volatility3/aux/ntoskrnl.pdb.json"
# ctx.config["ui.single_location"] = "file:///run/media/mike/disk/memory/private/win10-x64-2016-05-28.lime"
# ctx.config["plugins.pslist.offset"] = 0xfe001608573c0
ctx.config["automagic.general.single_location"] = "file://" + os.path.abspath(args.file)
ctx.config["automagic.general.single_page_map_offset"] = 0x1ab000
###
# BACK TO THE FRAMEWORK
+3 -1
View File
@@ -230,8 +230,10 @@ class KernelPDBScanner(interfaces.automagic.AutomagicInterface):
except exceptions.PagedInvalidAddressException:
# We don't care if we're mapping an address to 0, it's not what we're looking for
pass
if not valid_kernels:
vollog.warning("No suitable kernel found for layer: {}".format(virtual_layer_name))
if not valid_kernels:
vollog.warning("No suitable kernel found for layer: {}".format(virtual_layer_name))
vollog.warning("No suitable kernels found during pdbscan")
return valid_kernels
def __call__(self, context, config_path, requirement):
+6 -3
View File
@@ -9,13 +9,15 @@ class LayerStacker(interfaces.automagic.AutomagicInterface):
"""Class that attempts to build up """
# Most important automagic, must happen first!
priority = 0
page_map_offset = None
location = None
def __call__(self, context, config_path, requirement):
"""Runs the automagic over the configurable"""
# Bow out quickly if the UI hasn't provided a single_location
if "ui.single_location" not in context.config:
if "automagic.general.single_location" not in context.config:
return
location = context.config["ui.single_location"]
location = context.config["automagic.general.single_location"]
self._check_type(location, str)
self._check_type(requirement, interfaces.configuration.RequirementInterface)
self.location = parse.urlparse(location)
@@ -27,7 +29,8 @@ class LayerStacker(interfaces.automagic.AutomagicInterface):
new_context = context.clone()
current_layer_name = context.memory.free_layer_name("FileLayer")
current_config_path = interfaces.configuration.path_join("automagic_general", current_layer_name)
current_config_path = interfaces.configuration.path_join("automagic", "layer_stacker", "stack",
current_layer_name)
# This must be specific to get us started, setup the config and run
new_context.config[interfaces.configuration.path_join(current_config_path, "filename")] = self.local_store
new_context.add_layer(physical.FileLayer(new_context, current_config_path, current_layer_name))