mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-10 11:47:38 +02:00
@@ -272,11 +272,11 @@ class CommandLine:
|
||||
# We want to work in URLs, but we need to accept absolute and relative files (including on windows)
|
||||
single_location = urllib.parse.urlparse(args.file, 'file')
|
||||
if single_location.scheme == 'file' or len(single_location.scheme) == 1:
|
||||
# Otherwise construct a URL parameter
|
||||
file_path = request.pathname2url(os.path.abspath(args.file))
|
||||
single_location = urllib.parse.urlparse(urllib.parse.urljoin('file:', file_path))
|
||||
if not os.path.exists(single_location.path):
|
||||
parser.error("File does not exist: {}".format(single_location.path))
|
||||
if len(single_location.scheme) == 1:
|
||||
# Mis-parsed a windows drive as a scheme, it doesn't need abspath because it features a drive letter
|
||||
single_location = urllib.parse.urlparse(urllib.parse.urljoin('file:', urllib.request.pathname2url(args.file)))
|
||||
if not os.path.exists(urllib.request.url2pathname(single_location.path)):
|
||||
parser.error("File does not exist: {}".format(os.path.exists(urllib.request.url2pathname(single_location.path))))
|
||||
ctx.config['automagic.LayerStacker.single_location'] = urllib.parse.urlunparse(single_location)
|
||||
|
||||
# UI fills in the config, here we load it from the config file and do it before we process the CL parameters
|
||||
|
||||
@@ -7,6 +7,7 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import urllib
|
||||
from urllib import request
|
||||
|
||||
import volatility3.plugins
|
||||
@@ -199,12 +200,17 @@ class VolShell(cli.CommandLine):
|
||||
# NOTE: This will *BREAK* if LayerStacker, or the automagic configuration system, changes at all
|
||||
###
|
||||
if args.file:
|
||||
file_name = os.path.abspath(args.file)
|
||||
if not os.path.exists(file_name):
|
||||
vollog.log(logging.INFO, "File does not exist: {}".format(file_name))
|
||||
else:
|
||||
single_location = "file:" + request.pathname2url(file_name)
|
||||
ctx.config['automagic.LayerStacker.single_location'] = single_location
|
||||
# We want to work in URLs, but we need to accept absolute and relative files (including on windows)
|
||||
single_location = urllib.parse.urlparse(args.file, 'file')
|
||||
if single_location.scheme == 'file' or len(single_location.scheme) == 1:
|
||||
if len(single_location.scheme) == 1:
|
||||
# Mis-parsed a windows drive as a scheme, it doesn't need abspath because it features a drive letter
|
||||
single_location = urllib.parse.urlparse(
|
||||
urllib.parse.urljoin('file:', urllib.request.pathname2url(args.file)))
|
||||
if not os.path.exists(urllib.request.url2pathname(single_location.path)):
|
||||
parser.error("File does not exist: {}".format(
|
||||
os.path.exists(urllib.request.url2pathname(single_location.path))))
|
||||
ctx.config['automagic.LayerStacker.single_location'] = urllib.parse.urlunparse(single_location)
|
||||
|
||||
# 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:
|
||||
|
||||
Reference in New Issue
Block a user