Fix DUO116 warnings in post breach actions

by ignoring them
This commit is contained in:
Shreya 2021-04-24 14:04:57 +05:30 committed by Mike Salvatore
parent 6b467fd20b
commit 4d88efdd84
7 changed files with 15 additions and 14 deletions

View File

@ -46,8 +46,8 @@ class ClearCommandHistory(PBA):
def run(self):
if self.command:
try:
output = subprocess.check_output(
self.command, stderr=subprocess.STDOUT, shell=True # noqa: DUO116
output = subprocess.check_output( # noqa: DUO116
self.command, stderr=subprocess.STDOUT, shell=True
).decode()
return output, True
except subprocess.CalledProcessError as e:

View File

@ -58,8 +58,8 @@ class ModifyShellStartupFiles(PBA):
def run(self):
if self.command:
try:
output = subprocess.check_output(
self.command, stderr=subprocess.STDOUT, shell=True # noqa: DUO116
output = subprocess.check_output( # noqa: DUO116
self.command, stderr=subprocess.STDOUT, shell=True
).decode()
return output, True
except subprocess.CalledProcessError as e:

View File

@ -21,10 +21,9 @@ class SignedScriptProxyExecution(PBA):
try:
original_comspec = ""
if is_windows_os():
original_comspec = subprocess.check_output(
original_comspec = subprocess.check_output( # noqa: DUO116
"if defined COMSPEC echo %COMSPEC%", shell=True
).decode() # noqa: DUO116
).decode()
super().run()
except Exception as e:
LOG.warning(

View File

@ -90,7 +90,7 @@ class PBA(Plugin):
:return: Tuple of command's output string and boolean, indicating if it succeeded
"""
try:
output = subprocess.check_output(
output = subprocess.check_output( # noqa: DUO116
self.command, stderr=subprocess.STDOUT, shell=True
).decode()
return output, True

View File

@ -13,8 +13,10 @@ def get_windows_commands_to_modify_shell_startup_files():
# get list of usernames
USERS = (
subprocess.check_output("dir C:\\Users /b", shell=True).decode().split("\r\n")[:-1]
) # noqa: DUO116
subprocess.check_output("dir C:\\Users /b", shell=True) # noqa: DUO116
.decode()
.split("\r\n")[:-1]
)
USERS.remove("Public")
STARTUP_FILES_PER_USER = [

View File

@ -15,7 +15,7 @@ def get_commands_to_proxy_execution_using_signed_script():
def cleanup_changes(original_comspec):
if is_windows_os():
subprocess.run(
subprocess.run( # noqa: DUO116
get_windows_commands_to_reset_comspec(original_comspec), shell=True
) # noqa: DUO116
)
subprocess.run(get_windows_commands_to_delete_temp_comspec(), shell=True) # noqa: DUO116

View File

@ -26,9 +26,9 @@ def get_commands_to_hide_folders():
def cleanup_hidden_files(is_windows=is_windows_os()):
subprocess.run(
subprocess.run( # noqa: DUO116
get_windows_commands_to_delete()
if is_windows # noqa: DUO116
if is_windows
else " ".join(get_linux_commands_to_delete()),
shell=True,
)