Commit Graph

5367 Commits

Author SHA1 Message Date
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
Shreya 5b64ea5151 agent: ransomware: Iterate through files in directory and get list of files to encrypt 2021-06-22 19:30:44 +05:30
Mike Salvatore 901485c9e4 Disable codecov annotations in pull requests 2021-06-22 10:00:23 -04:00
Mike Salvatore ccc3557021
Merge pull request #1255 from guardicore/ransomware_stub
Adds ransomware stub
2021-06-22 09:59:14 -04:00
VakarisZ 947a03c9a1 Refactor ransomware configuration option from flattened to a dict that encompasses any ransomware options 2021-06-22 16:42:09 +03:00
VakarisZ 63901bcd26 Refactor ransomware payload __init__.py into ransomware_payload.py with a stubbed ransomware payload class 2021-06-22 16:37:44 +03:00
VakarisZ d7f4035884 Adds ransomware entrypoint in monkey and logs values provided in ransomware configuration options 2021-06-22 10:39:02 +03:00
VakarisZ 00edb17b86 Adds ransomware page to the configuration UI 2021-06-22 10:35:21 +03:00
VakarisZ 9ef4ce8bac Fixes formatting and naming for ransomware configuration options 2021-06-22 09:47:11 +03:00
VakarisZ 1ede7ebaec Adds ransomware configuration options to monkey configuration 2021-06-22 09:14:29 +03:00
Mike Salvatore a715894220
Merge pull request #1256 from guardicore/secure-file-permissions-contextmanager
Secure file permissions contextmanager
2021-06-21 14:04:07 -04:00
Mike Salvatore 02ed22bab7 island: Remove FILE_SHARE_WRITE from windows permissions
Granting FILE_SHARE_WRITE on mongo_key.bin is unnecessary. Since
mongo_key.bin is the only file that is created using
_get_file_descriptor_for_new_secure_file_windows() at the moment, we
won't grant FILE_SHARE_WRITE.
2021-06-21 14:00:30 -04:00
Mike Salvatore 4d4dbc1dff
Merge pull request #1257 from guardicore/swimm-verify-system-info-collector
Swimm: update exercise Add a new System Info Collector (id: OwcKMnALpn7tuBaJY1US)
2021-06-21 13:28:29 -04:00
Shreya d908b183f5 Swimm: update exercise Add a new System Info Collector (id: OwcKMnALpn7tuBaJY1US).
Modify snippet in monkey_island/cc/services/config_schema/monkey.py to only hide HOSTNAME_COLLECTOR instead of the whole import statement block
2021-06-21 22:40:37 +05:30
Mike Salvatore 3b3ce2f86e Swimm: update exercise Add a new System Info Collector (id: OwcKMnALpn7tuBaJY1US). 2021-06-21 11:19:43 -04:00
Mike Salvatore 2d18a68787 island: Fix return type hint for _get_null_value_for_win32()
The _get_null_value_for_win32() function does not return None, it
returns a PyHANDLE object. For the moment, I'm unable to determine the
correct way to import PyHANDLE so that it can be specified in the type
hint. Since type hints aren't actually enforced, it's not worth the
effort to fully solve this at the present time, so the type hint has
just been removed.
2021-06-21 10:40:09 -04:00
Mike Salvatore 51aa0d1564 island: Refactor get_file_descriptor_for_new_secure_file as contextmgr
get_file_descriptor_for_new_secure_file() has been refactored as a
contextmanager. Additionally, it has been renamed to
open_new_securely_permissioned_file(). The function can now be used
similarly to open().

Example:

with open_new_securely_permissioned_file(file_path, "wb") as f:
    f.write(data)
