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.
This commit is contained in:
Mike Auty
2017-11-02 11:56:03 +00:00
parent 5ef65d6d38
commit dbc73df8f2
2 changed files with 6 additions and 4 deletions
+4 -3
View File
@@ -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 []
+2 -1
View File
@@ -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: