Agent: define credential collector, credentials interfaces

This commit is contained in:
vakarisz 2022-02-14 11:41:47 +02:00
parent 98a2f0b887
commit c21cf681a4
10 changed files with 69 additions and 0 deletions

View File

@ -0,0 +1,10 @@
from abc import ABC
from dataclasses import dataclass
from ..credential_types import CredentialTypes
@dataclass
class ICredentialComponent(ABC):
type: CredentialTypes
content: dict

View File

@ -0,0 +1,8 @@
from ..credential_types import CredentialTypes
from .i_credential_component import ICredentialComponent
class NtlmHash(ICredentialComponent):
def __init__(self, content: dict):
super().__init__(type=CredentialTypes.NTLM_HASH, content=content)

View File

@ -0,0 +1,8 @@
from ..credential_types import CredentialTypes
from .i_credential_component import ICredentialComponent
class Password(ICredentialComponent):
def __init__(self, content: dict):
super().__init__(type=CredentialTypes.PASSWORD, content=content)

View File

@ -0,0 +1,8 @@
from ..credential_types import CredentialTypes
from .i_credential_component import ICredentialComponent
class SSHKeypair(ICredentialComponent):
def __init__(self, content: dict):
super().__init__(type=CredentialTypes.KEYPAIR, content=content)

View File

@ -0,0 +1,8 @@
from ..credential_types import CredentialTypes
from .i_credential_component import ICredentialComponent
class Username(ICredentialComponent):
def __init__(self, content: dict):
super().__init__(type=CredentialTypes.USERNAME, content=content)

View File

@ -0,0 +1,8 @@
from enum import Enum
class CredentialTypes(Enum):
KEYPAIR = 1
USERNAME = 2
PASSWORD = 3
NTLM_HASH = 4

View File

@ -0,0 +1,10 @@
from dataclasses import dataclass
from typing import List
from .credential_components.i_credential_component import ICredentialComponent
@dataclass
class Credentials:
identities: List[ICredentialComponent]
secrets: List[ICredentialComponent]

View File

@ -0,0 +1,9 @@
from abc import ABC, abstractmethod
from .credentials import Credentials
class ICredentialCollector(ABC):
@abstractmethod
def collect_credentials(self) -> Credentials:
pass