2021-06-21 10:40:08 -04:00
Mike Salvatore b39440e871 island: Return a fd instead of PyHandle during windows file creation
Fixes #1252
2021-06-21 09:20:58 -04:00
Mike Salvatore d3d34fe2d6
Merge pull request #1254 from guardicore/windows-data-dir-inheritance
island: Add inheritance when setting Windows file or dir permissions
2021-06-21 09:07:28 -04:00
shreyamalviya ec2fb182de tests: Modify test_file_utils.py to check for inheritance when creating secure file/dir on Windows 2021-06-21 14:02:40 +05:30
VakarisZ 84868b29ef Adds ransomware section to island's configuration schema 2021-06-21 10:56:44 +03:00
Mike Salvatore 1d22de41a8 Remove training whitespace from README.md 2021-06-20 09:15:57 -04:00
Mike Salvatore 9d323c194c Remove job post from README.md 2021-06-20 09:14:34 -04:00
shreyamalviya 0ded39bb62 island: Add inheritance when setting Windows file or dir permissions
Add container and object inheritance to the ACE's security descriptor
when setting Windows permissions
2021-06-18 20:11:33 +05:30
VakarisZ cfdf1183f5 Fix invalid handle for mongo key file error by using the filename instead 2021-06-18 12:30:46 +03:00
Mike Salvatore 13ed6b2f3a docs: Minor formatting change to docker setup 2021-06-17 20:08:28 -04:00
Ilija Lazoroski b586bc5624 Added troubleshooting section to infection monkey readme and monkey_island readme. 2021-06-16 06:57:40 -04:00
Ilija Lazoroski ef3cbe51cf Added altpgraph to the Pipfile. 2021-06-15 14:53:30 -04:00
Mike Salvatore 78e9b8ce33
Merge pull request #1232 from guardicore/secure-mongo-key-file
Create mongo key file securely
2021-06-15 13:17:26 -04:00
Mike Salvatore 44bdfa5508 island: Rename create_secure_file tests
create_secure_file() was previously renamed to
get_file_descriptor_for_new_secure_file().
2021-06-15 13:14:31 -04:00
Mike Salvatore 327ff7a626 island: Remove isfile() check from get_file_descriptor_for_new_secure_file()
get_file_descriptor_for_new_secure_file() should return a file
descriptor. If the file already exists, this function would return
nothing, potentially causing issues with whatever relies on this
function's output.
2021-06-15 13:12:18 -04:00
Shreya 80bfd90074 island: Specify mode to open new secure file in, in encryptor.py 2021-06-15 19:29:49 +05:30
Shreya 64ac1fe706 island: Add type hinting in file_utils.py 2021-06-15 19:24:55 +05:30
Shreya 22c3c5a11b tests: Fix secure file creation tests as per latest changes 2021-06-15 19:24:50 +05:30
Shreya 37889d0b87 island: Extract code to `_get_null_value_for_win32()` in file_utils.py 2021-06-15 19:10:28 +05:30
Shreya b648452b5f island: Fix comment and statement formatting in file_utils.py 2021-06-15 19:10:28 +05:30
Shreya 14371f3fba island: Return file descriptor when creating secure file 2021-06-15 19:10:28 +05:30
Mike Salvatore 6b4a0906c0 island: use constants for permissions mode in test_file_utils.py 2021-06-15 09:31:22 -04:00
Mike Salvatore 8b2c3ef8a3 island: Remove execute bit from "secure" file creation 2021-06-15 09:29:18 -04:00
Shreya e90bf52674 island: Use `Path().touch()` instead of `os.open()` when securely creating a file on Linux 2021-06-15 15:51:02 +05:30
shreyamalviya e01165403a island, tests: Run isort and black on previously changed files 2021-06-15 12:51:10 +05:30
shreyamalviya 5abcadc69a tests: Move tests from test_utils.py to test_file_utils.py 2021-06-15 12:47:34 +05:30
shreyamalviya b5f092a85c island: Move code from cc/environment/utils.py to cc/server_utils/file_utils.py 2021-06-15 12:46:18 +05:30
shreyamalviya 91873343dd tests: Add comment to `test_create_secure_directory__perm_windows()` explaining when it fails 2021-06-15 12:26:58 +05:30
shreyamalviya d7565fc515 island: Use stat.S_IRWXU in place of 0o700 in cc/environment/utils.py 2021-06-15 12:23:13 +05:30