forked from p15670423/monkey
Agent: change mimikatz collector to return a list of credentials
This commit is contained in:
parent
2f1b57a526
commit
a6c2762823
|
@ -13,15 +13,15 @@ from .windows_credentials import WindowsCredentials
|
||||||
|
|
||||||
|
|
||||||
class MimikatzCredentialCollector(ICredentialCollector):
|
class MimikatzCredentialCollector(ICredentialCollector):
|
||||||
def collect_credentials(self) -> Credentials:
|
def collect_credentials(self) -> List[Credentials]:
|
||||||
creds = pypykatz_handler.get_windows_creds()
|
creds = pypykatz_handler.get_windows_creds()
|
||||||
return MimikatzCredentialCollector.to_credentials(creds)
|
return MimikatzCredentialCollector.to_credentials(creds)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def to_credentials(win_creds: List[WindowsCredentials]) -> Credentials:
|
def to_credentials(win_creds: List[WindowsCredentials]) -> [Credentials]:
|
||||||
creds_obj = Credentials(identities=[], secrets=[])
|
all_creds = []
|
||||||
for win_cred in win_creds:
|
for win_cred in win_creds:
|
||||||
|
creds_obj = Credentials(identities=[], secrets=[])
|
||||||
if win_cred.username:
|
if win_cred.username:
|
||||||
identity = Username(win_cred.username)
|
identity = Username(win_cred.username)
|
||||||
creds_obj.identities.append(identity)
|
creds_obj.identities.append(identity)
|
||||||
|
@ -34,4 +34,7 @@ class MimikatzCredentialCollector(ICredentialCollector):
|
||||||
hashes = NTHashes(ntlm_hash=win_cred.ntlm_hash, lm_hash=win_cred.lm_hash)
|
hashes = NTHashes(ntlm_hash=win_cred.ntlm_hash, lm_hash=win_cred.lm_hash)
|
||||||
creds_obj.secrets.append(hashes)
|
creds_obj.secrets.append(hashes)
|
||||||
|
|
||||||
return creds_obj
|
if creds_obj.identities != [] or creds_obj.secrets != []:
|
||||||
|
all_creds.append(creds_obj)
|
||||||
|
|
||||||
|
return all_creds
|
||||||
|
|
Loading…
Reference in New Issue