Agent: define credential collector, credentials interfaces
This commit is contained in:
parent
98a2f0b887
commit
c21cf681a4
|
@ -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
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -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)
|
|
@ -0,0 +1,8 @@
|
|||
from enum import Enum
|
||||
|
||||
|
||||
class CredentialTypes(Enum):
|
||||
KEYPAIR = 1
|
||||
USERNAME = 2
|
||||
PASSWORD = 3
|
||||
NTLM_HASH = 4
|
|
@ -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]
|
|
@ -0,0 +1,9 @@
|
|||
from abc import ABC, abstractmethod
|
||||
|
||||
from .credentials import Credentials
|
||||
|
||||
|
||||
class ICredentialCollector(ABC):
|
||||
@abstractmethod
|
||||
def collect_credentials(self) -> Credentials:
|
||||
pass
|
Loading…
Reference in New Issue