Commit Graph

5774 Commits

Author SHA1 Message Date
Mike Salvatore 2ea5dc6ac7 tests: Add missing test_lib.dll
The .gitignore file prevents dlls from being added to git. Since this
isn't a real dll, but is only used for testing, we can add it anyway.
2021-06-23 09:57:27 -04:00
Mike Salvatore 9165737389 agent: Use larger chunk size in RansomwarePayload
The larger chunk size improves efficiency by reducing the number of
reads.
2021-06-23 09:42:12 -04:00
Mike Salvatore ae0dfec3cc agent: Return results from RansomwareBitflipEncryptor.encrypt_files() 2021-06-23 09:37:33 -04:00
Mike Salvatore f1a365def2 agent: Add unit test for RansomwareBitflipEncryptor 2021-06-23 09:19:46 -04:00
Mike Salvatore 707b40608a tests: Extract ransomware target files to ransomware_target_files.py 2021-06-23 09:08:36 -04:00
Mike Salvatore d99811f83f tests: Move ransomware_target() fixture to ransomware/conftest.py 2021-06-23 09:04:24 -04:00
Mike Salvatore 45ba743418 tests: Move hash_file() into tests/utils.py 2021-06-23 09:01:42 -04:00
Mike Salvatore ab40518881 agent: Extract bitflip encryption into its own class 2021-06-23 08:56:12 -04:00
Mike Salvatore 2c97d04673 Agent: Don't run ransomware payload if no directory was specified 2021-06-23 08:34:09 -04:00
Mike Salvatore 7149e112b0 agent: Remove dirs_exist_ok from shutil.copytree() call
The dirs_exist_ok parameter of shutil.copytree() was introduced in
Python 3.8. Since the agent uses python3.7 in order to be more
compatible with older systems, we can't use this parameter.
2021-06-23 08:14:34 -04:00
Mike Salvatore 6307606010 Remove get_files_to_encrypt from Vulture's allow list 2021-06-23 07:14:57 -04:00
Mike Salvatore 297adcf015 agent: Don't redefine EXTENSION in ransomware tests 2021-06-23 07:10:55 -04:00
Mike Salvatore 447138c079 agent: Rename RansomewarePayload.target_dir -> _target_dir 2021-06-23 06:57:31 -04:00
Mike Salvatore cef3bd618d agent: Test that ransomware payload does not encrypt recursively 2021-06-23 06:57:31 -04:00
Mike Salvatore 2dd75d7d0c agent: Rename files encrypted by ransomware with .m0nk3y extension 2021-06-23 06:57:31 -04:00
Mike Salvatore 1ff348d2fc agent: Add in-place, bitflip encryption to RansomwarePayload 2021-06-23 06:57:31 -04:00
Mike Salvatore 3edaffa922 agent: Add utility functions for flipping bits 2021-06-23 06:57:31 -04:00
Mike Salvatore 2b1ba994a4 agent: Remove errant "f" in format string 2021-06-23 06:55:35 -04:00
Mike Salvatore 8226512340
Merge pull request #1263 from guardicore/ransomware-ignore-links
Ransomware ignore links
2021-06-23 06:41:47 -04:00
Mike Salvatore b35670eadb Merge branch 'ransomware-iterate-files' into develop 2021-06-23 06:41:07 -04:00
ilija-lazoroski 8ee1ce6706 agent: Update unit test for build_monkey_commandline
Co-authored-by: Mike Salvatore <mike.s.salvatore@gmail.com>
2021-06-23 11:22:38 +02:00
ilija-lazoroski b65b26e856 agent: Join monkey cmdline for log
Co-authored-by: Mike Salvatore <mike.s.salvatore@gmail.com>
2021-06-23 11:22:38 +02:00
Ilija Lazoroski feaa7ee867 agent: Resolve empty space in build_monkey_commandline 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 5a871da26a agent: Move GUID import to other imports 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 8c7fe00182 agent: Rename monkey_options to monkey_cmd_args 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 680b1f54d0 agent: Add type hinting to commands 2021-06-23 11:22:38 +02:00
Ilija Lazoroski e93df01e69 agent: Remove logging in commands 2021-06-23 11:22:38 +02:00
Ilija Lazoroski a158665f2b agent: Change absolute path to full path in get_monkey_commandline_linux 2021-06-23 11:22:38 +02:00
Ilija Lazoroski af974fae70 agent: Modify unit test for commands 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 36a9e02181 agent: Replace f-strings with explicit conversion 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 5c5d96f79d agent: Remove unnecessary log 2021-06-23 11:22:38 +02:00
Ilija Lazoroski b93be212f4 Add name consistency for get_monkey_commandline 2021-06-23 11:22:38 +02:00
Ilija Lazoroski d76e69fffe Add commands unit test_get_monkey_cmd_lines_linux 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 9a3d015503 Add commands unit test_get_monkey_cmd_lines_windows 2021-06-23 11:22:38 +02:00
Ilija Lazoroski b1dd08b390 Add depth unit tests for test_build_monkey_commandline_explicitly 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 24bb79af6a agent: Convert unit test_commands to pytest 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 4d71ed42a5 Remove unnecessary unit test for build_monkey_commandline_explicitly 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 9fd27141f2 Resolved string templating in dropper and windows_upgrader. 2021-06-23 11:22:38 +02:00
Ilija Lazoroski 0517f3e06f Added string templating functions for infection monkey dropper. 2021-06-23 11:22:38 +02:00
VakarisZ f5ebd2d39a Fix a bug of incorrect access to ransomware config options in ransomware_payload.py 2021-06-23 11:48:24 +03:00
Mike Salvatore 2549f088d1 agent: Do not encrypt Windows shortcuts in ransomware simulation
In order to keep Infection Monkey safe for production environments, the
ransomware payload will explicitly ignore Windows shortcuts to prevent
important files from accidentally getting encrypted.
2021-06-22 15:27:48 -04:00
Mike Salvatore 41bf137ee4 agent: Add is_not_shortcut_filter()
Adds a filter that can be used with filter_files() to return only files
that are not Windows shortcuts.
2021-06-22 15:27:48 -04:00
Mike Salvatore 4eaa568479 agent: Do not encrypt symlinks in ransomware simulation
In order to keep Infection Monkey safe for production environments, the
ransomware payload will explicitly ignore symlinks to prevent important
files from accidentally getting encrypted.
2021-06-22 15:27:39 -04:00
Mike Salvatore 14845c659a agent: Add is_not_symlink_filter()
Adds a filter that can be used with filter_files() to return only files
that are not symlinks.
2021-06-22 15:27:33 -04:00
Mike Salvatore bfa640444e agent: Test filter_files() with multiple filters 2021-06-22 15:11:32 -04:00
Mike Salvatore 30f88ca319 agent: Refactor add_subdirs_to_dir in test_dir_utils.py 2021-06-22 14:07:31 -04:00
Mike Salvatore b643cd1edd agent: Reimplement get_all_regular_files_in_directory using filter_files 2021-06-22 13:49:17 -04:00
Mike Salvatore f33772060f agent: Rename get_all_files_in_directory()
Rename get_all_files_in_directory() ->
get_all_regular_files_in_directory(), as this name is more explicit
about exactly which files will be included in the function's output.
2021-06-22 13:46:03 -04:00
Mike Salvatore db8dfd9f17 agent: Refactor filter_files to accept a list of filters 2021-06-22 13:43:27 -04:00
Mike Salvatore a8ebe6ae76 agent: Replace self.config with self.target_dir in RansomewarePayload 2021-06-22 13:31:20 -04:00