Agent: change ICredentialComponent interface
Interface changed from dataclass (dataclasses are not inheritable) to simple class with type abstract property
This commit is contained in:
parent
26806392ec
commit
8868fb9b0c
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue