Monkey: include credential key into info dict of InfoCollector class

This change cleans up the code because the info collectors can just add credentials to the info dictionary without explicitly checking if the key already exists
This commit is contained in:
VakarisZ 2021-10-05 16:04:02 +03:00
parent 19765c7021
commit bbda934082
2 changed files with 2 additions and 5 deletions

View File

@ -59,7 +59,7 @@ class InfoCollector(object):
"""
def __init__(self):
self.info = {}
self.info = {"credentials": {}}
def get_info(self):
# Collect all hardcoded
@ -96,8 +96,6 @@ class InfoCollector(object):
return
logger.debug("Harvesting creds if on an Azure machine")
azure_collector = AzureCollector()
if "credentials" not in self.info:
self.info["credentials"] = {}
azure_creds = azure_collector.extract_stored_credentials()
for cred in azure_creds:
username = cred[0]

View File

@ -45,8 +45,7 @@ class WindowsInfoCollector(InfoCollector):
try:
credentials = MimikatzCredentialCollector.get_creds()
if credentials:
if "credentials" in self.info:
self.info["credentials"].update(credentials)
self.info["credentials"].update(credentials)
logger.info("Mimikatz info gathered successfully")
else:
logger.info("No mimikatz info was gathered")