Island: Refactor logic to start threads in AWSService

This commit is contained in:
Mike Salvatore 2022-05-11 08:04:25 -04:00
parent 680dbca574
commit 825c7b9ecf
1 changed files with 6 additions and 8 deletions
monkey/monkey_island/cc/services/aws

View File

@ -84,15 +84,13 @@ class AWSService:
results_queue = Queue() results_queue = Queue()
command_threads = [] command_threads = []
for i in instances: for i in instances:
command_threads.append( t = Thread(
Thread(
target=self._run_agent_on_managed_instance, target=self._run_agent_on_managed_instance,
args=(results_queue, i["instance_id"], i["os"], island_ip), args=(results_queue, i["instance_id"], i["os"], island_ip),
daemon=True, daemon=True,
) )
) t.start()
command_threads.append(t)
[thread.start() for thread in command_threads]
for thread in command_threads: for thread in command_threads:
thread.join() thread.join()