From b759ff3966d276396e1ff546d2aa1e053570a0e1 Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Thu, 10 Dec 2020 10:07:30 +0000 Subject: [PATCH] Volshell: Clarify load_file to accept location and filename --- volatility/cli/volshell/generic.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/volatility/cli/volshell/generic.py b/volatility/cli/volshell/generic.py index 896364451..ded061988 100644 --- a/volatility/cli/volshell/generic.py +++ b/volatility/cli/volshell/generic.py @@ -9,6 +9,7 @@ import string import struct import sys from typing import Any, Dict, List, Optional, Tuple, Union, Type +from urllib import request from volatility.cli import text_renderer from volatility.framework import renderers, interfaces, objects, plugins, exceptions @@ -317,9 +318,11 @@ class Volshell(interfaces.plugins.PluginInterface): len_offset = len(hex(symbol.address)) print(" " * (longest_offset - len_offset), hex(symbol.address), " ", symbol.name) - def load_file(self, filename: str): - """Loads a file into a layer and returns the name of the layer""" + def load_file(self, location: str = None, filename: str = ''): + """Loads a file into a Filelayer and returns the name of the layer""" layer_name = self.context.layers.free_layer_name() + if location is None: + location = "file:" + request.pathname2url(filename) current_config_path = 'volshell.layers.' + layer_name self.context.config[interfaces.configuration.path_join(current_config_path, "location")] = filename layer = physical.FileLayer(self.context, current_config_path, layer_name)