forked from p15670423/monkey
Agent: Inject credentials store to Automated Master
Intercept credentials and update the credentials store using credentials intercepting telemetry messenger
This commit is contained in:
parent
4de90584c9
commit
d434c20bcb
|
@ -3,6 +3,7 @@ import threading
|
||||||
import time
|
import time
|
||||||
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
|
from typing import Any, Callable, Dict, Iterable, List, Optional, Tuple
|
||||||
|
|
||||||
|
from infection_monkey.credential_store import ICredentialsStore
|
||||||
from infection_monkey.i_control_channel import IControlChannel, IslandCommunicationError
|
from infection_monkey.i_control_channel import IControlChannel, IslandCommunicationError
|
||||||
from infection_monkey.i_master import IMaster
|
from infection_monkey.i_master import IMaster
|
||||||
from infection_monkey.i_puppet import IPuppet
|
from infection_monkey.i_puppet import IPuppet
|
||||||
|
@ -36,6 +37,7 @@ class AutomatedMaster(IMaster):
|
||||||
victim_host_factory: VictimHostFactory,
|
victim_host_factory: VictimHostFactory,
|
||||||
control_channel: IControlChannel,
|
control_channel: IControlChannel,
|
||||||
local_network_interfaces: List[NetworkInterface],
|
local_network_interfaces: List[NetworkInterface],
|
||||||
|
credentials_store: ICredentialsStore,
|
||||||
):
|
):
|
||||||
self._current_depth = current_depth
|
self._current_depth = current_depth
|
||||||
self._puppet = puppet
|
self._puppet = puppet
|
||||||
|
@ -43,9 +45,8 @@ class AutomatedMaster(IMaster):
|
||||||
self._control_channel = control_channel
|
self._control_channel = control_channel
|
||||||
|
|
||||||
ip_scanner = IPScanner(self._puppet, NUM_SCAN_THREADS)
|
ip_scanner = IPScanner(self._puppet, NUM_SCAN_THREADS)
|
||||||
exploiter = Exploiter(
|
|
||||||
self._puppet, NUM_EXPLOIT_THREADS, self._control_channel.get_credentials_for_propagation
|
exploiter = Exploiter(self._puppet, NUM_EXPLOIT_THREADS, credentials_store.get_credentials)
|
||||||
)
|
|
||||||
self._propagator = Propagator(
|
self._propagator = Propagator(
|
||||||
self._telemetry_messenger,
|
self._telemetry_messenger,
|
||||||
ip_scanner,
|
ip_scanner,
|
||||||
|
|
|
@ -15,6 +15,7 @@ from infection_monkey.credential_collectors import (
|
||||||
MimikatzCredentialCollector,
|
MimikatzCredentialCollector,
|
||||||
SSHCredentialCollector,
|
SSHCredentialCollector,
|
||||||
)
|
)
|
||||||
|
from infection_monkey.credential_store import AggregatingCredentialsStore
|
||||||
from infection_monkey.exploit import CachingAgentRepository, ExploiterWrapper
|
from infection_monkey.exploit import CachingAgentRepository, ExploiterWrapper
|
||||||
from infection_monkey.exploit.hadoop import HadoopExploiter
|
from infection_monkey.exploit.hadoop import HadoopExploiter
|
||||||
from infection_monkey.exploit.log4shell import Log4ShellExploiter
|
from infection_monkey.exploit.log4shell import Log4ShellExploiter
|
||||||
|
@ -54,6 +55,9 @@ from infection_monkey.puppet.puppet import Puppet
|
||||||
from infection_monkey.system_singleton import SystemSingleton
|
from infection_monkey.system_singleton import SystemSingleton
|
||||||
from infection_monkey.telemetry.attack.t1106_telem import T1106Telem
|
from infection_monkey.telemetry.attack.t1106_telem import T1106Telem
|
||||||
from infection_monkey.telemetry.attack.t1107_telem import T1107Telem
|
from infection_monkey.telemetry.attack.t1107_telem import T1107Telem
|
||||||
|
from infection_monkey.telemetry.messengers.credentials_intercepting_telemetry_messenger import (
|
||||||
|
CredentialsInterceptingTelemetryMessenger,
|
||||||
|
)
|
||||||
from infection_monkey.telemetry.messengers.exploit_intercepting_telemetry_messenger import (
|
from infection_monkey.telemetry.messengers.exploit_intercepting_telemetry_messenger import (
|
||||||
ExploitInterceptingTelemetryMessenger,
|
ExploitInterceptingTelemetryMessenger,
|
||||||
)
|
)
|
||||||
|
@ -183,14 +187,25 @@ class InfectionMonkey:
|
||||||
telemetry_messenger = ExploitInterceptingTelemetryMessenger(
|
telemetry_messenger = ExploitInterceptingTelemetryMessenger(
|
||||||
self.telemetry_messenger, self._monkey_inbound_tunnel
|
self.telemetry_messenger, self._monkey_inbound_tunnel
|
||||||
)
|
)
|
||||||
|
control_channel = ControlChannel(self._default_server, GUID)
|
||||||
|
|
||||||
|
credentials_store = AggregatingCredentialsStore(control_channel)
|
||||||
|
|
||||||
|
telemetry_messenger = CredentialsInterceptingTelemetryMessenger(
|
||||||
|
ExploitInterceptingTelemetryMessenger(
|
||||||
|
self.telemetry_messenger, self._monkey_inbound_tunnel
|
||||||
|
),
|
||||||
|
credentials_store,
|
||||||
|
)
|
||||||
|
|
||||||
self._master = AutomatedMaster(
|
self._master = AutomatedMaster(
|
||||||
self._current_depth,
|
self._current_depth,
|
||||||
puppet,
|
puppet,
|
||||||
telemetry_messenger,
|
telemetry_messenger,
|
||||||
victim_host_factory,
|
victim_host_factory,
|
||||||
ControlChannel(self._default_server, GUID),
|
control_channel,
|
||||||
local_network_interfaces,
|
local_network_interfaces,
|
||||||
|
credentials_store,
|
||||||
)
|
)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
|
|
Loading…
Reference in New Issue