forked from p15670423/monkey
Agent: Catch timeout error in PBA base class
This commit is contained in:
parent
4cc57f1236
commit
9ac4d23f28
|
@ -19,7 +19,12 @@ class PBA:
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self, telemetry_messenger: ITelemetryMessenger, name="unknown", linux_cmd="", windows_cmd="", timeout: int = LONG_REQUEST_TIMEOUT
|
self,
|
||||||
|
telemetry_messenger: ITelemetryMessenger,
|
||||||
|
name="unknown",
|
||||||
|
linux_cmd="",
|
||||||
|
windows_cmd="",
|
||||||
|
timeout: int = LONG_REQUEST_TIMEOUT,
|
||||||
):
|
):
|
||||||
"""
|
"""
|
||||||
:param name: Name of post breach action.
|
:param name: Name of post breach action.
|
||||||
|
@ -78,9 +83,10 @@ class PBA:
|
||||||
self.command, stderr=subprocess.STDOUT, shell=True, timeout=self.timeout
|
self.command, stderr=subprocess.STDOUT, shell=True, timeout=self.timeout
|
||||||
).decode()
|
).decode()
|
||||||
return output, True
|
return output, True
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as err:
|
||||||
# Return error output of the command
|
return err.output.decode(), False
|
||||||
return e.output.decode(), False
|
except subprocess.TimeoutExpired as err:
|
||||||
|
return str(err), False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def choose_command(linux_cmd, windows_cmd):
|
def choose_command(linux_cmd, windows_cmd):
|
||||||
|
|
Loading…
Reference in New Issue