Agent: Add human-readable thread names to AutomatedMaster

This commit is contained in:
Mike Salvatore 2022-03-09 08:54:42 -05:00 committed by vakarisz
parent 847c7fbf9b
commit 66d9549507
4 changed files with 19 additions and 5 deletions

View File

@ -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()

View File

@ -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

View File

@ -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(

View File

@ -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),
)