mirror of
https://github.com/volatilityfoundation/volatility3.git
synced 2026-09-08 10:47:38 +02:00
Core: Fix LGTM recommendations
This is mostly unused imports and unused variables.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
import logging
|
||||
|
||||
from volatility.framework import interfaces, renderers, constants, contexts
|
||||
from volatility.framework import interfaces, renderers, constants
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.plugins.linux import pslist
|
||||
|
||||
@@ -27,7 +27,7 @@ class Check_creds(interfaces.plugins.PluginInterface):
|
||||
]
|
||||
|
||||
def _generator(self):
|
||||
vmlinux = contexts.Module(self.context, self.config['vmlinux'], self.config['primary'], 0)
|
||||
# vmlinux = contexts.Module(self.context, self.config['vmlinux'], self.config['primary'], 0)
|
||||
|
||||
type_task = self.context.symbol_space.get_type(self.config['vmlinux'] + constants.BANG + "task_struct")
|
||||
|
||||
|
||||
@@ -2,16 +2,12 @@
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from typing import Iterable, Callable, Tuple
|
||||
|
||||
from volatility.framework import renderers, interfaces, constants, exceptions, contexts
|
||||
from volatility.framework import renderers, interfaces, contexts
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.framework.objects import utility
|
||||
from volatility.framework.renderers import format_hints
|
||||
from volatility.framework.symbols import mac
|
||||
from volatility.plugins.mac import lsmod, kauth_scopes
|
||||
from volatility.framework.renderers import format_hints
|
||||
|
||||
|
||||
class Kauth_listeners(interfaces.plugins.PluginInterface):
|
||||
|
||||
@@ -2,16 +2,14 @@
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from typing import Iterable, Callable, Tuple
|
||||
|
||||
from volatility.framework import renderers, interfaces, constants, exceptions, contexts
|
||||
from volatility.framework import renderers, interfaces, contexts
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.framework.objects import utility
|
||||
from volatility.framework.renderers import format_hints
|
||||
from volatility.framework.symbols import mac
|
||||
from volatility.plugins.mac import lsmod
|
||||
from volatility.framework.renderers import format_hints
|
||||
|
||||
|
||||
class Kauth_scopes(interfaces.plugins.PluginInterface):
|
||||
@@ -37,8 +35,8 @@ class Kauth_scopes(interfaces.plugins.PluginInterface):
|
||||
darwin_symbols: str,
|
||||
filter_func: Callable[[int], bool] = lambda _: False) -> \
|
||||
Iterable[Tuple[interfaces.objects.ObjectInterface,
|
||||
interfaces.objects.ObjectInterface,
|
||||
interfaces.objects.ObjectInterface]]:
|
||||
interfaces.objects.ObjectInterface,
|
||||
interfaces.objects.ObjectInterface]]:
|
||||
"""
|
||||
Enumerates the registered kauth scopes and yields each object
|
||||
Uses smear-safe enumeration API
|
||||
|
||||
@@ -2,11 +2,9 @@
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from typing import Iterable, Callable, Tuple
|
||||
|
||||
from volatility.framework import renderers, interfaces, constants, exceptions, contexts
|
||||
from volatility.framework import renderers, interfaces, exceptions, contexts
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.framework.objects import utility
|
||||
from volatility.framework.symbols import mac
|
||||
@@ -76,7 +74,7 @@ class Kevents(interfaces.plugins.PluginInterface):
|
||||
def _walk_klist_array(cls, kernel, fdp, array_pointer_member, array_size_member):
|
||||
"""
|
||||
Convience wrapper for walking an array of lists of kernel events
|
||||
Handles invalid address references
|
||||
Handles invalid address references
|
||||
"""
|
||||
try:
|
||||
klist_array_pointer = getattr(fdp, array_pointer_member)
|
||||
|
||||
@@ -2,21 +2,18 @@
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
#
|
||||
import logging
|
||||
|
||||
from typing import Iterable, Optional
|
||||
|
||||
from volatility.framework import renderers, interfaces, exceptions
|
||||
from volatility.framework.objects import utility
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.framework.interfaces import plugins
|
||||
from volatility.framework.objects import utility
|
||||
from volatility.framework.renderers import format_hints
|
||||
from volatility.framework.symbols import mac
|
||||
from volatility.plugins.mac import mount
|
||||
|
||||
vollog = logging.getLogger(__name__)
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
class List_Files(plugins.PluginInterface):
|
||||
"""Lists all open file descriptors for all processes."""
|
||||
@@ -114,9 +111,9 @@ class List_Files(plugins.PluginInterface):
|
||||
|
||||
@classmethod
|
||||
def _walk_mounts(cls,
|
||||
context: interfaces.context.ContextInterface,
|
||||
layer_name: str,
|
||||
darwin_symbols: str) -> \
|
||||
context: interfaces.context.ContextInterface,
|
||||
layer_name: str,
|
||||
darwin_symbols: str) -> \
|
||||
Iterable[interfaces.objects.ObjectInterface]:
|
||||
|
||||
loop_vnodes = {}
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
import logging
|
||||
from typing import List
|
||||
|
||||
import volatility
|
||||
from volatility.framework import exceptions, interfaces
|
||||
from volatility.framework import renderers, contexts
|
||||
from volatility.framework.configuration import requirements
|
||||
@@ -38,7 +37,8 @@ class Socket_filters(plugins.PluginInterface):
|
||||
|
||||
handlers = mac.MacUtilities.generate_kernel_handler_info(self.context, self.config['primary'], kernel, mods)
|
||||
|
||||
members_to_check = ["sf_unregistered", "sf_attach", "sf_detach", "sf_notify", "sf_getpeername", "sf_getsockname", \
|
||||
members_to_check = ["sf_unregistered", "sf_attach", "sf_detach", "sf_notify", "sf_getpeername",
|
||||
"sf_getsockname", \
|
||||
"sf_data_in", "sf_data_out", "sf_connect_in", "sf_connect_out", "sf_bind", "sf_setoption", \
|
||||
"sf_getoption", "sf_listen", "sf_ioctl"]
|
||||
|
||||
|
||||
@@ -2,11 +2,7 @@
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from typing import Iterable, Callable, Tuple
|
||||
|
||||
from volatility.framework import renderers, interfaces, constants, exceptions, contexts
|
||||
from volatility.framework import renderers, interfaces, exceptions, contexts
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.framework.objects import utility
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ class CmdLine(interfaces.plugins.PluginInterface):
|
||||
A string with the command line
|
||||
"""
|
||||
|
||||
proc_id = proc.UniqueProcessId
|
||||
proc_layer_name = proc.add_process_layer()
|
||||
|
||||
peb = context.object(kernel_table_name + constants.BANG + "_PEB",
|
||||
|
||||
@@ -168,7 +168,6 @@ class Hashdump(interfaces.plugins.PluginInterface):
|
||||
enc_lm_hash = sam_data[lm_offset + 0x04:lm_offset + 0x14]
|
||||
lmhash = cls.decrypt_single_hash(rid, hbootkey, enc_lm_hash, cls.almpassword)
|
||||
elif lm_revision == b'\x02':
|
||||
lm_exists = lm_len == 56
|
||||
if lm_len == 56:
|
||||
lm_salt = sam_data[lm_offset + 4:lm_offset + 20]
|
||||
enc_lm_hash = sam_data[lm_offset + 20:lm_offset + 52]
|
||||
|
||||
@@ -11,7 +11,6 @@ from volatility.framework.interfaces import plugins
|
||||
from volatility.framework.renderers import TreeGrid
|
||||
from volatility.framework.symbols import intermed
|
||||
from volatility.framework.symbols.windows import extensions
|
||||
from volatility.framework.symbols.windows.extensions import kdbg
|
||||
|
||||
|
||||
class Info(plugins.PluginInterface):
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
#
|
||||
|
||||
import logging
|
||||
import datetime
|
||||
import logging
|
||||
from typing import Iterable, List, Optional
|
||||
|
||||
from volatility.framework import constants, exceptions, interfaces, renderers, symbols, layers
|
||||
from volatility.framework import constants, exceptions, interfaces, renderers, symbols
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.framework.renderers import format_hints
|
||||
from volatility.framework.symbols import intermed
|
||||
@@ -239,7 +239,7 @@ class NetScan(interfaces.plugins.PluginInterface, timeliner.TimeLinerInterface):
|
||||
layer_name: str,
|
||||
nt_symbol_table: str,
|
||||
netscan_symbol_table: str) -> \
|
||||
Iterable[interfaces.objects.ObjectInterface]:
|
||||
Iterable[interfaces.objects.ObjectInterface]:
|
||||
"""Scans for network objects using the poolscanner module and constraints.
|
||||
|
||||
Args:
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
import enum
|
||||
import logging
|
||||
from typing import Dict, Generator, List, Optional, Tuple, Callable
|
||||
from typing import Dict, Generator, List, Optional, Tuple
|
||||
|
||||
from volatility.framework import constants, interfaces, renderers, exceptions, symbols
|
||||
from volatility.framework.configuration import requirements
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
# This file is Copyright 2019 Volatility Foundation and licensed under the Volatility Software License 1.0
|
||||
# which is available at https://www.volatilityfoundation.org/license/vsl-v1.0
|
||||
|
||||
import json
|
||||
import logging
|
||||
import os, json
|
||||
from typing import Callable, List, Generator, Iterable
|
||||
import os
|
||||
from typing import List
|
||||
|
||||
from volatility.framework import renderers, interfaces, objects, exceptions, constants
|
||||
from volatility.framework.configuration import requirements
|
||||
from volatility.framework.objects import utility
|
||||
from volatility.framework.renderers import format_hints
|
||||
from volatility.plugins.windows import pslist
|
||||
|
||||
vollog = logging.getLogger(__name__)
|
||||
|
||||
@@ -43,10 +43,10 @@ class PrintKey(interfaces.plugins.PluginInterface):
|
||||
|
||||
@classmethod
|
||||
def key_iterator(
|
||||
cls,
|
||||
hive: RegistryHive,
|
||||
node_path: Sequence[objects.StructType] = None,
|
||||
recurse: bool = False
|
||||
cls,
|
||||
hive: RegistryHive,
|
||||
node_path: Sequence[objects.StructType] = None,
|
||||
recurse: bool = False
|
||||
) -> Iterable[Tuple[int, bool, datetime.datetime, str, bool, interfaces.objects.ObjectInterface]]:
|
||||
"""Walks through a set of nodes from a given node (last one in
|
||||
node_path). Avoids loops by not traversing into nodes already present
|
||||
@@ -79,7 +79,7 @@ class PrintKey(interfaces.plugins.PluginInterface):
|
||||
if recurse:
|
||||
if key_node.vol.offset not in [x.vol.offset for x in node_path]:
|
||||
try:
|
||||
sub_node_name = key_node.get_name()
|
||||
key_node.get_name()
|
||||
except exceptions.InvalidAddressException as excp:
|
||||
vollog.debug(excp)
|
||||
continue
|
||||
|
||||
@@ -183,7 +183,6 @@ class VadInfo(interfaces.plugins.PluginInterface):
|
||||
|
||||
for proc in procs:
|
||||
process_name = utility.array_to_string(proc.ImageFileName)
|
||||
proc_layer_name = proc.add_process_layer()
|
||||
|
||||
for vad in self.list_vads(proc, filter_func = filter_func):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user