From 80a095b6574b325fe091070f8d5c9413331543ba Mon Sep 17 00:00:00 2001 From: vakarisz Date: Mon, 3 Oct 2022 14:45:29 +0300 Subject: [PATCH] Agent: Use NetworkPort instead of Port --- monkey/infection_monkey/master/ip_scan_results.py | 5 ++--- monkey/infection_monkey/master/propagator.py | 6 +++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/monkey/infection_monkey/master/ip_scan_results.py b/monkey/infection_monkey/master/ip_scan_results.py index 06bf7cd2f..8abce95e6 100644 --- a/monkey/infection_monkey/master/ip_scan_results.py +++ b/monkey/infection_monkey/master/ip_scan_results.py @@ -1,15 +1,14 @@ from dataclasses import dataclass from typing import Dict -from common.types import PingScanData +from common.types import NetworkPort, PingScanData from infection_monkey.i_puppet import FingerprintData, PortScanData -Port = int FingerprinterName = str @dataclass class IPScanResults: ping_scan_data: PingScanData - port_scan_data: Dict[Port, PortScanData] + port_scan_data: Dict[NetworkPort, PortScanData] fingerprint_data: Dict[FingerprinterName, FingerprintData] diff --git a/monkey/infection_monkey/master/propagator.py b/monkey/infection_monkey/master/propagator.py index 21a4708fb..f39d69d50 100644 --- a/monkey/infection_monkey/master/propagator.py +++ b/monkey/infection_monkey/master/propagator.py @@ -10,7 +10,7 @@ from common.agent_configuration import ( PropagationConfiguration, ScanTargetConfiguration, ) -from common.types import PingScanData, PortStatus +from common.types import NetworkPort, PingScanData, PortStatus from infection_monkey.i_puppet import ExploiterResultData, FingerprintData, PortScanData from infection_monkey.model import VictimHost, VictimHostFactory from infection_monkey.network import NetworkAddress @@ -21,7 +21,7 @@ from infection_monkey.telemetry.scan_telem import ScanTelem from infection_monkey.utils.threading import create_daemon_thread from . import Exploiter, IPScanner, IPScanResults -from .ip_scan_results import FingerprinterName, Port +from .ip_scan_results import FingerprinterName logger = logging.getLogger() @@ -146,7 +146,7 @@ class Propagator: @staticmethod def _process_tcp_scan_results( - victim_host: VictimHost, port_scan_data: Mapping[Port, PortScanData] + victim_host: VictimHost, port_scan_data: Mapping[NetworkPort, PortScanData] ): for psd in filter( lambda scan_data: scan_data.status == PortStatus.OPEN, port_scan_data.values()