Skip to content

Commit

Permalink
Merge pull request #1390 from j-t-1/Volshell
Browse files Browse the repository at this point in the history
Remove redundant part of if statement
  • Loading branch information
ikelos authored Dec 21, 2024
2 parents 6262fcf + 104cf0f commit 2bebc00
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions volatility3/cli/volshell/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@
from typing import Any, Dict, Iterable, List, Optional, Tuple, Type, Union
from urllib import parse, request

from volatility3.cli import text_renderer, volshell
from volatility3.framework import exceptions, interfaces, objects, plugins, renderers
from volatility3.framework.configuration import requirements
from volatility3.framework.layers import intel, physical, resources, scanners

try:
import capstone

has_capstone = True
except ImportError:
has_capstone = False

from volatility3.cli import text_renderer, volshell
from volatility3.framework import exceptions, interfaces, objects, plugins, renderers
from volatility3.framework.configuration import requirements
from volatility3.framework.layers import intel, physical, resources, scanners


class Volshell(interfaces.plugins.PluginInterface):
"""Shell environment to directly interact with a memory image."""
Expand Down Expand Up @@ -553,17 +553,16 @@ def create_configurable(
if argname in kwargs:
del kwargs[argname]

for keyword in kwargs:
val = kwargs[keyword]
if not isinstance(
val, interfaces.configuration.BasicTypes
) and not isinstance(val, list):
if not isinstance(val, list) or all(
isinstance(x, interfaces.configuration.BasicTypes) for x in val
):
raise TypeError(
"Configurable values must be simple types (int, bool, str, bytes)"
)
for keyword, val in kwargs.items():
BasicType_or_list_of_BasicType = False # excludes list of lists
if isinstance(val, interfaces.configuration.BasicTypes):
BasicType_or_list_of_BasicType = True
if all(isinstance(x, interfaces.configuration.BasicTypes) for x in val):
BasicType_or_list_of_BasicType = True
if not BasicType_or_list_of_BasicType:
raise TypeError(
"Configurable values must be simple types (int, bool, str, bytes)"
)
self.context.config[config_path + "." + keyword] = val

constructed = clazz(self.context, config_path, **constructor_args)
Expand Down

0 comments on commit 2bebc00

Please sign in to comment.