Agent: Add timeouts in shell startup modification PBA's

This commit is contained in:
vakarisz 2022-03-31 17:32:33 +03:00
parent 581ece577d
commit 4ad07ae3ff
2 changed files with 8 additions and 2 deletions

View File

@ -1,5 +1,6 @@
import subprocess
from common.common_consts.timeouts import MEDIUM_REQUEST_TIMEOUT
from infection_monkey.utils.environment import is_windows_os
@ -12,7 +13,9 @@ def get_linux_commands_to_modify_shell_startup_files():
# get list of usernames
USERS = (
subprocess.check_output( # noqa: DUO116
"cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1", shell=True
"cut -d: -f1,3 /etc/passwd | egrep ':[0-9]{4}$' | cut -d: -f1",
shell=True,
timeout=MEDIUM_REQUEST_TIMEOUT,
)
.decode()
.split("\n")[:-1]

View File

@ -1,6 +1,7 @@
import subprocess
from pathlib import Path
from common.common_consts.timeouts import MEDIUM_REQUEST_TIMEOUT
from infection_monkey.utils.environment import is_windows_os
MODIFY_POWERSHELL_STARTUP_SCRIPT = Path(__file__).parent / "modify_powershell_startup_file.ps1"
@ -16,7 +17,9 @@ def get_windows_commands_to_modify_shell_startup_files():
# get list of usernames
USERS = (
subprocess.check_output("dir C:\\Users /b", shell=True) # noqa: DUO116
subprocess.check_output( # noqa: DUO116
"dir C:\\Users /b", shell=True, timeout=MEDIUM_REQUEST_TIMEOUT
)
.decode()
.split("\r\n")[:-1]
)