Agent: change ICredentialComponent interface

Interface changed from dataclass (dataclasses are not inheritable) to simple class with type abstract property
This commit is contained in:
vakarisz 2022-02-15 18:35:32 +02:00
parent 26806392ec
commit 8868fb9b0c
5 changed files with 14 additions and 9 deletions

View File

@ -1,9 +1,10 @@
from abc import ABC
from dataclasses import dataclass
from abc import ABC, abstractmethod
from ..credential_type import CredentialType
from infection_monkey.credential_collectors.credential_type import CredentialType
@dataclass
class ICredentialComponent(ABC):
type: CredentialType
@property
@abstractmethod
def type(self) -> CredentialType:
pass

View File

@ -3,6 +3,7 @@ from .i_credential_component import ICredentialComponent
class LMHash(ICredentialComponent):
type = CredentialType.LM_HASH
def __init__(self, lm_hash: str):
super().__init__(type=CredentialType.NTLM_HASH)
self.lm_hash = lm_hash

View File

@ -3,6 +3,7 @@ from .i_credential_component import ICredentialComponent
class NTHash(ICredentialComponent):
type = CredentialType.NT_HASH
def __init__(self, nt_hash: str):
super().__init__(type=CredentialType.NTLM_HASH)
self.nt_hash = nt_hash

View File

@ -3,6 +3,7 @@ from .i_credential_component import ICredentialComponent
class Password(ICredentialComponent):
type = CredentialType.PASSWORD
def __init__(self, password: str):
super().__init__(type=CredentialType.PASSWORD)
self.password = password

View File

@ -3,6 +3,7 @@ from .i_credential_component import ICredentialComponent
class Username(ICredentialComponent):
type = CredentialType.USERNAME
def __init__(self, username: str):
super().__init__(type=CredentialType.USERNAME)
self.username = username