From bab4ebc2bcd9ceb3ba2ebde5e71a829aeb47142c Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Fri, 30 Sep 2022 13:47:31 +0530 Subject: [PATCH] Agent: Add 'source' field when creating TCPScanEvent in TCP scanner --- monkey/infection_monkey/network_scanning/tcp_scanner.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/network_scanning/tcp_scanner.py b/monkey/infection_monkey/network_scanning/tcp_scanner.py index 3f93069f3..2aedc6ee5 100644 --- a/monkey/infection_monkey/network_scanning/tcp_scanner.py +++ b/monkey/infection_monkey/network_scanning/tcp_scanner.py @@ -11,6 +11,7 @@ from common.types import PortStatus from common.utils import Timer from infection_monkey.i_puppet import PortScanData from infection_monkey.network.tools import BANNER_READ, DEFAULT_TIMEOUT, tcp_port_to_service +from infection_monkey.utils.ids import get_agent_id logger = logging.getLogger(__name__) @@ -46,7 +47,7 @@ def _generate_tcp_scan_event(host: str, port_scan_data: Dict[int, PortScanData]) for port, data in port_scan_data.items(): port_statuses[port] = data.status - return TCPScanEvent(target=host, ports=port_statuses) + return TCPScanEvent(source=get_agent_id(), target=host, ports=port_statuses) def _build_port_scan_data(