From a98f321ed074f14b04768ce72b15d4baf7837ca8 Mon Sep 17 00:00:00 2001 From: Shreya Date: Sun, 21 Jun 2020 01:23:53 +0530 Subject: [PATCH] Windows: change location of hidden file/folder + add system attribute --- .../utils/windows/hidden_files.py | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/monkey/infection_monkey/utils/windows/hidden_files.py b/monkey/infection_monkey/utils/windows/hidden_files.py index 7740669f1..ce1bf3450 100644 --- a/monkey/infection_monkey/utils/windows/hidden_files.py +++ b/monkey/infection_monkey/utils/windows/hidden_files.py @@ -1,6 +1,6 @@ -HIDDEN_FILE = "%temp%\\monkey-hidden-file" -HIDDEN_FILE_WINAPI = "%temp%\\monkey-hidden-file-winAPI" -HIDDEN_FOLDER = "%temp%\\monkey-hidden-folder" +HIDDEN_FILE = "%homepath%\\monkey-hidden-file" +HIDDEN_FILE_WINAPI = "%homepath%\\monkey-hidden-file-winAPI" +HIDDEN_FOLDER = "%homepath%\\monkey-hidden-folder" def get_windows_commands_to_hide_files(): @@ -10,8 +10,9 @@ def get_windows_commands_to_hide_files(): '>', HIDDEN_FILE, '&&', - 'attrib', # change file attributes - '+h', # make hidden + 'attrib', # change file attributes + '+h', # hidden attribute + '+s', # system attribute HIDDEN_FILE, '&&', 'type', @@ -25,7 +26,8 @@ def get_windows_commands_to_hide_folders(): HIDDEN_FOLDER, # make directory '&&', 'attrib', - '+h', + '+h', # hidden attribute + '+s', # system attribute HIDDEN_FOLDER, # change file attributes '&&', 'echo', @@ -60,12 +62,12 @@ def get_winAPI_to_hide_files(): def get_windows_commands_to_delete(): return [ - 'del', # delete file - '-Force', # force delete + 'del', # delete file + '-Force', # force delete HIDDEN_FILE, HIDDEN_FILE_WINAPI, '&&', - 'rmdir', # delete folder + 'rmdir', # delete folder '-Force', HIDDEN_FOLDER ]