Merge pull request #1424 from guardicore/post-breach-pyinstaller-hook

Post breach pyinstaller hook
This commit is contained in:
Mike Salvatore 2021-08-23 13:54:55 -04:00 committed by GitHub
commit d203b28a38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 4 deletions

View File

@ -19,6 +19,8 @@ Changelog](https://keepachangelog.com/en/1.0.0/).
- Typo "trough" -> "through" in telemetry and docstring. - Typo "trough" -> "through" in telemetry and docstring.
- Crash when unexpected character encoding is used by ping command on German - Crash when unexpected character encoding is used by ping command on German
language systems. #1175 language systems. #1175
- Malfunctioning timestomping PBA. #1405
- Malfunctioning shell startup script PBA. #1419
## [1.11.0] - 2021-08-13 ## [1.11.0] - 2021-08-13
### Added ### Added

View File

@ -1,7 +1,10 @@
import subprocess import subprocess
from pathlib import Path
from infection_monkey.utils.environment import is_windows_os from infection_monkey.utils.environment import is_windows_os
MODIFY_POWERSHELL_STARTUP_SCRIPT = Path(__file__).parent / "modify_powershell_startup_file.ps1"
def get_windows_commands_to_modify_shell_startup_files(): def get_windows_commands_to_modify_shell_startup_files():
if not is_windows_os(): if not is_windows_os():
@ -28,7 +31,6 @@ def get_windows_commands_to_modify_shell_startup_files():
return [ return [
"powershell.exe", "powershell.exe",
"infection_monkey/post_breach/shell_startup_files/windows" str(MODIFY_POWERSHELL_STARTUP_SCRIPT),
"/modify_powershell_startup_file.ps1",
"-startup_file_path {0}", "-startup_file_path {0}",
], STARTUP_FILES_PER_USER ], STARTUP_FILES_PER_USER

View File

@ -1,8 +1,10 @@
TEMP_FILE = "monkey-timestomping-file.txt" from pathlib import Path
TIMESTOMPING_SCRIPT = Path(__file__).parent / "timestomping.ps1"
def get_windows_timestomping_commands(): def get_windows_timestomping_commands():
return "powershell.exe infection_monkey/post_breach/timestomping/windows/timestomping.ps1" return f"powershell.exe {TIMESTOMPING_SCRIPT}"
# Commands' source: https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1070.006 # Commands' source: https://github.com/redcanaryco/atomic-red-team/blob/master/atomics/T1070.006

View File

@ -0,0 +1,3 @@
from PyInstaller.utils.hooks import collect_data_files
datas = collect_data_files("infection_monkey.post_breach", include_py_files=False)