diff --git a/monkey/infection_monkey/credential_collectors/__init__.py b/monkey/infection_monkey/credential_collectors/__init__.py index 7265bbc00..76ebc4d87 100644 --- a/monkey/infection_monkey/credential_collectors/__init__.py +++ b/monkey/infection_monkey/credential_collectors/__init__.py @@ -1,6 +1,4 @@ -from .i_credential_collector import ICredentialCollector 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 .credentials import Credentials diff --git a/monkey/infection_monkey/credential_collectors/credential_components/lm_hash.py b/monkey/infection_monkey/credential_collectors/credential_components/lm_hash.py index 03869142e..7706540a3 100644 --- a/monkey/infection_monkey/credential_collectors/credential_components/lm_hash.py +++ b/monkey/infection_monkey/credential_collectors/credential_components/lm_hash.py @@ -1,7 +1,6 @@ from dataclasses import dataclass, field -from ..credential_type import CredentialType -from .i_credential_component import ICredentialComponent +from infection_monkey.i_puppet import CredentialType, ICredentialComponent @dataclass(frozen=True) diff --git a/monkey/infection_monkey/credential_collectors/credential_components/nt_hash.py b/monkey/infection_monkey/credential_collectors/credential_components/nt_hash.py index 81b92093b..e6932c4c5 100644 --- a/monkey/infection_monkey/credential_collectors/credential_components/nt_hash.py +++ b/monkey/infection_monkey/credential_collectors/credential_components/nt_hash.py @@ -1,7 +1,6 @@ from dataclasses import dataclass, field -from ..credential_type import CredentialType -from .i_credential_component import ICredentialComponent +from infection_monkey.i_puppet import CredentialType, ICredentialComponent @dataclass(frozen=True) diff --git a/monkey/infection_monkey/credential_collectors/credential_components/password.py b/monkey/infection_monkey/credential_collectors/credential_components/password.py index 26fee38f5..701c9fcde 100644 --- a/monkey/infection_monkey/credential_collectors/credential_components/password.py +++ b/monkey/infection_monkey/credential_collectors/credential_components/password.py @@ -1,7 +1,6 @@ from dataclasses import dataclass, field -from ..credential_type import CredentialType -from .i_credential_component import ICredentialComponent +from infection_monkey.i_puppet import CredentialType, ICredentialComponent @dataclass(frozen=True) diff --git a/monkey/infection_monkey/credential_collectors/credential_components/username.py b/monkey/infection_monkey/credential_collectors/credential_components/username.py index 23bfd56ff..208849061 100644 --- a/monkey/infection_monkey/credential_collectors/credential_components/username.py +++ b/monkey/infection_monkey/credential_collectors/credential_components/username.py @@ -1,7 +1,6 @@ from dataclasses import dataclass, field -from ..credential_type import CredentialType -from .i_credential_component import ICredentialComponent +from infection_monkey.i_puppet import CredentialType, ICredentialComponent @dataclass(frozen=True) diff --git a/monkey/infection_monkey/credential_collectors/mimikatz_collector/mimikatz_cred_collector.py b/monkey/infection_monkey/credential_collectors/mimikatz_collector/mimikatz_cred_collector.py index c4e27a33c..e1f94c4dd 100644 --- a/monkey/infection_monkey/credential_collectors/mimikatz_collector/mimikatz_cred_collector.py +++ b/monkey/infection_monkey/credential_collectors/mimikatz_collector/mimikatz_cred_collector.py @@ -1,13 +1,8 @@ from typing import Iterable -from infection_monkey.credential_collectors import ( - Credentials, - ICredentialCollector, - LMHash, - NTHash, - Password, - Username, -) +from infection_monkey.credential_collectors import LMHash, NTHash, Password, Username +from infection_monkey.i_puppet.credential_collection import Credentials, ICredentialCollector + from . import pypykatz_handler from .windows_credentials import WindowsCredentials diff --git a/monkey/infection_monkey/i_puppet/__init__.py b/monkey/infection_monkey/i_puppet/__init__.py index c4e6b5b1c..d6422ebc2 100644 --- a/monkey/infection_monkey/i_puppet/__init__.py +++ b/monkey/infection_monkey/i_puppet/__init__.py @@ -10,3 +10,9 @@ from .i_puppet import ( UnknownPluginError, ) from .i_fingerprinter import IFingerprinter +from .credential_collection import ( + Credentials, + CredentialType, + ICredentialCollector, + ICredentialComponent, +) diff --git a/monkey/infection_monkey/i_puppet/credential_collection/__init__.py b/monkey/infection_monkey/i_puppet/credential_collection/__init__.py new file mode 100644 index 000000000..8bfa68b38 --- /dev/null +++ b/monkey/infection_monkey/i_puppet/credential_collection/__init__.py @@ -0,0 +1,4 @@ +from .i_credential_collector import ICredentialCollector +from .credentials import Credentials +from .i_credential_component import ICredentialComponent +from .credential_type import CredentialType diff --git a/monkey/infection_monkey/credential_collectors/credential_type.py b/monkey/infection_monkey/i_puppet/credential_collection/credential_type.py similarity index 100% rename from monkey/infection_monkey/credential_collectors/credential_type.py rename to monkey/infection_monkey/i_puppet/credential_collection/credential_type.py diff --git a/monkey/infection_monkey/credential_collectors/credentials.py b/monkey/infection_monkey/i_puppet/credential_collection/credentials.py similarity index 70% rename from monkey/infection_monkey/credential_collectors/credentials.py rename to monkey/infection_monkey/i_puppet/credential_collection/credentials.py index 6688e393f..d5591f6d7 100644 --- a/monkey/infection_monkey/credential_collectors/credentials.py +++ b/monkey/infection_monkey/i_puppet/credential_collection/credentials.py @@ -1,7 +1,7 @@ from dataclasses import dataclass from typing import Tuple -from .credential_components.i_credential_component import ICredentialComponent +from .i_credential_component import ICredentialComponent @dataclass(frozen=True) diff --git a/monkey/infection_monkey/credential_collectors/i_credential_collector.py b/monkey/infection_monkey/i_puppet/credential_collection/i_credential_collector.py similarity index 100% rename from monkey/infection_monkey/credential_collectors/i_credential_collector.py rename to monkey/infection_monkey/i_puppet/credential_collection/i_credential_collector.py diff --git a/monkey/infection_monkey/credential_collectors/credential_components/i_credential_component.py b/monkey/infection_monkey/i_puppet/credential_collection/i_credential_component.py similarity index 67% rename from monkey/infection_monkey/credential_collectors/credential_components/i_credential_component.py rename to monkey/infection_monkey/i_puppet/credential_collection/i_credential_component.py index 2a2c38f00..d1c005886 100644 --- a/monkey/infection_monkey/credential_collectors/credential_components/i_credential_component.py +++ b/monkey/infection_monkey/i_puppet/credential_collection/i_credential_component.py @@ -1,6 +1,6 @@ from abc import ABC, abstractmethod -from infection_monkey.credential_collectors.credential_type import CredentialType +from .credential_type import CredentialType class ICredentialComponent(ABC): diff --git a/monkey/tests/unit_tests/infection_monkey/credential_collectors/mimikatz_collector/test_mimikatz_collector.py b/monkey/tests/unit_tests/infection_monkey/credential_collectors/mimikatz_collector/test_mimikatz_collector.py index 49af1d003..8380229b5 100644 --- a/monkey/tests/unit_tests/infection_monkey/credential_collectors/mimikatz_collector/test_mimikatz_collector.py +++ b/monkey/tests/unit_tests/infection_monkey/credential_collectors/mimikatz_collector/test_mimikatz_collector.py @@ -2,13 +2,14 @@ from typing import List import pytest -from infection_monkey.credential_collectors import Credentials, LMHash, NTHash, Password, Username +from infection_monkey.credential_collectors import LMHash, NTHash, Password, Username from infection_monkey.credential_collectors.mimikatz_collector.mimikatz_cred_collector 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):