Agent: rename and move credentials_type enum to common

This commit is contained in:
vakarisz 2022-02-17 10:37:20 +02:00
parent 597fe35806
commit a8717dc691
10 changed files with 24 additions and 20 deletions

View File

@ -1,7 +1,7 @@
from enum import Enum from enum import Enum
class CredentialType(Enum): class CredentialsType(Enum):
USERNAME = 1 USERNAME = 1
PASSWORD = 2 PASSWORD = 2
NT_HASH = 3 NT_HASH = 3

View File

@ -1,9 +1,10 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from infection_monkey.i_puppet import CredentialType, ICredentialComponent from common.common_consts.credentials_type import CredentialsType
from infection_monkey.i_puppet import ICredentialComponent
@dataclass(frozen=True) @dataclass(frozen=True)
class LMHash(ICredentialComponent): class LMHash(ICredentialComponent):
credential_type: CredentialType = field(default=CredentialType.LM_HASH, init=False) credential_type: CredentialsType = field(default=CredentialsType.LM_HASH, init=False)
lm_hash: str lm_hash: str

View File

@ -1,9 +1,10 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from infection_monkey.i_puppet import CredentialType, ICredentialComponent from common.common_consts.credentials_type import CredentialsType
from infection_monkey.i_puppet import ICredentialComponent
@dataclass(frozen=True) @dataclass(frozen=True)
class NTHash(ICredentialComponent): class NTHash(ICredentialComponent):
credential_type: CredentialType = field(default=CredentialType.NT_HASH, init=False) credential_type: CredentialsType = field(default=CredentialsType.NT_HASH, init=False)
nt_hash: str nt_hash: str

View File

@ -1,9 +1,10 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from infection_monkey.i_puppet import CredentialType, ICredentialComponent from common.common_consts.credentials_type import CredentialsType
from infection_monkey.i_puppet import ICredentialComponent
@dataclass(frozen=True) @dataclass(frozen=True)
class Password(ICredentialComponent): class Password(ICredentialComponent):
credential_type: CredentialType = field(default=CredentialType.PASSWORD, init=False) credential_type: CredentialsType = field(default=CredentialsType.PASSWORD, init=False)
password: str password: str

View File

@ -1,10 +1,11 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from infection_monkey.i_puppet import CredentialType, ICredentialComponent from common.common_consts.credentials_type import CredentialsType
from infection_monkey.i_puppet import ICredentialComponent
@dataclass(frozen=True) @dataclass(frozen=True)
class SSHKeypair(ICredentialComponent): class SSHKeypair(ICredentialComponent):
credential_type: CredentialType = field(default=CredentialType.SSH_KEYPAIR, init=False) credential_type: CredentialsType = field(default=CredentialsType.SSH_KEYPAIR, init=False)
private_key: str private_key: str
public_key: str public_key: str

View File

@ -1,9 +1,10 @@
from dataclasses import dataclass, field from dataclasses import dataclass, field
from infection_monkey.i_puppet import CredentialType, ICredentialComponent from common.common_consts.credentials_type import CredentialsType
from infection_monkey.i_puppet import ICredentialComponent
@dataclass(frozen=True) @dataclass(frozen=True)
class Username(ICredentialComponent): class Username(ICredentialComponent):
credential_type: CredentialType = field(default=CredentialType.USERNAME, init=False) credential_type: CredentialsType = field(default=CredentialsType.USERNAME, init=False)
username: str username: str

View File

@ -1,10 +1,4 @@
from .plugin_type import PluginType from .plugin_type import PluginType
from .credential_collection import (
Credentials,
CredentialType,
ICredentialCollector,
ICredentialComponent,
)
from .i_puppet import ( from .i_puppet import (
IPuppet, IPuppet,
ExploiterResultData, ExploiterResultData,
@ -16,3 +10,8 @@ from .i_puppet import (
UnknownPluginError, UnknownPluginError,
) )
from .i_fingerprinter import IFingerprinter from .i_fingerprinter import IFingerprinter
from .credential_collection import (
Credentials,
ICredentialCollector,
ICredentialComponent,
)

View File

@ -1,4 +1,3 @@
from .i_credential_collector import ICredentialCollector from .i_credential_collector import ICredentialCollector
from .credentials import Credentials from .credentials import Credentials
from .i_credential_component import ICredentialComponent from .i_credential_component import ICredentialComponent
from .credential_type import CredentialType

View File

@ -1,10 +1,10 @@
from abc import ABC, abstractmethod from abc import ABC, abstractmethod
from .credential_type import CredentialType from common.common_consts.credentials_type import CredentialsType
class ICredentialComponent(ABC): class ICredentialComponent(ABC):
@property @property
@abstractmethod @abstractmethod
def credential_type(self) -> CredentialType: def credential_type(self) -> CredentialsType:
pass pass

View File

@ -12,6 +12,7 @@ from monkey_island.cc.services.telemetry.processing.tunnel import process_tunnel
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
TELEMETRY_CATEGORY_TO_PROCESSING_FUNC = { TELEMETRY_CATEGORY_TO_PROCESSING_FUNC = {
TelemCategoryEnum.CREDENTIALS: process_credentials_telemetry,
TelemCategoryEnum.TUNNEL: process_tunnel_telemetry, TelemCategoryEnum.TUNNEL: process_tunnel_telemetry,
TelemCategoryEnum.STATE: process_state_telemetry, TelemCategoryEnum.STATE: process_state_telemetry,
TelemCategoryEnum.EXPLOIT: process_exploit_telemetry, TelemCategoryEnum.EXPLOIT: process_exploit_telemetry,