Agent: Collect timestamp before powershell connect

This commit is contained in:
Mike Salvatore 2022-10-06 12:39:37 -04:00
parent c4573673ce
commit 65dd386603
1 changed files with 5 additions and 2 deletions

View File

@ -121,13 +121,14 @@ class PowerShellExploiter(HostExploiter):
try:
client = PowerShellClient(self.host.ip_addr, creds, opts)
connect_timestamp = time()
client.connect()
logger.info(
f"Successfully logged into {self.host.ip_addr} using Powershell. User: "
f"{creds.username}, Secret Type: {creds.secret_type.name}"
)
self._publish_exploitation_event(success=True)
self._publish_exploitation_event(time=connect_timestamp, success=True)
self.exploit_result.exploitation_success = True
self._report_login_attempt(True, creds)
@ -138,7 +139,9 @@ class PowerShellExploiter(HostExploiter):
f"{creds.username}, SecretType: {creds.secret_type.name} -- Error: {ex}"
)
logger.debug(error_message)
self._publish_exploitation_event(success=False, error_message=error_message)
self._publish_exploitation_event(
time=connect_timestamp, success=False, error_message=error_message
)
self._report_login_attempt(False, creds)
return None