Skip to content

Commit 19feb24

Browse files
Agent: Change report login attempt
* It sends exploitation and propagation result * Powershell UT needs to be updated
1 parent 66f4b96 commit 19feb24

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

monkey/infection_monkey/exploit/HostExploiter.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,20 @@ def send_exploit_telemetry(self, name: str, result: bool):
5959
attempts=self.exploit_attempts,
6060
).send()
6161

62-
def report_login_attempt(self, result, user, password="", lm_hash="", ntlm_hash="", ssh_key=""):
62+
def report_login_attempt(
63+
self,
64+
exploitation_result,
65+
propagation_result,
66+
user,
67+
password="",
68+
lm_hash="",
69+
ntlm_hash="",
70+
ssh_key="",
71+
):
6372
self.exploit_attempts.append(
6473
{
65-
"result": result,
74+
"exploitation_result": exploitation_result,
75+
"propagation_result": propagation_result,
6676
"user": user,
6777
"password": password,
6878
"lm_hash": lm_hash,

monkey/infection_monkey/exploit/sshexec.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -63,14 +63,14 @@ def exploit_with_ssh_keys(self, port) -> paramiko.SSHClient:
6363
logger.debug(
6464
"Successfully logged in %s using %s users private key", self.host, ssh_string
6565
)
66-
self.report_login_attempt(True, user, ssh_key=ssh_string)
66+
self.report_login_attempt(True, False, user, ssh_key=ssh_string)
6767
return ssh
6868
except Exception:
6969
ssh.close()
7070
logger.debug(
7171
"Error logging into victim %r with %s" " private key", self.host, ssh_string
7272
)
73-
self.report_login_attempt(False, user, ssh_key=ssh_string)
73+
self.report_login_attempt(False, False, user, ssh_key=ssh_string)
7474
continue
7575
raise FailedExploitationError
7676

@@ -89,7 +89,7 @@ def exploit_with_login_creds(self, port) -> paramiko.SSHClient:
8989

9090
logger.debug("Successfully logged in %r using SSH. User: %s", self.host, user)
9191
self.add_vuln_port(port)
92-
self.report_login_attempt(True, user, current_password)
92+
self.report_login_attempt(False, True, user, current_password)
9393
return ssh
9494

9595
except Exception as exc:
@@ -99,7 +99,7 @@ def exploit_with_login_creds(self, port) -> paramiko.SSHClient:
9999
user,
100100
exc,
101101
)
102-
self.report_login_attempt(False, user, current_password)
102+
self.report_login_attempt(False, False, user, current_password)
103103
ssh.close()
104104
continue
105105
raise FailedExploitationError

0 commit comments

Comments
 (0)