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): def run(self):
if self.command: if self.command:
try: try:
output = subprocess.check_output( output = subprocess.check_output( # noqa: DUO116
self.command, stderr=subprocess.STDOUT, shell=True # noqa: DUO116 self.command, stderr=subprocess.STDOUT, shell=True
).decode() ).decode()
return output, True return output, True
except subprocess.CalledProcessError as e: except subprocess.CalledProcessError as e:

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@ def get_commands_to_proxy_execution_using_signed_script():
def cleanup_changes(original_comspec): def cleanup_changes(original_comspec):
if is_windows_os(): if is_windows_os():
subprocess.run( subprocess.run( # noqa: DUO116
get_windows_commands_to_reset_comspec(original_comspec), shell=True 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 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()): def cleanup_hidden_files(is_windows=is_windows_os()):
subprocess.run( subprocess.run( # noqa: DUO116
get_windows_commands_to_delete() get_windows_commands_to_delete()
if is_windows # noqa: DUO116 if is_windows
else " ".join(get_linux_commands_to_delete()), else " ".join(get_linux_commands_to_delete()),
shell=True, shell=True,
) )