diff --git a/monkey/infection_monkey/master/automated_master.py b/monkey/infection_monkey/master/automated_master.py index 51627d728..edc922fa2 100644 --- a/monkey/infection_monkey/master/automated_master.py +++ b/monkey/infection_monkey/master/automated_master.py @@ -55,8 +55,12 @@ class AutomatedMaster(IMaster): ) self._stop = threading.Event() - self._master_thread = create_daemon_thread(target=self._run_master_thread) - self._simulation_thread = create_daemon_thread(target=self._run_simulation) + self._master_thread = create_daemon_thread( + target=self._run_master_thread, name="AutomatedMasterThread" + ) + self._simulation_thread = create_daemon_thread( + target=self._run_simulation, name="SimulationThread" + ) def start(self): logger.info("Starting automated breach and attack simulation") @@ -144,6 +148,7 @@ class AutomatedMaster(IMaster): credential_collector_thread = create_daemon_thread( target=self._run_plugins, + name="CredentialCollectorThread", args=( config["credential_collector_classes"], "credential collector", @@ -152,6 +157,7 @@ class AutomatedMaster(IMaster): ) pba_thread = create_daemon_thread( target=self._run_plugins, + name="PBAThread", args=(config["post_breach_actions"].items(), "post-breach action", self._run_pba), ) @@ -172,6 +178,7 @@ class AutomatedMaster(IMaster): payload_thread = create_daemon_thread( target=self._run_plugins, + name="PayloadThread", args=(config["payloads"].items(), "payload", self._run_payload), ) payload_thread.start() diff --git a/monkey/infection_monkey/master/exploiter.py b/monkey/infection_monkey/master/exploiter.py index b2049eb38..c2c00c1ef 100644 --- a/monkey/infection_monkey/master/exploiter.py +++ b/monkey/infection_monkey/master/exploiter.py @@ -54,7 +54,10 @@ class Exploiter: stop, ) run_worker_threads( - target=self._exploit_hosts_on_queue, args=exploit_args, num_workers=self._num_workers + target=self._exploit_hosts_on_queue, + name_prefix="ExploiterThread", + args=exploit_args, + num_workers=self._num_workers, ) @staticmethod diff --git a/monkey/infection_monkey/master/ip_scanner.py b/monkey/infection_monkey/master/ip_scanner.py index ee474ab49..a24b136aa 100644 --- a/monkey/infection_monkey/master/ip_scanner.py +++ b/monkey/infection_monkey/master/ip_scanner.py @@ -42,7 +42,10 @@ class IPScanner: scan_ips_args = (addresses, options, results_callback, stop) run_worker_threads( - target=self._scan_addresses, args=scan_ips_args, num_workers=self._num_workers + target=self._scan_addresses, + name_prefix="ScanThread", + args=scan_ips_args, + num_workers=self._num_workers, ) def _scan_addresses( diff --git a/monkey/infection_monkey/master/propagator.py b/monkey/infection_monkey/master/propagator.py index 4ed86cd32..be4d6caf2 100644 --- a/monkey/infection_monkey/master/propagator.py +++ b/monkey/infection_monkey/master/propagator.py @@ -46,10 +46,11 @@ class Propagator: self._hosts_to_exploit = Queue() scan_thread = create_daemon_thread( - target=self._scan_network, args=(propagation_config, stop) + target=self._scan_network, name="PropagatorScanThread", args=(propagation_config, stop) ) exploit_thread = create_daemon_thread( target=self._exploit_hosts, + name="PropagatorExploitThread", args=(propagation_config, current_depth, network_scan_completed, stop), )