From 28e0a6ec97baa608a41edd2632786fcb7800e4d0 Mon Sep 17 00:00:00 2001 From: Shreya Date: Mon, 20 Jul 2020 20:09:19 +0530 Subject: [PATCH] Make setuid/setgid and trap PBAs not crash on windows --- .../post_breach/actions/change_file_privileges.py | 7 +++---- .../post_breach/actions/use_trap_command.py | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/monkey/infection_monkey/post_breach/actions/change_file_privileges.py b/monkey/infection_monkey/post_breach/actions/change_file_privileges.py index 444804f81..2c1627b52 100644 --- a/monkey/infection_monkey/post_breach/actions/change_file_privileges.py +++ b/monkey/infection_monkey/post_breach/actions/change_file_privileges.py @@ -7,7 +7,6 @@ from infection_monkey.utils.environment import is_windows_os class ChangeSetuidSetgid(PBA): def __init__(self): - if not is_windows_os(): - linux_cmds = get_commands_to_change_setuid_setgid() - super(ChangeSetuidSetgid, self).__init__(POST_BREACH_SETUID_SETGID, - linux_cmd=' '.join(linux_cmds)) + linux_cmds = get_commands_to_change_setuid_setgid() + super(ChangeSetuidSetgid, self).__init__(POST_BREACH_SETUID_SETGID, + linux_cmd=' '.join(linux_cmds)) diff --git a/monkey/infection_monkey/post_breach/actions/use_trap_command.py b/monkey/infection_monkey/post_breach/actions/use_trap_command.py index 306e92fa3..bd461c974 100644 --- a/monkey/infection_monkey/post_breach/actions/use_trap_command.py +++ b/monkey/infection_monkey/post_breach/actions/use_trap_command.py @@ -7,7 +7,6 @@ from infection_monkey.utils.environment import is_windows_os class TrapCommand(PBA): def __init__(self): - if not is_windows_os(): - linux_cmds = get_trap_commands() - super(TrapCommand, self).__init__(POST_BREACH_TRAP_COMMAND, - linux_cmd=linux_cmds) + linux_cmds = get_trap_commands() + super(TrapCommand, self).__init__(POST_BREACH_TRAP_COMMAND, + linux_cmd=linux_cmds)