mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-08-23 14:42:25 +02:00
CLI: Remove unnecessary urllib imports
This commit is contained in:
@@ -19,7 +19,6 @@ import os
|
||||
import sys
|
||||
import tempfile
|
||||
import traceback
|
||||
import urllib
|
||||
from typing import Dict, Type, Union, Any
|
||||
from urllib import parse, request
|
||||
|
||||
@@ -338,17 +337,16 @@ class CommandLine:
|
||||
The URL for the location of the file
|
||||
"""
|
||||
# We want to work in URLs, but we need to accept absolute and relative files (including on windows)
|
||||
single_location = urllib.parse.urlparse(filename, '')
|
||||
single_location = parse.urlparse(filename, '')
|
||||
if single_location.scheme == '' or len(single_location.scheme) == 1:
|
||||
single_location = urllib.parse.urlparse(
|
||||
urllib.parse.urljoin('file:', urllib.request.pathname2url(os.path.abspath(filename))))
|
||||
single_location = parse.urlparse(parse.urljoin('file:', request.pathname2url(os.path.abspath(filename))))
|
||||
if single_location.scheme == 'file':
|
||||
if not os.path.exists(urllib.request.url2pathname(single_location.path)):
|
||||
filename = urllib.request.url2pathname(single_location.path)
|
||||
if not os.path.exists(request.url2pathname(single_location.path)):
|
||||
filename = request.url2pathname(single_location.path)
|
||||
if not filename:
|
||||
raise ValueError("File URL looks incorrect (potentially missing /)")
|
||||
raise ValueError("File does not exist: {}".format(filename))
|
||||
return urllib.parse.urlunparse(single_location)
|
||||
return parse.urlunparse(single_location)
|
||||
|
||||
def process_exceptions(self, excp):
|
||||
"""Provide useful feedback if an exception occurs during a run of a plugin."""
|
||||
|
||||
@@ -7,8 +7,6 @@ import json
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
import urllib
|
||||
from urllib import request
|
||||
|
||||
import volatility3.plugins
|
||||
import volatility3.symbols
|
||||
|
||||
@@ -9,7 +9,6 @@ import json
|
||||
import logging
|
||||
import lzma
|
||||
import os
|
||||
import urllib
|
||||
from bisect import bisect
|
||||
from typing import Tuple, Dict, Any, Optional, Union, List
|
||||
from urllib import request, error, parse
|
||||
|
||||
Reference in New Issue
Block a user