Commit Graph

5761 Commits

Author SHA1 Message Date
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
Mike Salvatore 0b953c8cff agent: Remove ransomware/utils.py
The code for getting files to encrypt has become so trivial that it no
longer warrants a separate function outside of _find_files().
2021-06-22 13:23:14 -04:00
Mike Salvatore 5c1902ca73 agent: Add file_extension_filter to dir_utils 2021-06-22 13:17:11 -04:00
Mike Salvatore cf2cdc4ab8 agent: Add filter_files() function to dir_utils 2021-06-22 13:16:53 -04:00
Mike Salvatore bfc86041ab agent: Switch get_all_files_in_directory from str to Path
Path and PurePath objects provide a lot of syntactic sugar to file
handling that makes the code clearer and more concise.
2021-06-22 12:58:03 -04:00
Mike Salvatore e2dfd6a5e3 agent: Simplify get_all_files_in_directory() with list comprehension 2021-06-22 12:15:03 -04:00
Shreya efef40edf9 tests: Fix ransomware tests and move tests for get_all_files_in_directory from ransomware/test_utils.py to utils/test_dir_utils.py 2021-06-22 20:07:38 +05:30
Shreya a2ebe3386f agent: Rename utils/file_utils.py to utils/dir_utils.py 2021-06-22 20:02:59 +05:30
Shreya 5f714e0d98 agent: Move get_all_files_in_directory() from ransomware/utils.py to utils/file_utils.py 2021-06-22 19:45:50 +05:30
Shreya c6da73ad79 agent: ransomware: Incorporate changes into stub 2021-06-22 19:42:50 +05:30
Shreya 48967a2e5b tests: Modify unit tests for ransomware utils to test for a file like file.jpg.zip 2021-06-22 19:30:44 +05:30
Shreya 8abb9d95ce agent: ransomware: Move VALID_FILE_EXTENSIONS_FOR_ENCRYPTION to separate file 2021-06-22 19:30:44 +05:30
Shreya f8c1886977 tests: Add unit tests for ransomware utils - get_files_to_encrypt(), get_all_files_in_directory() 2021-06-22 19:30:44 +05:30
Shreya 3192355f5a agent: ransomware: Return list instead of filter object when getting files in directory 2021-06-22 19:30:44 +05:30