forked from p15670423/monkey
Agent: Extract method _set_interrupted() from is_interrupted()
This commit is contained in:
parent
b0f03179c1
commit
7a1fcced2f
|
@ -94,14 +94,15 @@ class HostExploiter:
|
||||||
)
|
)
|
||||||
self.set_start_time()
|
self.set_start_time()
|
||||||
|
|
||||||
def is_interrupted(self):
|
def _is_interrupted(self):
|
||||||
|
return self.interrupt.is_set()
|
||||||
|
|
||||||
|
def _set_interrupted(self):
|
||||||
# This method should be refactored to raise an exception to reduce duplication in the
|
# This method should be refactored to raise an exception to reduce duplication in the
|
||||||
# "if is_interrupted: return self.exploitation_results"
|
# "if is_interrupted: return self.exploitation_results"
|
||||||
# Ideally the user should only do "check_for_interrupt()"
|
# Ideally the user should only do "check_for_interrupt()"
|
||||||
if self.interrupt.is_set():
|
logger.info("Exploiter has been interrupted")
|
||||||
logger.info("Exploiter has been interrupted")
|
self.exploit_result.interrupted = True
|
||||||
self.exploit_result.interrupted = True
|
|
||||||
return self.interrupt.is_set()
|
|
||||||
|
|
||||||
def post_exploit(self):
|
def post_exploit(self):
|
||||||
self.set_finish_time()
|
self.set_finish_time()
|
||||||
|
|
|
@ -73,7 +73,8 @@ class MSSQLExploiter(HostExploiter):
|
||||||
)
|
)
|
||||||
return self.exploit_result
|
return self.exploit_result
|
||||||
|
|
||||||
if self.is_interrupted():
|
if self._is_interrupted():
|
||||||
|
self._set_interrupted()
|
||||||
return self.exploit_result
|
return self.exploit_result
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -70,7 +70,8 @@ class PowerShellExploiter(HostExploiter):
|
||||||
|
|
||||||
self._client = self._authenticate_via_brute_force(credentials, auth_options)
|
self._client = self._authenticate_via_brute_force(credentials, auth_options)
|
||||||
|
|
||||||
if self.is_interrupted():
|
if self._is_interrupted():
|
||||||
|
self._set_interrupted()
|
||||||
return self.exploit_result
|
return self.exploit_result
|
||||||
|
|
||||||
if not self._client:
|
if not self._client:
|
||||||
|
|
|
@ -70,7 +70,8 @@ class WmiExploiter(HostExploiter):
|
||||||
|
|
||||||
downloaded_agent = self.agent_repository.get_agent_binary(self.host.os["type"])
|
downloaded_agent = self.agent_repository.get_agent_binary(self.host.os["type"])
|
||||||
|
|
||||||
if self.is_interrupted():
|
if self._is_interrupted():
|
||||||
|
self._set_interrupted()
|
||||||
return self.exploit_result
|
return self.exploit_result
|
||||||
|
|
||||||
remote_full_path = SmbTools.copy_file(
|
remote_full_path = SmbTools.copy_file(
|
||||||
|
|
Loading…
Reference in New Issue