forked from p15670423/monkey
Agent: Rename IEventQueue -> IAgentEventQueue
This commit is contained in:
parent
903d43fe26
commit
74e17ef006
|
@ -2,7 +2,7 @@ import logging
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
from common.credentials import Credentials, LMHash, NTHash, Password, Username
|
from common.credentials import Credentials, LMHash, NTHash, Password, Username
|
||||||
from common.event_queue import IEventQueue
|
from common.event_queue import IAgentEventQueue
|
||||||
from common.events import CredentialsStolenEvent
|
from common.events import CredentialsStolenEvent
|
||||||
from infection_monkey.i_puppet import ICredentialCollector
|
from infection_monkey.i_puppet import ICredentialCollector
|
||||||
from infection_monkey.model import USERNAME_PREFIX
|
from infection_monkey.model import USERNAME_PREFIX
|
||||||
|
@ -27,7 +27,7 @@ MIMIKATZ_EVENT_TAGS = frozenset(
|
||||||
|
|
||||||
|
|
||||||
class MimikatzCredentialCollector(ICredentialCollector):
|
class MimikatzCredentialCollector(ICredentialCollector):
|
||||||
def __init__(self, event_queue: IEventQueue):
|
def __init__(self, event_queue: IAgentEventQueue):
|
||||||
self._event_queue = event_queue
|
self._event_queue = event_queue
|
||||||
|
|
||||||
def collect_credentials(self, options=None) -> Sequence[Credentials]:
|
def collect_credentials(self, options=None) -> Sequence[Credentials]:
|
||||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
from common.credentials import Credentials
|
from common.credentials import Credentials
|
||||||
from common.event_queue import IEventQueue
|
from common.event_queue import IAgentEventQueue
|
||||||
from infection_monkey.credential_collectors.ssh_collector import ssh_handler
|
from infection_monkey.credential_collectors.ssh_collector import ssh_handler
|
||||||
from infection_monkey.i_puppet import ICredentialCollector
|
from infection_monkey.i_puppet import ICredentialCollector
|
||||||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||||
|
@ -15,7 +15,7 @@ class SSHCredentialCollector(ICredentialCollector):
|
||||||
SSH keys credential collector
|
SSH keys credential collector
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, telemetry_messenger: ITelemetryMessenger, event_queue: IEventQueue):
|
def __init__(self, telemetry_messenger: ITelemetryMessenger, event_queue: IAgentEventQueue):
|
||||||
self._telemetry_messenger = telemetry_messenger
|
self._telemetry_messenger = telemetry_messenger
|
||||||
self._event_queue = event_queue
|
self._event_queue = event_queue
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import os
|
||||||
from typing import Dict, Iterable, Sequence
|
from typing import Dict, Iterable, Sequence
|
||||||
|
|
||||||
from common.credentials import Credentials, SSHKeypair, Username
|
from common.credentials import Credentials, SSHKeypair, Username
|
||||||
from common.event_queue import IEventQueue
|
from common.event_queue import IAgentEventQueue
|
||||||
from common.events import CredentialsStolenEvent
|
from common.events import CredentialsStolenEvent
|
||||||
from common.utils.attack_utils import ScanStatus
|
from common.utils.attack_utils import ScanStatus
|
||||||
from infection_monkey.telemetry.attack.t1005_telem import T1005Telem
|
from infection_monkey.telemetry.attack.t1005_telem import T1005Telem
|
||||||
|
@ -31,7 +31,7 @@ SSH_COLLECTOR_EVENT_TAGS = frozenset(
|
||||||
|
|
||||||
|
|
||||||
def get_ssh_info(
|
def get_ssh_info(
|
||||||
telemetry_messenger: ITelemetryMessenger, event_queue: IEventQueue
|
telemetry_messenger: ITelemetryMessenger, event_queue: IAgentEventQueue
|
||||||
) -> Iterable[Dict]:
|
) -> Iterable[Dict]:
|
||||||
# TODO: Remove this check when this is turned into a plugin.
|
# TODO: Remove this check when this is turned into a plugin.
|
||||||
if is_windows_os():
|
if is_windows_os():
|
||||||
|
@ -80,7 +80,9 @@ def _get_ssh_struct(name: str, home_dir: str) -> Dict:
|
||||||
|
|
||||||
|
|
||||||
def _get_ssh_files(
|
def _get_ssh_files(
|
||||||
user_info: Iterable[Dict], telemetry_messenger: ITelemetryMessenger, event_queue: IEventQueue
|
user_info: Iterable[Dict],
|
||||||
|
telemetry_messenger: ITelemetryMessenger,
|
||||||
|
event_queue: IAgentEventQueue,
|
||||||
) -> Iterable[Dict]:
|
) -> Iterable[Dict]:
|
||||||
for info in user_info:
|
for info in user_info:
|
||||||
path = info["home_dir"]
|
path = info["home_dir"]
|
||||||
|
@ -165,7 +167,9 @@ def to_credentials(ssh_info: Iterable[Dict]) -> Sequence[Credentials]:
|
||||||
return ssh_credentials
|
return ssh_credentials
|
||||||
|
|
||||||
|
|
||||||
def _publish_credentials_stolen_event(collected_credentials: Credentials, event_queue: IEventQueue):
|
def _publish_credentials_stolen_event(
|
||||||
|
collected_credentials: Credentials, event_queue: IAgentEventQueue
|
||||||
|
):
|
||||||
credentials_stolen_event = CredentialsStolenEvent(
|
credentials_stolen_event = CredentialsStolenEvent(
|
||||||
tags=SSH_COLLECTOR_EVENT_TAGS,
|
tags=SSH_COLLECTOR_EVENT_TAGS,
|
||||||
stolen_credentials=[collected_credentials],
|
stolen_credentials=[collected_credentials],
|
||||||
|
|
|
@ -4,7 +4,7 @@ from abc import abstractmethod
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
from common.event_queue import IEventQueue
|
from common.event_queue import IAgentEventQueue
|
||||||
from common.utils.exceptions import FailedExploitationError
|
from common.utils.exceptions import FailedExploitationError
|
||||||
from infection_monkey.i_puppet import ExploiterResultData
|
from infection_monkey.i_puppet import ExploiterResultData
|
||||||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||||
|
@ -60,7 +60,7 @@ class HostExploiter:
|
||||||
host,
|
host,
|
||||||
current_depth: int,
|
current_depth: int,
|
||||||
telemetry_messenger: ITelemetryMessenger,
|
telemetry_messenger: ITelemetryMessenger,
|
||||||
event_queue: IEventQueue,
|
event_queue: IAgentEventQueue,
|
||||||
agent_binary_repository: IAgentBinaryRepository,
|
agent_binary_repository: IAgentBinaryRepository,
|
||||||
options: Dict,
|
options: Dict,
|
||||||
interrupt: threading.Event,
|
interrupt: threading.Event,
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import threading
|
import threading
|
||||||
from typing import Dict, Type
|
from typing import Dict, Type
|
||||||
|
|
||||||
from common.event_queue import IEventQueue
|
from common.event_queue import IAgentEventQueue
|
||||||
from infection_monkey.model import VictimHost
|
from infection_monkey.model import VictimHost
|
||||||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ class ExploiterWrapper:
|
||||||
self,
|
self,
|
||||||
exploit_class: Type[HostExploiter],
|
exploit_class: Type[HostExploiter],
|
||||||
telemetry_messenger: ITelemetryMessenger,
|
telemetry_messenger: ITelemetryMessenger,
|
||||||
event_queue: IEventQueue,
|
event_queue: IAgentEventQueue,
|
||||||
agent_binary_repository: IAgentBinaryRepository,
|
agent_binary_repository: IAgentBinaryRepository,
|
||||||
):
|
):
|
||||||
self._exploit_class = exploit_class
|
self._exploit_class = exploit_class
|
||||||
|
@ -47,7 +47,7 @@ class ExploiterWrapper:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
telemetry_messenger: ITelemetryMessenger,
|
telemetry_messenger: ITelemetryMessenger,
|
||||||
event_queue: IEventQueue,
|
event_queue: IAgentEventQueue,
|
||||||
agent_binary_repository: IAgentBinaryRepository,
|
agent_binary_repository: IAgentBinaryRepository,
|
||||||
):
|
):
|
||||||
self._telemetry_messenger = telemetry_messenger
|
self._telemetry_messenger = telemetry_messenger
|
||||||
|
|
|
@ -10,7 +10,7 @@ from typing import List
|
||||||
from pubsub.core import Publisher
|
from pubsub.core import Publisher
|
||||||
|
|
||||||
import infection_monkey.tunnel as tunnel
|
import infection_monkey.tunnel as tunnel
|
||||||
from common.event_queue import IEventQueue, PyPubSubEventQueue
|
from common.event_queue import IAgentEventQueue, PyPubSubEventQueue
|
||||||
from common.events import CredentialsStolenEvent
|
from common.events import CredentialsStolenEvent
|
||||||
from common.network.network_utils import address_to_ip_port
|
from common.network.network_utils import address_to_ip_port
|
||||||
from common.utils.argparse_types import positive_int
|
from common.utils.argparse_types import positive_int
|
||||||
|
@ -228,7 +228,7 @@ class InfectionMonkey:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _subscribe_events(
|
def _subscribe_events(
|
||||||
event_queue: IEventQueue,
|
event_queue: IAgentEventQueue,
|
||||||
propagation_credentials_repository: IPropagationCredentialsRepository,
|
propagation_credentials_repository: IPropagationCredentialsRepository,
|
||||||
):
|
):
|
||||||
event_queue.subscribe_type(
|
event_queue.subscribe_type(
|
||||||
|
@ -249,7 +249,7 @@ class InfectionMonkey:
|
||||||
def _build_puppet(
|
def _build_puppet(
|
||||||
self,
|
self,
|
||||||
propagation_credentials_repository: IPropagationCredentialsRepository,
|
propagation_credentials_repository: IPropagationCredentialsRepository,
|
||||||
event_queue: IEventQueue,
|
event_queue: IAgentEventQueue,
|
||||||
) -> IPuppet:
|
) -> IPuppet:
|
||||||
puppet = Puppet()
|
puppet = Puppet()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue