forked from p34709852/monkey
Common: Add common.credentials package
Migrate all objects that represent credentials from their present home in the agent to their new home in common. This allows these classes to be shared by the island. Furthermore, it will simplify serialization/deserialization and clear a path to remove other redundant classes in the Island.
This commit is contained in:
parent
bc1ff393b7
commit
7bc8ed649a
|
@ -0,0 +1,8 @@
|
|||
from .credential_component_type import CredentialComponentType
|
||||
from .i_credential_component import ICredentialComponent
|
||||
from .credentials import Credentials
|
||||
from .lm_hash import LMHash
|
||||
from .nt_hash import NTHash
|
||||
from .password import Password
|
||||
from .ssh_keypair import SSHKeypair
|
||||
from .username import Username
|
|
@ -1,6 +1,6 @@
|
|||
from abc import ABC, abstractmethod
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from . import CredentialComponentType
|
||||
|
||||
|
||||
class ICredentialComponent(ABC):
|
|
@ -1,7 +1,6 @@
|
|||
from dataclasses import dataclass, field
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from infection_monkey.i_puppet import ICredentialComponent
|
||||
from . import CredentialComponentType, ICredentialComponent
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
|
@ -1,7 +1,6 @@
|
|||
from dataclasses import dataclass, field
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from infection_monkey.i_puppet import ICredentialComponent
|
||||
from . import CredentialComponentType, ICredentialComponent
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
|
@ -1,7 +1,6 @@
|
|||
from dataclasses import dataclass, field
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from infection_monkey.i_puppet import ICredentialComponent
|
||||
from . import CredentialComponentType, ICredentialComponent
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
|
@ -1,7 +1,6 @@
|
|||
from dataclasses import dataclass, field
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from infection_monkey.i_puppet import ICredentialComponent
|
||||
from . import CredentialComponentType, ICredentialComponent
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
|
@ -1,7 +1,6 @@
|
|||
from dataclasses import dataclass, field
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from infection_monkey.i_puppet import ICredentialComponent
|
||||
from . import CredentialComponentType, ICredentialComponent
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
|
@ -1,7 +1,2 @@
|
|||
from .credential_components.nt_hash import NTHash
|
||||
from .credential_components.lm_hash import LMHash
|
||||
from .credential_components.password import Password
|
||||
from .credential_components.username import Username
|
||||
from .credential_components.ssh_keypair import SSHKeypair
|
||||
from .mimikatz_collector import MimikatzCredentialCollector
|
||||
from .ssh_collector import SSHCredentialCollector
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import logging
|
||||
from typing import Sequence
|
||||
|
||||
from infection_monkey.credential_collectors import LMHash, NTHash, Password, Username
|
||||
from infection_monkey.i_puppet.credential_collection import Credentials, ICredentialCollector
|
||||
from common.credentials import Credentials, LMHash, NTHash, Password, Username
|
||||
from infection_monkey.i_puppet.credential_collection import ICredentialCollector
|
||||
from infection_monkey.model import USERNAME_PREFIX
|
||||
|
||||
from . import pypykatz_handler
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import logging
|
||||
from typing import Dict, Iterable, Sequence
|
||||
|
||||
from infection_monkey.credential_collectors import SSHKeypair, Username
|
||||
from common.credentials import Credentials, SSHKeypair, Username
|
||||
from infection_monkey.credential_collectors.ssh_collector import ssh_handler
|
||||
from infection_monkey.i_puppet.credential_collection import Credentials, ICredentialCollector
|
||||
from infection_monkey.i_puppet.credential_collection import ICredentialCollector
|
||||
from infection_monkey.telemetry.messengers.i_telemetry_messenger import ITelemetryMessenger
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
import logging
|
||||
from typing import Any, Iterable, Mapping
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from common.credentials import CredentialComponentType, Credentials
|
||||
from infection_monkey.custom_types import PropagationCredentials
|
||||
from infection_monkey.i_control_channel import IControlChannel
|
||||
from infection_monkey.i_puppet import Credentials
|
||||
from infection_monkey.utils.decorators import request_cache
|
||||
|
||||
from .i_credentials_store import ICredentialsStore
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import abc
|
||||
from typing import Iterable
|
||||
|
||||
from common.credentials import Credentials
|
||||
from infection_monkey.custom_types import PropagationCredentials
|
||||
from infection_monkey.i_puppet import Credentials
|
||||
|
||||
|
||||
class ICredentialsStore(metaclass=abc.ABCMeta):
|
||||
|
|
|
@ -16,7 +16,7 @@ from impacket.dcerpc.v5 import epm, nrpc, rpcrt, transport
|
|||
from impacket.dcerpc.v5.dtypes import NULL
|
||||
|
||||
from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT
|
||||
from infection_monkey.credential_collectors import LMHash, NTHash, Username
|
||||
from common.credentials import Credentials, LMHash, NTHash, Username
|
||||
from infection_monkey.exploit.HostExploiter import HostExploiter
|
||||
from infection_monkey.exploit.tools.wmi_tools import WmiTools
|
||||
from infection_monkey.exploit.zerologon_utils.dump_secrets import DumpSecrets
|
||||
|
@ -24,7 +24,6 @@ from infection_monkey.exploit.zerologon_utils.options import OptionsForSecretsdu
|
|||
from infection_monkey.exploit.zerologon_utils.vuln_assessment import get_dc_details, is_exploitable
|
||||
from infection_monkey.exploit.zerologon_utils.wmiexec import Wmiexec
|
||||
from infection_monkey.i_puppet import ExploiterResultData
|
||||
from infection_monkey.i_puppet.credential_collection import Credentials
|
||||
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
||||
from infection_monkey.utils.capture_output import StdoutCapture
|
||||
from infection_monkey.utils.threading import interruptible_iter
|
||||
|
|
|
@ -10,8 +10,3 @@ from .i_puppet import (
|
|||
UnknownPluginError,
|
||||
)
|
||||
from .i_fingerprinter import IFingerprinter
|
||||
from .credential_collection import (
|
||||
Credentials,
|
||||
ICredentialCollector,
|
||||
ICredentialComponent,
|
||||
)
|
||||
|
|
|
@ -1,3 +1 @@
|
|||
from .i_credential_collector import ICredentialCollector
|
||||
from .credentials import Credentials
|
||||
from .i_credential_component import ICredentialComponent
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
from abc import ABC, abstractmethod
|
||||
from typing import Mapping, Optional, Sequence
|
||||
|
||||
from .credentials import Credentials
|
||||
from common.credentials import Credentials
|
||||
|
||||
|
||||
class ICredentialCollector(ABC):
|
||||
|
|
|
@ -5,10 +5,10 @@ from dataclasses import dataclass
|
|||
from enum import Enum
|
||||
from typing import Dict, Iterable, List, Mapping, Sequence
|
||||
|
||||
from common.credentials import Credentials
|
||||
from infection_monkey.model import VictimHost
|
||||
|
||||
from . import PluginType
|
||||
from .credential_collection import Credentials
|
||||
|
||||
|
||||
class PortStatus(Enum):
|
||||
|
|
|
@ -3,9 +3,9 @@ import threading
|
|||
from typing import Dict, Iterable, List, Sequence
|
||||
|
||||
from common.common_consts.timeouts import CONNECTION_TIMEOUT
|
||||
from common.credentials import Credentials
|
||||
from infection_monkey import network_scanning
|
||||
from infection_monkey.i_puppet import (
|
||||
Credentials,
|
||||
ExploiterResultData,
|
||||
FingerprintData,
|
||||
IPuppet,
|
||||
|
|
|
@ -3,7 +3,7 @@ import json
|
|||
from typing import Dict, Iterable
|
||||
|
||||
from common.common_consts.telem_categories import TelemCategoryEnum
|
||||
from infection_monkey.i_puppet.credential_collection import Credentials, ICredentialComponent
|
||||
from common.credentials import Credentials, ICredentialComponent
|
||||
from infection_monkey.telemetry.base_telem import BaseTelem
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import logging
|
||||
from typing import Mapping, Sequence
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from common.credentials import CredentialComponentType
|
||||
from monkey_island.cc.models import StolenCredentials
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
|||
from itertools import chain
|
||||
from typing import Mapping
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from common.credentials import CredentialComponentType
|
||||
from monkey_island.cc.models import StolenCredentials
|
||||
|
||||
from .credentials import Credentials
|
||||
|
|
|
@ -2,17 +2,11 @@ from typing import Sequence
|
|||
|
||||
import pytest
|
||||
|
||||
from infection_monkey.credential_collectors import (
|
||||
LMHash,
|
||||
MimikatzCredentialCollector,
|
||||
NTHash,
|
||||
Password,
|
||||
Username,
|
||||
)
|
||||
from common.credentials import Credentials, LMHash, NTHash, Password, Username
|
||||
from infection_monkey.credential_collectors import MimikatzCredentialCollector
|
||||
from infection_monkey.credential_collectors.mimikatz_collector.windows_credentials import (
|
||||
WindowsCredentials,
|
||||
)
|
||||
from infection_monkey.i_puppet import Credentials
|
||||
|
||||
|
||||
def patch_pypykatz(win_creds: [WindowsCredentials], monkeypatch):
|
||||
|
|
|
@ -2,8 +2,8 @@ from unittest.mock import MagicMock
|
|||
|
||||
import pytest
|
||||
|
||||
from infection_monkey.credential_collectors import SSHCredentialCollector, SSHKeypair, Username
|
||||
from infection_monkey.i_puppet.credential_collection import Credentials
|
||||
from common.credentials import Credentials, SSHKeypair, Username
|
||||
from infection_monkey.credential_collectors import SSHCredentialCollector
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
|
|
@ -2,9 +2,8 @@ from unittest.mock import MagicMock
|
|||
|
||||
import pytest
|
||||
|
||||
from infection_monkey.credential_collectors import Password, SSHKeypair, Username
|
||||
from common.credentials import Credentials, Password, SSHKeypair, Username
|
||||
from infection_monkey.credential_store import AggregatingCredentialsStore
|
||||
from infection_monkey.i_puppet import Credentials
|
||||
|
||||
CONTROL_CHANNEL_CREDENTIALS = {
|
||||
"exploit_user_list": ["Administrator", "root", "user1"],
|
||||
|
|
|
@ -3,9 +3,8 @@ import threading
|
|||
from typing import Dict, Iterable, List, Sequence
|
||||
|
||||
from common import OperatingSystems
|
||||
from infection_monkey.credential_collectors import LMHash, Password, SSHKeypair, Username
|
||||
from common.credentials import Credentials, LMHash, Password, SSHKeypair, Username
|
||||
from infection_monkey.i_puppet import (
|
||||
Credentials,
|
||||
ExploiterResultData,
|
||||
FingerprintData,
|
||||
IPuppet,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
from unittest.mock import MagicMock
|
||||
|
||||
from infection_monkey.credential_collectors import Password, SSHKeypair, Username
|
||||
from infection_monkey.i_puppet import Credentials
|
||||
from common.credentials import Credentials, Password, SSHKeypair, Username
|
||||
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
||||
from infection_monkey.telemetry.messengers.credentials_intercepting_telemetry_messenger import (
|
||||
CredentialsInterceptingTelemetryMessenger,
|
||||
|
|
|
@ -2,8 +2,7 @@ import json
|
|||
|
||||
import pytest
|
||||
|
||||
from infection_monkey.credential_collectors import Password, SSHKeypair, Username
|
||||
from infection_monkey.i_puppet import Credentials
|
||||
from common.credentials import Credentials, Password, SSHKeypair, Username
|
||||
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
||||
|
||||
USERNAME = "m0nkey"
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import pytest
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from common.credentials import CredentialComponentType
|
||||
from monkey_island.cc.models import Monkey, StolenCredentials
|
||||
from monkey_island.cc.services.reporting.stolen_credentials import (
|
||||
extract_ssh_keys,
|
||||
|
|
|
@ -6,13 +6,13 @@ from tests.unit_tests.monkey_island.cc.services.telemetry.processing.credentials
|
|||
CREDENTIAL_TELEM_TEMPLATE,
|
||||
)
|
||||
|
||||
from common.common_consts.credential_component_type import CredentialComponentType
|
||||
from common.config_value_paths import (
|
||||
LM_HASH_LIST_PATH,
|
||||
NTLM_HASH_LIST_PATH,
|
||||
PASSWORD_LIST_PATH,
|
||||
USER_LIST_PATH,
|
||||
)
|
||||
from common.credentials import CredentialComponentType
|
||||
from monkey_island.cc.models import StolenCredentials
|
||||
from monkey_island.cc.services.config import ConfigService
|
||||
from monkey_island.cc.services.telemetry.processing.credentials.credentials_parser import (
|
||||
|
|
Loading…
Reference in New Issue