Agent: refactor content dict out of credential component

Content dict serves no purpose, because dataclasses can be serialized without explicit conversion to dict
This commit is contained in:
vakarisz 2022-02-15 14:46:21 +02:00
parent b7003bc231
commit 0fae933477
6 changed files with 10 additions and 6 deletions

View File

@ -7,4 +7,3 @@ from ..credential_type import CredentialType
@dataclass
class ICredentialComponent(ABC):
type: CredentialType
content: dict

View File

@ -4,4 +4,5 @@ from .i_credential_component import ICredentialComponent
class LMHash(ICredentialComponent):
def __init__(self, lm_hash: str):
super().__init__(type=CredentialType.NTLM_HASH, content={"lm_hash": lm_hash})
super().__init__(type=CredentialType.NTLM_HASH)
self.lm_hash = lm_hash

View File

@ -4,4 +4,5 @@ from .i_credential_component import ICredentialComponent
class NTHash(ICredentialComponent):
def __init__(self, nt_hash: str):
super().__init__(type=CredentialType.NTLM_HASH, content={"nt_hash": nt_hash})
super().__init__(type=CredentialType.NTLM_HASH)
self.nt_hash = nt_hash

View File

@ -4,4 +4,5 @@ from .i_credential_component import ICredentialComponent
class Password(ICredentialComponent):
def __init__(self, password: str):
super().__init__(type=CredentialType.PASSWORD, content={"password": password})
super().__init__(type=CredentialType.PASSWORD)
self.password = password

View File

@ -4,4 +4,5 @@ from .i_credential_component import ICredentialComponent
class SSHKeypair(ICredentialComponent):
def __init__(self, content: dict):
super().__init__(type=CredentialType.SSH_KEYPAIR, content=content)
super().__init__(type=CredentialType.SSH_KEYPAIR)
self.content = content

View File

@ -4,4 +4,5 @@ from .i_credential_component import ICredentialComponent
class Username(ICredentialComponent):
def __init__(self, username: str):
super().__init__(type=CredentialType.USERNAME, content={"username": username})
super().__init__(type=CredentialType.USERNAME)
self.username = username