Agent, UI: Improve style with small changes in interrupt code

This commit is contained in:
vakaris_zilius 2022-03-17 13:50:02 +00:00 committed by Mike Salvatore
parent 1d74864092
commit 6bdd5ef179
3 changed files with 9 additions and 5 deletions

View File

@ -100,6 +100,7 @@ class HostExploiter:
# Ideally the user should only do "check_for_interrupt()"
if self.interrupt.is_set():
logger.info("Exploiter has been interrupted by a stop signal from the Island")
self.exploit_result["error_message"] = "Exploiter has been interrupted by a stop signal from the Island"
return self.interrupt.is_set()
def post_exploit(self):

View File

@ -15,6 +15,7 @@ from infection_monkey.utils.brute_force import (
get_credential_string,
)
from infection_monkey.utils.commands import build_monkey_commandline
from infection_monkey.utils.threading import interruptable_iter
logger = logging.getLogger(__name__)
@ -28,10 +29,12 @@ class WmiExploiter(HostExploiter):
def _exploit_host(self) -> ExploiterResultData:
creds = generate_brute_force_combinations(self.options["credentials"])
intp_creds = interruptable_iter(creds,
self.interrupt,
"WMI exploiter has been interrupted by a stop signal from the Island",
logging.INFO)
for user, password, lm_hash, ntlm_hash in creds:
if self.is_interrupted():
return self.exploit_result
for user, password, lm_hash, ntlm_hash in intp_creds:
creds_for_log = get_credential_string([user, password, lm_hash, ntlm_hash])
logger.debug(f"Attempting to connect to {self.host} using WMI with {creds_for_log}")

View File

@ -88,8 +88,8 @@ class MapPageComponent extends AuthComponent {
{
method: 'POST',
headers: {'Content-Type': 'application/json'},
// Python uses seconds, Date.now uses milliseconds, so convert
body: JSON.stringify({kill_time: Date.now() / 1000})
// Python uses floating point seconds, Date.now uses milliseconds, so convert
body: JSON.stringify({kill_time: Date.now() / 1000.0})
})
.then(res => res.json())
.then(res => {this.setState({killPressed: true})});