Commit Graph

5650 Commits

Author SHA1 Message Date
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
shreyamalviya 5ea046eda5 island: Format cc/environment/utils.py with black 2021-06-15 00:06:40 +05:30
shreyamalviya 443b66e9d9 tests: Remove accidental code in `_get_acl_and_sid_from_path()` in test_utils.py 2021-06-14 23:50:08 +05:30
shreyamalviya 1170b176d3 island: Fix Windows' secure file creation by using a different file flag 2021-06-14 23:41:56 +05:30
shreyamalviya 7ddb986f15 tests: Fix file creation unit tests in test_utils.py 2021-06-14 23:24:52 +05:30
shreyamalviya 1467a53e60 island: Use win32file.CloseHandle() to close file descriptor on Windows 2021-06-14 23:24:09 +05:30
shreyamalviya 37eda4e7ad island: Fix secure file creation on Windows 2021-06-14 23:15:17 +05:30
Ilija Lazoroski 0c6d0ed2a8 Removed quotes in deployment_scripts README for first argument of deploy_linux.sh. Related #1108. 2021-06-14 12:54:25 -04:00
kur1mi 5e14738a43 Update README.md in deployment _scripts 2021-06-14 10:02:06 -04:00
Shreya c0d9489100 tests: Extract duplicate code in Windows tests in test_utils 2021-06-14 17:59:57 +05:30
Shreya 6d360ef865 tests: Fix assertion in `test_create_secure_directory__perm_linux()` 2021-06-14 17:51:55 +05:30
Shreya 248d57789f tests: Add unit tests for securly creating a file 2021-06-14 17:50:40 +05:30
Shreya 5fe0c80377 island: Can't use `with` with `os.open()`, use `os.close()` to close file descriptor 2021-06-14 17:07:47 +05:30
Shreya 8b932e1946 island: Add os.O_EXCL flag so that an error is thrown if trying to create a file that exists 2021-06-14 16:49:24 +05:30
Shreya 8dd4bb5e17 island: Use 'x' instead of '_' when creating a secure file 2021-06-14 16:26:00 +05:30
Shreya 26ae50f90f island: Create mongo key file securely before using it 2021-06-14 13:21:45 +05:30
Shreya ff85360639 island: Add functions to create a file securely on Linux and Windows 2021-06-14 13:21:45 +05:30
Shreya 5d7d86aedc island: Modify log message when creating secure directory on Windows 2021-06-14 13:21:46 +05:30