Agent: Publish all prop/exploit events from _wait_for_victim()

This commit is contained in:
Mike Salvatore 2022-10-06 16:41:20 -04:00
parent 0f3f45e92f
commit d8fca72f28
1 changed files with 7 additions and 4 deletions

View File

@ -181,7 +181,9 @@ class Log4ShellExploiter(WebRCE):
victim_called_back = self._wait_for_victim_to_download_java_bytecode()
if victim_called_back:
self._publish_exploitation_event(timestamp, True)
self._wait_for_victim_to_download_agent()
victim_downloaded_agent = self._wait_for_victim_to_download_agent()
self._publish_propagation_event(success=victim_downloaded_agent)
else:
error_message = "Timed out while waiting for victim to download the java bytecode"
logger.debug(error_message)
@ -202,15 +204,16 @@ class Log4ShellExploiter(WebRCE):
return False
def _wait_for_victim_to_download_agent(self):
def _wait_for_victim_to_download_agent(self) -> bool:
timer = Timer()
timer.set(LONG_REQUEST_TIMEOUT)
while not timer.is_expired():
if self._agent_http_server_thread.downloads > 0:
self._publish_propagation_event(success=True)
self.exploit_result.propagation_success = True
break
return True
# TODO: if the http server got an error we're waiting for nothing here
time.sleep(1)
return False