forked from p15670423/monkey
Merge pull request #2062 from guardicore/1965-common-credentials
1965 common credentials
This commit is contained in:
commit
bce20fb687
|
@ -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 abc import ABC, abstractmethod
|
||||||
|
|
||||||
from common.common_consts.credential_component_type import CredentialComponentType
|
from . import CredentialComponentType
|
||||||
|
|
||||||
|
|
||||||
class ICredentialComponent(ABC):
|
class ICredentialComponent(ABC):
|
|
@ -1,7 +1,6 @@
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from common.common_consts.credential_component_type import CredentialComponentType
|
from . import CredentialComponentType, ICredentialComponent
|
||||||
from infection_monkey.i_puppet import ICredentialComponent
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
|
@ -1,7 +1,6 @@
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from common.common_consts.credential_component_type import CredentialComponentType
|
from . import CredentialComponentType, ICredentialComponent
|
||||||
from infection_monkey.i_puppet import ICredentialComponent
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
|
@ -1,7 +1,6 @@
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from common.common_consts.credential_component_type import CredentialComponentType
|
from . import CredentialComponentType, ICredentialComponent
|
||||||
from infection_monkey.i_puppet import ICredentialComponent
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
|
@ -1,7 +1,6 @@
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from common.common_consts.credential_component_type import CredentialComponentType
|
from . import CredentialComponentType, ICredentialComponent
|
||||||
from infection_monkey.i_puppet import ICredentialComponent
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@dataclass(frozen=True)
|
|
@ -1,7 +1,6 @@
|
||||||
from dataclasses import dataclass, field
|
from dataclasses import dataclass, field
|
||||||
|
|
||||||
from common.common_consts.credential_component_type import CredentialComponentType
|
from . import CredentialComponentType, ICredentialComponent
|
||||||
from infection_monkey.i_puppet import ICredentialComponent
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass(frozen=True)
|
@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 .mimikatz_collector import MimikatzCredentialCollector
|
||||||
from .ssh_collector import SSHCredentialCollector
|
from .ssh_collector import SSHCredentialCollector
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
from infection_monkey.credential_collectors import LMHash, NTHash, Password, Username
|
from common.credentials import Credentials, LMHash, NTHash, Password, Username
|
||||||
from infection_monkey.i_puppet.credential_collection import Credentials, ICredentialCollector
|
from infection_monkey.i_puppet import ICredentialCollector
|
||||||
from infection_monkey.model import USERNAME_PREFIX
|
from infection_monkey.model import USERNAME_PREFIX
|
||||||
|
|
||||||
from . import pypykatz_handler
|
from . import pypykatz_handler
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Dict, Iterable, Sequence
|
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.credential_collectors.ssh_collector import ssh_handler
|
||||||
from infection_monkey.i_puppet.credential_collection import Credentials, 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
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -1,10 +1,9 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Any, Iterable, Mapping
|
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.custom_types import PropagationCredentials
|
||||||
from infection_monkey.i_control_channel import IControlChannel
|
from infection_monkey.i_control_channel import IControlChannel
|
||||||
from infection_monkey.i_puppet import Credentials
|
|
||||||
from infection_monkey.utils.decorators import request_cache
|
from infection_monkey.utils.decorators import request_cache
|
||||||
|
|
||||||
from .i_credentials_store import ICredentialsStore
|
from .i_credentials_store import ICredentialsStore
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import abc
|
import abc
|
||||||
from typing import Iterable
|
from typing import Iterable
|
||||||
|
|
||||||
|
from common.credentials import Credentials
|
||||||
from infection_monkey.custom_types import PropagationCredentials
|
from infection_monkey.custom_types import PropagationCredentials
|
||||||
from infection_monkey.i_puppet import Credentials
|
|
||||||
|
|
||||||
|
|
||||||
class ICredentialsStore(metaclass=abc.ABCMeta):
|
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 impacket.dcerpc.v5.dtypes import NULL
|
||||||
|
|
||||||
from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT
|
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.HostExploiter import HostExploiter
|
||||||
from infection_monkey.exploit.tools.wmi_tools import WmiTools
|
from infection_monkey.exploit.tools.wmi_tools import WmiTools
|
||||||
from infection_monkey.exploit.zerologon_utils.dump_secrets import DumpSecrets
|
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.vuln_assessment import get_dc_details, is_exploitable
|
||||||
from infection_monkey.exploit.zerologon_utils.wmiexec import Wmiexec
|
from infection_monkey.exploit.zerologon_utils.wmiexec import Wmiexec
|
||||||
from infection_monkey.i_puppet import ExploiterResultData
|
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.telemetry.credentials_telem import CredentialsTelem
|
||||||
from infection_monkey.utils.capture_output import StdoutCapture
|
from infection_monkey.utils.capture_output import StdoutCapture
|
||||||
from infection_monkey.utils.threading import interruptible_iter
|
from infection_monkey.utils.threading import interruptible_iter
|
||||||
|
|
|
@ -10,8 +10,4 @@ from .i_puppet import (
|
||||||
UnknownPluginError,
|
UnknownPluginError,
|
||||||
)
|
)
|
||||||
from .i_fingerprinter import IFingerprinter
|
from .i_fingerprinter import IFingerprinter
|
||||||
from .credential_collection import (
|
from .i_credential_collector import ICredentialCollector
|
||||||
Credentials,
|
|
||||||
ICredentialCollector,
|
|
||||||
ICredentialComponent,
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
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 abc import ABC, abstractmethod
|
||||||
from typing import Mapping, Optional, Sequence
|
from typing import Mapping, Optional, Sequence
|
||||||
|
|
||||||
from .credentials import Credentials
|
from common.credentials import Credentials
|
||||||
|
|
||||||
|
|
||||||
class ICredentialCollector(ABC):
|
class ICredentialCollector(ABC):
|
|
@ -5,10 +5,10 @@ from dataclasses import dataclass
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from typing import Dict, Iterable, List, Mapping, Sequence
|
from typing import Dict, Iterable, List, Mapping, Sequence
|
||||||
|
|
||||||
|
from common.credentials import Credentials
|
||||||
from infection_monkey.model import VictimHost
|
from infection_monkey.model import VictimHost
|
||||||
|
|
||||||
from . import PluginType
|
from . import PluginType
|
||||||
from .credential_collection import Credentials
|
|
||||||
|
|
||||||
|
|
||||||
class PortStatus(Enum):
|
class PortStatus(Enum):
|
||||||
|
|
|
@ -3,9 +3,9 @@ import threading
|
||||||
from typing import Dict, Iterable, List, Sequence
|
from typing import Dict, Iterable, List, Sequence
|
||||||
|
|
||||||
from common.common_consts.timeouts import CONNECTION_TIMEOUT
|
from common.common_consts.timeouts import CONNECTION_TIMEOUT
|
||||||
|
from common.credentials import Credentials
|
||||||
from infection_monkey import network_scanning
|
from infection_monkey import network_scanning
|
||||||
from infection_monkey.i_puppet import (
|
from infection_monkey.i_puppet import (
|
||||||
Credentials,
|
|
||||||
ExploiterResultData,
|
ExploiterResultData,
|
||||||
FingerprintData,
|
FingerprintData,
|
||||||
IPuppet,
|
IPuppet,
|
||||||
|
|
|
@ -3,7 +3,7 @@ import json
|
||||||
from typing import Dict, Iterable
|
from typing import Dict, Iterable
|
||||||
|
|
||||||
from common.common_consts.telem_categories import TelemCategoryEnum
|
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
|
from infection_monkey.telemetry.base_telem import BaseTelem
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
from abc import ABC
|
from abc import ABC
|
||||||
from typing import Sequence
|
from typing import Sequence
|
||||||
|
|
||||||
from monkey_island.cc.services.telemetry.processing.credentials import Credentials
|
from common.credentials import Credentials
|
||||||
|
|
||||||
|
|
||||||
class ICredentialsRepository(ABC):
|
class ICredentialsRepository(ABC):
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import logging
|
import logging
|
||||||
from typing import Mapping, Sequence
|
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
|
from monkey_island.cc.models import StolenCredentials
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
|
@ -2,7 +2,7 @@ import logging
|
||||||
from itertools import chain
|
from itertools import chain
|
||||||
from typing import Mapping
|
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 monkey_island.cc.models import StolenCredentials
|
||||||
|
|
||||||
from .credentials import Credentials
|
from .credentials import Credentials
|
||||||
|
|
|
@ -2,17 +2,11 @@ from typing import Sequence
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from infection_monkey.credential_collectors import (
|
from common.credentials import Credentials, LMHash, NTHash, Password, Username
|
||||||
LMHash,
|
from infection_monkey.credential_collectors import MimikatzCredentialCollector
|
||||||
MimikatzCredentialCollector,
|
|
||||||
NTHash,
|
|
||||||
Password,
|
|
||||||
Username,
|
|
||||||
)
|
|
||||||
from infection_monkey.credential_collectors.mimikatz_collector.windows_credentials import (
|
from infection_monkey.credential_collectors.mimikatz_collector.windows_credentials import (
|
||||||
WindowsCredentials,
|
WindowsCredentials,
|
||||||
)
|
)
|
||||||
from infection_monkey.i_puppet import Credentials
|
|
||||||
|
|
||||||
|
|
||||||
def patch_pypykatz(win_creds: [WindowsCredentials], monkeypatch):
|
def patch_pypykatz(win_creds: [WindowsCredentials], monkeypatch):
|
||||||
|
|
|
@ -2,8 +2,8 @@ from unittest.mock import MagicMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from infection_monkey.credential_collectors import SSHCredentialCollector, SSHKeypair, Username
|
from common.credentials import Credentials, SSHKeypair, Username
|
||||||
from infection_monkey.i_puppet.credential_collection import Credentials
|
from infection_monkey.credential_collectors import SSHCredentialCollector
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
@ -2,9 +2,8 @@ from unittest.mock import MagicMock
|
||||||
|
|
||||||
import pytest
|
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.credential_store import AggregatingCredentialsStore
|
||||||
from infection_monkey.i_puppet import Credentials
|
|
||||||
|
|
||||||
CONTROL_CHANNEL_CREDENTIALS = {
|
CONTROL_CHANNEL_CREDENTIALS = {
|
||||||
"exploit_user_list": ["Administrator", "root", "user1"],
|
"exploit_user_list": ["Administrator", "root", "user1"],
|
||||||
|
|
|
@ -3,9 +3,8 @@ import threading
|
||||||
from typing import Dict, Iterable, List, Sequence
|
from typing import Dict, Iterable, List, Sequence
|
||||||
|
|
||||||
from common import OperatingSystems
|
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 (
|
from infection_monkey.i_puppet import (
|
||||||
Credentials,
|
|
||||||
ExploiterResultData,
|
ExploiterResultData,
|
||||||
FingerprintData,
|
FingerprintData,
|
||||||
IPuppet,
|
IPuppet,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
from infection_monkey.credential_collectors import Password, SSHKeypair, Username
|
from common.credentials import Credentials, Password, SSHKeypair, Username
|
||||||
from infection_monkey.i_puppet import Credentials
|
|
||||||
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
||||||
from infection_monkey.telemetry.messengers.credentials_intercepting_telemetry_messenger import (
|
from infection_monkey.telemetry.messengers.credentials_intercepting_telemetry_messenger import (
|
||||||
CredentialsInterceptingTelemetryMessenger,
|
CredentialsInterceptingTelemetryMessenger,
|
||||||
|
|
|
@ -2,8 +2,7 @@ import json
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
from infection_monkey.credential_collectors import Password, SSHKeypair, Username
|
from common.credentials import Credentials, Password, SSHKeypair, Username
|
||||||
from infection_monkey.i_puppet import Credentials
|
|
||||||
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
from infection_monkey.telemetry.credentials_telem import CredentialsTelem
|
||||||
|
|
||||||
USERNAME = "m0nkey"
|
USERNAME = "m0nkey"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import pytest
|
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.models import Monkey, StolenCredentials
|
||||||
from monkey_island.cc.services.reporting.stolen_credentials import (
|
from monkey_island.cc.services.reporting.stolen_credentials import (
|
||||||
extract_ssh_keys,
|
extract_ssh_keys,
|
||||||
|
|
|
@ -6,13 +6,13 @@ from tests.unit_tests.monkey_island.cc.services.telemetry.processing.credentials
|
||||||
CREDENTIAL_TELEM_TEMPLATE,
|
CREDENTIAL_TELEM_TEMPLATE,
|
||||||
)
|
)
|
||||||
|
|
||||||
from common.common_consts.credential_component_type import CredentialComponentType
|
|
||||||
from common.config_value_paths import (
|
from common.config_value_paths import (
|
||||||
LM_HASH_LIST_PATH,
|
LM_HASH_LIST_PATH,
|
||||||
NTLM_HASH_LIST_PATH,
|
NTLM_HASH_LIST_PATH,
|
||||||
PASSWORD_LIST_PATH,
|
PASSWORD_LIST_PATH,
|
||||||
USER_LIST_PATH,
|
USER_LIST_PATH,
|
||||||
)
|
)
|
||||||
|
from common.credentials import CredentialComponentType
|
||||||
from monkey_island.cc.models import StolenCredentials
|
from monkey_island.cc.models import StolenCredentials
|
||||||
from monkey_island.cc.services.config import ConfigService
|
from monkey_island.cc.services.config import ConfigService
|
||||||
from monkey_island.cc.services.telemetry.processing.credentials.credentials_parser import (
|
from monkey_island.cc.services.telemetry.processing.credentials.credentials_parser import (
|
||||||
|
|
Loading…
Reference in New Issue