From 163c54a8c3f7249e39268c759f915e9add095372 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Tue, 30 Aug 2022 12:28:12 +0530 Subject: [PATCH] Agent: Replace fields in configuration using pydantic syntax in propagator --- monkey/infection_monkey/master/propagator.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/monkey/infection_monkey/master/propagator.py b/monkey/infection_monkey/master/propagator.py index c11e38d46..03a5d5ec7 100644 --- a/monkey/infection_monkey/master/propagator.py +++ b/monkey/infection_monkey/master/propagator.py @@ -1,5 +1,4 @@ import logging -from dataclasses import replace from ipaddress import IPv4Interface from queue import Queue from threading import Event @@ -93,9 +92,9 @@ class Propagator: modified_options = fingerprinter.options.copy() modified_options["http_ports"] = list(http_ports) - modified_fingerprinters[i] = replace(fingerprinter, options=modified_options) + modified_fingerprinters[i] = fingerprinter.copy(update={"options": modified_options}) - return replace(network_scan, fingerprinters=modified_fingerprinters) + return network_scan.copy(update={"fingerprinters": modified_fingerprinters}) def _scan_network(self, scan_config: NetworkScanConfiguration, stop: Event): logger.info("Starting network scan")