PBA command modifications

This commit is contained in:
Shreya 2020-06-22 02:09:25 +05:30
parent 2dbf798c4a
commit 3819041632
4 changed files with 18 additions and 11 deletions

View File

@ -1,4 +1,3 @@
import time
from common.data.post_breach_consts import POST_BREACH_HIDDEN_FILES from common.data.post_breach_consts import POST_BREACH_HIDDEN_FILES
from infection_monkey.post_breach.pba import PBA from infection_monkey.post_breach.pba import PBA
from infection_monkey.telemetry.post_breach_telem import PostBreachTelem from infection_monkey.telemetry.post_breach_telem import PostBreachTelem

View File

@ -25,4 +25,5 @@ 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(get_windows_commands_to_delete() if is_windows subprocess.run(get_windows_commands_to_delete() if is_windows
else ' '.join(get_linux_commands_to_delete())) else ' '.join(get_linux_commands_to_delete()),
shell=True)

View File

@ -17,9 +17,9 @@ def get_linux_commands_to_hide_folders():
return [ return [
'mkdir', # make directory 'mkdir', # make directory
HIDDEN_FOLDER, HIDDEN_FOLDER,
'; touch', # create file '&& touch', # create file
'{}/{}'.format(HIDDEN_FOLDER, 'some-file'), # random file in hidden folder '{}/{}'.format(HIDDEN_FOLDER, 'some-file'), # random file in hidden folder
'; echo \"Successfully created hidden folder: {}\" |'.format(HIDDEN_FOLDER), # output '&& echo \"Successfully created hidden folder: {}\" |'.format(HIDDEN_FOLDER), # output
'tee -a', # and write to file 'tee -a', # and write to file
'{}/{}'.format(HIDDEN_FOLDER, 'some-file') # random file in hidden folder '{}/{}'.format(HIDDEN_FOLDER, 'some-file') # random file in hidden folder
] ]
@ -28,8 +28,7 @@ def get_linux_commands_to_hide_folders():
def get_linux_commands_to_delete(): def get_linux_commands_to_delete():
return [ return [
'rm', # remove 'rm', # remove
'-r', # delete recursively '-rf', # force delete recursively
'-f', # force delete
HIDDEN_FILE, HIDDEN_FILE,
HIDDEN_FOLDER HIDDEN_FOLDER
] ]

View File

@ -1,6 +1,11 @@
HIDDEN_FILE = "%homepath%\\monkey-hidden-file" import os
HIDDEN_FILE_WINAPI = "%homepath%\\monkey-hidden-file-winAPI"
HIDDEN_FOLDER = "%homepath%\\monkey-hidden-folder"
HOME_PATH = os.path.expanduser("~")
HIDDEN_FILE = HOME_PATH + "\\monkey-hidden-file"
HIDDEN_FOLDER = HOME_PATH + "\\monkey-hidden-folder"
HIDDEN_FILE_WINAPI = HOME_PATH + "\\monkey-hidden-file-winAPI"
def get_windows_commands_to_hide_files(): def get_windows_commands_to_hide_files():
@ -62,12 +67,15 @@ def get_winAPI_to_hide_files():
def get_windows_commands_to_delete(): def get_windows_commands_to_delete():
return [ return [
'powershell.exe',
'del', # delete file 'del', # delete file
'-Force', # force delete '-Force',
HIDDEN_FILE, HIDDEN_FILE,
',',
HIDDEN_FILE_WINAPI, HIDDEN_FILE_WINAPI,
'&&', ';',
'rmdir', # delete folder 'rmdir', # delete folder
'-Force', '-Force',
'-Recurse',
HIDDEN_FOLDER HIDDEN_FOLDER
] ]