diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 7fc8d89b2..c8132e054 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -12,7 +12,10 @@ from common.utils.attack_utils import ScanStatus, UsageEnum from common.version import get_version from infection_monkey.config import GUID, WormConfiguration from infection_monkey.control import ControlClient -from infection_monkey.credential_collectors import MimikatzCredentialCollector +from infection_monkey.credential_collectors import ( + MimikatzCredentialCollector, + SSHCredentialCollector, +) from infection_monkey.i_puppet import IPuppet, PluginType from infection_monkey.master import AutomatedMaster from infection_monkey.master.control_channel import ControlChannel @@ -170,7 +173,7 @@ class InfectionMonkey: def _build_master(self): local_network_interfaces = InfectionMonkey._get_local_network_interfaces() - puppet = InfectionMonkey._build_puppet() + puppet = self._build_puppet() victim_host_factory = self._build_victim_host_factory(local_network_interfaces) @@ -190,8 +193,7 @@ class InfectionMonkey: return local_network_interfaces - @staticmethod - def _build_puppet() -> IPuppet: + def _build_puppet(self) -> IPuppet: puppet = Puppet() puppet.load_plugin( @@ -199,6 +201,11 @@ class InfectionMonkey: MimikatzCredentialCollector(), PluginType.CREDENTIAL_COLLECTOR, ) + puppet.load_plugin( + "SSHCollector", + SSHCredentialCollector(self.telemetry_messenger), + PluginType.CREDENTIAL_COLLECTOR, + ) puppet.load_plugin("elastic", ElasticSearchFingerprinter(), PluginType.FINGERPRINTER) puppet.load_plugin("http", HTTPFingerprinter(), PluginType.FINGERPRINTER) diff --git a/monkey/infection_monkey/puppet/puppet.py b/monkey/infection_monkey/puppet/puppet.py index 0bf07f714..5150c9b6f 100644 --- a/monkey/infection_monkey/puppet/puppet.py +++ b/monkey/infection_monkey/puppet/puppet.py @@ -29,7 +29,10 @@ class Puppet(IPuppet): self._plugin_registry.load_plugin(plugin_name, plugin, plugin_type) def run_credential_collector(self, name: str, options: Dict) -> Sequence[Credentials]: - return list(self._mock_puppet.run_credential_collector(name, options)) + credential_collector = self._plugin_registry.get_plugin( + name, PluginType.CREDENTIAL_COLLECTOR + ) + return list(credential_collector.collect_credentials(options)) def run_pba(self, name: str, options: Dict) -> PostBreachData: return self._mock_puppet.run_pba(name, options)