From dbc73df8f254864c2526bb35967208f097d3193f Mon Sep 17 00:00:00 2001 From: Mike Auty Date: Thu, 2 Nov 2017 11:56:03 +0000 Subject: [PATCH] Make sure we support windows filenames Consider refactoring out the various URL openning code into one that just returns the open file handle. This would require changing the config option of "filename" to "location" and rejigging a few other bits elsewhere, but would centralize and make it more managable. --- volatility/framework/automagic/stacker.py | 7 ++++--- volatility/framework/symbols/intermed.py | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/volatility/framework/automagic/stacker.py b/volatility/framework/automagic/stacker.py index 205091bd5..eef908dd7 100644 --- a/volatility/framework/automagic/stacker.py +++ b/volatility/framework/automagic/stacker.py @@ -8,7 +8,8 @@ once a layer successfully stacks on top of the existing layers, it is removed fr """ import logging -from urllib import parse +import urllib.parse +import urllib.request import volatility from volatility.framework import configuration, interfaces @@ -64,12 +65,12 @@ class LayerStacker(interfaces.automagic.AutomagicInterface): return [] self._check_type(location, str) self._check_type(requirement, interfaces.configuration.RequirementInterface) - location = parse.urlparse(location) + location = urllib.parse.urlparse(location) # Setup the local copy of the resource self.local_store = None if location.scheme == "file": - self.local_store = location.path + self.local_store = urllib.request.url2pathname(location.path) else: vollog.warning("Only file scheme supported for single-location") return [] diff --git a/volatility/framework/symbols/intermed.py b/volatility/framework/symbols/intermed.py index f6a2543f3..cd8be04f6 100644 --- a/volatility/framework/symbols/intermed.py +++ b/volatility/framework/symbols/intermed.py @@ -6,6 +6,7 @@ import lzma import os import pathlib import urllib.parse +import urllib.request from volatility import schemas from volatility.framework import class_subclasses, constants, exceptions, interfaces, objects @@ -76,7 +77,7 @@ class IntermediateSymbolTable(interfaces.symbols.SymbolTableInterface): # Open the file and test the version self._versions = dict([(x.version, x) for x in class_subclasses(ISFormatTable)]) - url_path = urllib.parse.unquote(url.path) + url_path = urllib.request.url2pathname(url.path) if url_path.endswith('.xz'): fp = lzma.open(url_path, 'rt') else: