forked from p15670423/monkey
Agent: Implement run_credential_collector() in Puppet
This commit is contained in:
parent
10ee9f9e75
commit
3a3a5f0c9c
|
@ -12,7 +12,10 @@ from common.utils.attack_utils import ScanStatus, UsageEnum
|
||||||
from common.version import get_version
|
from common.version import get_version
|
||||||
from infection_monkey.config import GUID, WormConfiguration
|
from infection_monkey.config import GUID, WormConfiguration
|
||||||
from infection_monkey.control import ControlClient
|
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.i_puppet import IPuppet, PluginType
|
||||||
from infection_monkey.master import AutomatedMaster
|
from infection_monkey.master import AutomatedMaster
|
||||||
from infection_monkey.master.control_channel import ControlChannel
|
from infection_monkey.master.control_channel import ControlChannel
|
||||||
|
@ -170,7 +173,7 @@ class InfectionMonkey:
|
||||||
|
|
||||||
def _build_master(self):
|
def _build_master(self):
|
||||||
local_network_interfaces = InfectionMonkey._get_local_network_interfaces()
|
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)
|
victim_host_factory = self._build_victim_host_factory(local_network_interfaces)
|
||||||
|
|
||||||
|
@ -190,8 +193,7 @@ class InfectionMonkey:
|
||||||
|
|
||||||
return local_network_interfaces
|
return local_network_interfaces
|
||||||
|
|
||||||
@staticmethod
|
def _build_puppet(self) -> IPuppet:
|
||||||
def _build_puppet() -> IPuppet:
|
|
||||||
puppet = Puppet()
|
puppet = Puppet()
|
||||||
|
|
||||||
puppet.load_plugin(
|
puppet.load_plugin(
|
||||||
|
@ -199,6 +201,11 @@ class InfectionMonkey:
|
||||||
MimikatzCredentialCollector(),
|
MimikatzCredentialCollector(),
|
||||||
PluginType.CREDENTIAL_COLLECTOR,
|
PluginType.CREDENTIAL_COLLECTOR,
|
||||||
)
|
)
|
||||||
|
puppet.load_plugin(
|
||||||
|
"SSHCollector",
|
||||||
|
SSHCredentialCollector(self.telemetry_messenger),
|
||||||
|
PluginType.CREDENTIAL_COLLECTOR,
|
||||||
|
)
|
||||||
|
|
||||||
puppet.load_plugin("elastic", ElasticSearchFingerprinter(), PluginType.FINGERPRINTER)
|
puppet.load_plugin("elastic", ElasticSearchFingerprinter(), PluginType.FINGERPRINTER)
|
||||||
puppet.load_plugin("http", HTTPFingerprinter(), PluginType.FINGERPRINTER)
|
puppet.load_plugin("http", HTTPFingerprinter(), PluginType.FINGERPRINTER)
|
||||||
|
|
|
@ -29,7 +29,10 @@ class Puppet(IPuppet):
|
||||||
self._plugin_registry.load_plugin(plugin_name, plugin, plugin_type)
|
self._plugin_registry.load_plugin(plugin_name, plugin, plugin_type)
|
||||||
|
|
||||||
def run_credential_collector(self, name: str, options: Dict) -> Sequence[Credentials]:
|
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:
|
def run_pba(self, name: str, options: Dict) -> PostBreachData:
|
||||||
return self._mock_puppet.run_pba(name, options)
|
return self._mock_puppet.run_pba(name, options)
|
||||||
|
|
Loading…
Reference in New Issue