Commit Graph

9090 Commits

Author SHA1 Message Date
Shreya Malviya 7a28ba4c4d Island: Create new resource `Configuration` 2022-06-22 07:35:18 -07:00
Mike Salvatore 1f00a13649 Island: Pass default agent configuration to repository constructor 2022-06-22 10:27:53 -04:00
Mike Salvatore 8e875143ac Project: Add `monkey/` to PYTHONPATH when running pytest
Without explicitly setting the python path, conftest.py can not find
common.*, monkey_island.*, or infection_monkey.*.
2022-06-22 10:27:53 -04:00
vakaris_zilius 8358253fc7 Agent: Rename depth to current_depth in propagation.py 2022-06-22 13:14:24 +00:00
vakaris_zilius f0029a0d82 Agent: Close inbound tunnel if one was opened 2022-06-22 13:13:32 +00:00
vakaris_zilius 27bff7e41c Island: Remove updating agent configuration with stolen credentials 2022-06-22 12:40:55 +00:00
vakarisz e15206101a Agent: Fix a bug in should_propagate 2022-06-22 14:42:19 +03:00
vakarisz 552e2100fa Agent: Set default depth cmd parameter to 0
If user runs the agent it should start with depth 0, because usually it means that it's running on the island
2022-06-22 14:33:47 +03:00
vakarisz 5a48bfcfcc Agent: Fix should_propagate import in automated_master.py 2022-06-22 14:15:24 +03:00
vakarisz 734fc80c92 Agent: Add logging message about maximum depth reached 2022-06-22 13:04:24 +03:00
vakarisz 582328bea8 Agent: Create and use should_propagate method
This method is used to determine if the inbound tunnel should be open and if the master should attempt exploiting other machines
2022-06-22 12:31:47 +03:00
vakarisz 3c2d58b5d3 Agent, Common: Add positive_int argument type 2022-06-22 11:52:36 +03:00
vakarisz 8df92640de Changelog: Add entry about changed behaviour of depth param 2022-06-22 11:28:46 +03:00
Mike Salvatore 05abc22ac0
Merge pull request #2037 from guardicore/repository-errors
Repository errors
2022-06-21 19:46:08 -04:00
Mike Salvatore f9775f5b54 Island: Improve directory traversal error message 2022-06-21 15:18:51 -04:00
Mike Salvatore 40b192accc Island: Wrap directory traversal errors in repository errors
A given `IFileRepository` may have no concept of directories.
`LocalStorageFileRepository` should wrap the ValueErrors raised to
prevent directory traversal in repository errors.
2022-06-21 15:18:51 -04:00
Mike Salvatore 21be5fc2be Island: raise RemovalError in Local...FileRepository.delete_all_files() 2022-06-21 15:18:51 -04:00
Mike Salvatore da1339e410 Island: Raise RemovalError in LocalStorageFileRepository.delete_file() 2022-06-21 15:18:51 -04:00
Mike Salvatore cd1481e4fe Island: Add monkey_island.cc.repository.RemovalError 2022-06-21 15:18:51 -04:00
Mike Salvatore 63404c7bed Island: Raise StorageError in LocalStorageFileRepository.save_file() 2022-06-21 15:18:51 -04:00
Mike Salvatore 3446dbf0aa Island: Export StorageError from monkey_island.cc.repository 2022-06-21 15:18:51 -04:00
Mike Salvatore f60c2f1dde Island: Add ValueError to IFileRepository docstring 2022-06-21 15:18:51 -04:00
Mike Salvatore 5c97d6bdbf UT: Add tests for AgentBinaryRepository 2022-06-21 15:18:17 -04:00
Mike Salvatore 185ac3dfa4
Merge pull request #2034 from guardicore/1960-file-retrieval-error-todo
1960 file retrieval error todo
2022-06-21 15:15:05 -04:00
Mike Salvatore 838a2e742c Island: Change can -> could in get_configuration() 2022-06-21 10:36:56 -04:00
Mike Salvatore 3bd977ed55 Island: Improve IFileRepository.open_file() docstring 2022-06-21 10:34:27 -04:00
Mike Salvatore c008db4cf2 Island: Raise RetrievalError in FileAgentConfigurationRepository 2022-06-21 09:40:00 -04:00
Mike Salvatore 4de9f3cb6d UT: Move OpenErrorFileRepository into tests/monkey_island 2022-06-21 09:35:23 -04:00
Mike Salvatore 47df257545 Island: Raise RetrievalError from IAgentBinaryRepository 2022-06-21 09:22:38 -04:00
Mike Salvatore 22b22c5f0a Island: Remove testing TODOs from PBAFile{Download,Upload} 2022-06-21 09:11:54 -04:00
Mike Salvatore 63a2527f3f UT: Add test_file_download_endpoint_500() for PBAFileUpload 2022-06-21 09:11:10 -04:00
Mike Salvatore 8939ca2106 UT: Extract open_error_flask_client into conftest.py 2022-06-21 09:11:10 -04:00
Mike Salvatore f973c9d6e9 UT: Extract MockFileRepository into its own module 2022-06-21 09:11:10 -04:00
Mike Salvatore bf2f58aace UT: Add __init__.py 2022-06-21 09:11:10 -04:00
Mike Salvatore bcc5265a99 UT: Add test_file_download_endpoint_500() for PBAFileDownload 2022-06-21 09:11:03 -04:00
Ilija Lazoroski 44795531b8 Island: Remove logging TODOs for pba_file upload/download
Resources should log the errors
2022-06-21 15:04:34 +02:00
Mike Salvatore cd34cd5eae Island: Add repository.FileNotFoundError 2022-06-21 08:49:36 -04:00
Mike Salvatore c424262f12 Island: Improve description of return value for get_configuration() 2022-06-21 08:22:47 -04:00
Ilija Lazoroski 3cb678ad32 Island: Raise distinct errors when openning a file
IFileRepository now distincts between file not found and a file that
could not be retrieved
2022-06-20 14:55:26 +02:00
vakarisz df77ca4f96 Agent: Change the logic of depth to represent current depth
Based on the previous logic the depth parameter represented hops remaining, not current depth.
2022-06-20 15:52:50 +03:00
VakarisZ b959763318
Merge pull request #2032 from guardicore/1960-flat-config-changes
Change config flattening logic to return new schema
2022-06-20 15:32:47 +03:00
vakarisz 3757e33180 UT: Use OperatingSystems enum instead of strings 2022-06-20 12:30:25 +03:00
vakarisz 0474e2a5f7 Island: Change json encoding to encode Enums to name string
Enum objects couldn't get encoded, so for each enum we had to decide whether the name or the value would be used to represent that enum value. Changing the encoding to name allows us to use enum object on the island without having to worry about encoding.
2022-06-20 12:27:01 +03:00
vakarisz c0f0d35f0b Island: Use OperatingSystems enum in config.py 2022-06-20 12:18:03 +03:00
Shreya Malviya 02dcee8bfc UT: Modify tests to pass with config flattening changes 2022-06-19 23:35:35 -07:00
Shreya Malviya ab23b3c9cb Island: Fix exploiters' `supported_os`'s capitalisation in config flattening 2022-06-19 23:13:14 -07:00
Shreya Malviya ba3af5a9c2 Island: Fix 'exploitation' field of config flattening 2022-06-19 23:13:14 -07:00
Shreya Malviya f9a7989f5e Island: Fix 'propagation' field of config flattening 2022-06-19 23:13:09 -07:00
Shreya Malviya 83dd4334b2 UT: Fix flat_config.json to match current config schema 2022-06-19 21:54:54 -07:00
vakarisz d393a0b3c6 Agent: Change credential collectors, payloads and pbas in flat config
Flat config changes are made in order for config object to be serializable
2022-06-19 20:22:42 -07:00