From eea5352084e7a0355a972187baac91f26272f460 Mon Sep 17 00:00:00 2001 From: Shreya Date: Sun, 7 Jun 2020 20:21:09 +0530 Subject: [PATCH] Little changes based on review --- monkey/infection_monkey/post_breach/actions/hide_files.py | 8 ++++---- monkey/infection_monkey/utils/linux/hidden_files.py | 3 ++- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/monkey/infection_monkey/post_breach/actions/hide_files.py b/monkey/infection_monkey/post_breach/actions/hide_files.py index ee5a7add9..1111f3cf4 100644 --- a/monkey/infection_monkey/post_breach/actions/hide_files.py +++ b/monkey/infection_monkey/post_breach/actions/hide_files.py @@ -10,8 +10,8 @@ from infection_monkey.utils.hidden_files import\ from infection_monkey.utils.environment import is_windows_os -CREATE_HIDDEN = [get_commands_to_hide_files, - get_commands_to_hide_folders] +HIDDEN_FSO_CREATION_COMMANDS = [get_commands_to_hide_files, + get_commands_to_hide_folders] class HiddenFiles(PBA): @@ -24,8 +24,8 @@ class HiddenFiles(PBA): def run(self): # create hidden files and folders - for method_to_create in CREATE_HIDDEN: - linux_cmds, windows_cmds = method_to_create() + for function_to_get_commands in HIDDEN_FSO_CREATION_COMMANDS: + linux_cmds, windows_cmds = function_to_get_commands() super(HiddenFiles, self).__init__(name=POST_BREACH_HIDDEN_FILES, linux_cmd=' '.join(linux_cmds), windows_cmd=windows_cmds) diff --git a/monkey/infection_monkey/utils/linux/hidden_files.py b/monkey/infection_monkey/utils/linux/hidden_files.py index 028edf4a1..26b96b16c 100644 --- a/monkey/infection_monkey/utils/linux/hidden_files.py +++ b/monkey/infection_monkey/utils/linux/hidden_files.py @@ -6,7 +6,8 @@ def get_linux_commands_to_hide_files(): return [ 'touch', # create file HIDDEN_FILE, - '; echo \"Successfully created hidden file: {}\" |'.format(HIDDEN_FILE), # output + '&&' + 'echo \"Successfully created hidden file: {}\" |'.format(HIDDEN_FILE), # output 'tee -a', # and write to file HIDDEN_FILE ]