Skip to content

Commit bbda934

Browse files
committed
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
1 parent 19765c7 commit bbda934

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

monkey/infection_monkey/system_info/__init__.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class InfoCollector(object):
5959
"""
6060

6161
def __init__(self):
62-
self.info = {}
62+
self.info = {"credentials": {}}
6363

6464
def get_info(self):
6565
# Collect all hardcoded
@@ -96,8 +96,6 @@ def get_azure_info(self):
9696
return
9797
logger.debug("Harvesting creds if on an Azure machine")
9898
azure_collector = AzureCollector()
99-
if "credentials" not in self.info:
100-
self.info["credentials"] = {}
10199
azure_creds = azure_collector.extract_stored_credentials()
102100
for cred in azure_creds:
103101
username = cred[0]

monkey/infection_monkey/system_info/windows_info_collector.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ def get_mimikatz_info(self):
4545
try:
4646
credentials = MimikatzCredentialCollector.get_creds()
4747
if credentials:
48-
if "credentials" in self.info:
49-
self.info["credentials"].update(credentials)
48+
self.info["credentials"].update(credentials)
5049
logger.info("Mimikatz info gathered successfully")
5150
else:
5251
logger.info("No mimikatz info was gathered")

0 commit comments

Comments
 (0)