Agent: Use Sequence instead of List for type hints

This commit is contained in:
Mike Salvatore 2022-06-24 19:19:51 -04:00
parent 4f7d8be6ba
commit 503a0a833f
2 changed files with 7 additions and 7 deletions

View File

@ -5,7 +5,7 @@ from copy import deepcopy
from itertools import chain
from queue import Queue
from threading import Event
from typing import Callable, Dict, List
from typing import Callable, Dict, Sequence
from common import OperatingSystems
from common.configuration.agent_sub_configurations import (
@ -81,7 +81,7 @@ class Exploiter:
@staticmethod
def _process_exploiter_config(
exploiter_config: ExploitationConfiguration,
) -> List[ExploiterConfiguration]:
) -> Sequence[ExploiterConfiguration]:
# Run vulnerability exploiters before brute force exploiters to minimize the effect of
# account lockout due to invalid credentials
ordered_exploiters = chain(exploiter_config.vulnerability, exploiter_config.brute_force)
@ -98,7 +98,7 @@ class Exploiter:
def _exploit_hosts_on_queue(
self,
exploiters_to_run: List[ExploiterConfiguration],
exploiters_to_run: Sequence[ExploiterConfiguration],
hosts_to_exploit: Queue,
current_depth: int,
results_callback: Callback,
@ -125,7 +125,7 @@ class Exploiter:
def _run_all_exploiters(
self,
exploiters_to_run: List[ExploiterConfiguration],
exploiters_to_run: Sequence[ExploiterConfiguration],
victim_host: VictimHost,
current_depth: int,
results_callback: Callback,

View File

@ -3,7 +3,7 @@ import queue
import threading
from queue import Queue
from threading import Event
from typing import Callable, Dict, List
from typing import Callable, Dict, Sequence
from common.configuration.agent_sub_configurations import (
NetworkScanConfiguration,
@ -34,7 +34,7 @@ class IPScanner:
def scan(
self,
addresses_to_scan: List[NetworkAddress],
addresses_to_scan: Sequence[NetworkAddress],
options: ScanTargetConfiguration,
results_callback: Callback,
stop: Event,
@ -99,7 +99,7 @@ class IPScanner:
def _run_fingerprinters(
self,
ip: str,
fingerprinters: List[PluginConfiguration],
fingerprinters: Sequence[PluginConfiguration],
ping_scan_data: PingScanData,
port_scan_data: Dict[int, PortScanData],
stop: Event,