From c78e6333f8b84e596f6996ed7f7bc013dd1d891b Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Wed, 21 Sep 2022 17:57:44 +0000 Subject: [PATCH] Agent: Fix mypy issues in pba.py --- monkey/infection_monkey/post_breach/pba.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/post_breach/pba.py b/monkey/infection_monkey/post_breach/pba.py index 0ef8e0ecb..c381f6ad9 100644 --- a/monkey/infection_monkey/post_breach/pba.py +++ b/monkey/infection_monkey/post_breach/pba.py @@ -1,6 +1,6 @@ import logging import subprocess -from typing import Dict, Iterable +from typing import Dict, Iterable, List, Tuple from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT from common.utils.attack_utils import ScanStatus @@ -33,7 +33,7 @@ class PBA: """ self.command = PBA.choose_command(linux_cmd, windows_cmd) self.name = name - self.pba_data = [] + self.pba_data: List[PostBreachData] = [] self.telemetry_messenger = telemetry_messenger self.timeout = timeout @@ -73,7 +73,7 @@ class PBA: pba_execution_succeeded = pba_execution_result[1] return pba_execution_succeeded and self.is_script() - def _execute_default(self): + def _execute_default(self) -> Tuple[str, bool]: """ Default post breach command execution routine :return: Tuple of command's output string and boolean, indicating if it succeeded @@ -84,7 +84,7 @@ class PBA: ).decode() return output, True except subprocess.CalledProcessError as err: - return err.output.decode(), False + return bytes(err.output).decode(), False except subprocess.TimeoutExpired as err: return str(err), False