Common: Fix configuration typehints to tuples
Configuration types need to be tuples, because that's what we expect on the object. They can stay as lists in the marshmallow schemas, because marshmallow schemas expect to take lists.
This commit is contained in:
parent
1252ad3b87
commit
0ab90aeaf5
|
@ -1,11 +1,12 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Any, List, Mapping
|
from typing import Any, Mapping, Tuple
|
||||||
|
|
||||||
from marshmallow import Schema, fields, post_load
|
from marshmallow import Schema, fields
|
||||||
from marshmallow.exceptions import MarshmallowError
|
from marshmallow.exceptions import MarshmallowError
|
||||||
|
|
||||||
|
from ..utils.code_utils import freeze_lists_in_dict
|
||||||
from .agent_sub_configuration_schemas import (
|
from .agent_sub_configuration_schemas import (
|
||||||
CustomPBAConfigurationSchema,
|
CustomPBAConfigurationSchema,
|
||||||
PluginConfigurationSchema,
|
PluginConfigurationSchema,
|
||||||
|
@ -16,7 +17,6 @@ from .agent_sub_configurations import (
|
||||||
PluginConfiguration,
|
PluginConfiguration,
|
||||||
PropagationConfiguration,
|
PropagationConfiguration,
|
||||||
)
|
)
|
||||||
from ..utils.code_utils import freeze_lists_in_dict
|
|
||||||
|
|
||||||
|
|
||||||
class InvalidConfigurationError(Exception):
|
class InvalidConfigurationError(Exception):
|
||||||
|
@ -34,9 +34,9 @@ class InvalidConfigurationError(Exception):
|
||||||
class AgentConfiguration:
|
class AgentConfiguration:
|
||||||
keep_tunnel_open_time: float
|
keep_tunnel_open_time: float
|
||||||
custom_pbas: CustomPBAConfiguration
|
custom_pbas: CustomPBAConfiguration
|
||||||
post_breach_actions: List[PluginConfiguration]
|
post_breach_actions: Tuple[PluginConfiguration]
|
||||||
credential_collectors: List[PluginConfiguration]
|
credential_collectors: Tuple[PluginConfiguration]
|
||||||
payloads: List[PluginConfiguration]
|
payloads: Tuple[PluginConfiguration]
|
||||||
propagation: PropagationConfiguration
|
propagation: PropagationConfiguration
|
||||||
|
|
||||||
def __post_init__(self):
|
def __post_init__(self):
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from typing import Dict, List
|
from typing import Dict, Tuple
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
@ -18,10 +18,10 @@ class PluginConfiguration:
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class ScanTargetConfiguration:
|
class ScanTargetConfiguration:
|
||||||
blocked_ips: List[str]
|
blocked_ips: Tuple[str]
|
||||||
inaccessible_subnets: List[str]
|
inaccessible_subnets: Tuple[str]
|
||||||
local_network_scan: bool
|
local_network_scan: bool
|
||||||
subnets: List[str]
|
subnets: Tuple[str]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
@ -32,27 +32,27 @@ class ICMPScanConfiguration:
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class TCPScanConfiguration:
|
class TCPScanConfiguration:
|
||||||
timeout: float
|
timeout: float
|
||||||
ports: List[int]
|
ports: Tuple[int]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class NetworkScanConfiguration:
|
class NetworkScanConfiguration:
|
||||||
tcp: TCPScanConfiguration
|
tcp: TCPScanConfiguration
|
||||||
icmp: ICMPScanConfiguration
|
icmp: ICMPScanConfiguration
|
||||||
fingerprinters: List[PluginConfiguration]
|
fingerprinters: Tuple[PluginConfiguration]
|
||||||
targets: ScanTargetConfiguration
|
targets: ScanTargetConfiguration
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class ExploitationOptionsConfiguration:
|
class ExploitationOptionsConfiguration:
|
||||||
http_ports: List[int]
|
http_ports: Tuple[int]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
class ExploitationConfiguration:
|
class ExploitationConfiguration:
|
||||||
options: ExploitationOptionsConfiguration
|
options: ExploitationOptionsConfiguration
|
||||||
brute_force: List[PluginConfiguration]
|
brute_force: Tuple[PluginConfiguration]
|
||||||
vulnerability: List[PluginConfiguration]
|
vulnerability: Tuple[PluginConfiguration]
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
||||||
|
|
Loading…
Reference in New Issue