Commit Graph

5934 Commits

Author SHA1 Message Date
Mike Salvatore 858eb2302c Agent: Rename os -> operating_system in caching_agent_repository
The variable name "os" conflicts with the name of Python's `os` library.
2022-06-24 07:23:26 -04:00
Mike Salvatore ffd3464d8a Agent: Move enum to string conversion to _download_binary_from_island() 2022-06-24 07:22:07 -04:00
Ilija Lazoroski e1d5d25e9c Agent: Use OperatingSystem.WINDOWS in Powershell 2022-06-24 11:18:39 +02:00
Ilija Lazoroski b605f16c4f Agent: Use == to compare OperatingSystems enum in Log4Shell 2022-06-24 11:11:19 +02:00
Ilija Lazoroski fb67586a4c Agent: Use OperatingSystems.value for urllib.parse.quote 2022-06-24 10:51:58 +02:00
Ilija Lazoroski d59dd81f43 Agent: Use OperatingSystems in CachingAgentRepository 2022-06-24 10:19:47 +02:00
Ilija Lazoroski f9445a2c76 Agent: Use == to compare OperatingSystems enum 2022-06-24 10:18:51 +02:00
Ilija Lazoroski 2ff2e5f597 Agent: Fix running of payloads 2022-06-24 08:33:21 +02:00
Mike Salvatore 6d156b8fee Island: Return config timeouts in seconds
The old config scheme stored timeouts as milliseconds, whereas the new
one uses seconds. Seconds are more convenient because most python
methods expecting timeouts are expecting floating-point seconds.
2022-06-23 16:55:10 -04:00
Mike Salvatore 05f640d487 Agent: Rename should_propagate -> maximum_depth_reached 2022-06-23 16:36:01 -04:00
Mike Salvatore ad0f6946bd Agent: Decouple should_propagate() and AgentConfiguration 2022-06-23 16:32:55 -04:00
Mike Salvatore afeca66d92 UT: Use AgentConfiguration in test_propagation.py 2022-06-23 16:27:05 -04:00
Mike Salvatore 5a95aef94c Agent: Remove unnecessary parameter 2022-06-23 15:57:11 -04:00
Mike Salvatore bff92ed7ad UT: Fix erroneously abbreviated fixture 2022-06-23 15:57:06 -04:00
Mike Salvatore 81d3300ec7 Agent: Remove print() that was added by mistake 2022-06-23 15:43:34 -04:00
Mike Salvatore 6e951ed65d UT: Remove supported_os from default_config.py
"supported_os" was removed from the schema in d079d74b
2022-06-23 14:56:24 -04:00
Mike Salvatore bba7139be6 Agent: Add missing return type hint to _try_communicate_with_island() 2022-06-23 14:51:35 -04:00
Mike Salvatore aff54232e9 Agent: Remove redundant call to control_channel.get_config() 2022-06-23 14:51:35 -04:00
vakaris_zilius 0f848eb284 Agent: Usa agent config object instead of dict should_propagate 2022-06-23 14:51:35 -04:00
vakaris_zilius ab67853192 Agent: Usa agent config object instead of dict automated_master.py 2022-06-23 14:51:35 -04:00
vakaris_zilius 86ed174d74 Agent: Usa agent config object instead of dict in option_parsing.py 2022-06-23 14:51:35 -04:00
vakarisz 9286e86900 Agent: Use deserialized in exploiter.py and propagator.py 2022-06-23 14:51:31 -04:00
vakarisz 095e49b543 Agent: Use deserialized config in automated_master.py 2022-06-23 14:47:08 -04:00
vakarisz ffe8c3451b Agent: Change scanners to use the config object 2022-06-23 14:47:08 -04:00
vakarisz 6b406ef686 Agent: Change configuration to object in control channel 2022-06-23 14:47:08 -04:00
vakarisz e83995d962 UT: Add a new fixture for config object 2022-06-23 14:47:08 -04:00
vakarisz d8ac441c59 Agent: Fix configuration retrieval in _run_simulation 2022-06-23 14:47:08 -04:00
vakarisz 77804caab5 Agent: Add from_dict method to AgentConfiguration
Creating AgentConfiguration object from dictionary makes sense because it doesn't couple the configuration to any specific serialization methods. Also, the json sent from the island doesn't match the config structure because it stores config in a dict under "config" key.
2022-06-23 14:47:08 -04:00
Mike Salvatore d079d74b2c Merge branch '2000-configuration-resource' into 1960-configuration-object
PR #2038
2022-06-23 11:46:13 -04:00
Ilija Lazoroski 1ae3bd4b4f UT: Rename InMemoryFileAgentConfigurationRepository to
InMemoryAgentConfigurationRepository
2022-06-23 17:15:50 +02:00
Ilija Lazoroski 42c4803376 Island: Use schema.loads in AgentConfiguration POST method 2022-06-23 08:12:54 -07:00
Ilija Lazoroski d7329ea839 UT: Add tests for AgentConfiguration resource 2022-06-23 08:12:54 -07:00
Ilija Lazoroski b35832b9dd UT: Add InMemoryFileAgentConfigurationRepository 2022-06-23 08:12:54 -07:00
Ilija Lazoroski 891794d927 Island: Add AgentConfiguration resource to app.py 2022-06-23 08:12:54 -07:00
Ilija Lazoroski 39e4180dfe Island: Use make_response in GET agent_configuration 2022-06-23 08:12:54 -07:00
Ilija Lazoroski 48fab89e11 Island: Rename configuration.py to agent_configuration.py
Per convention it must match class name
2022-06-23 08:12:54 -07:00
Shreya Malviya 452028f221 UT: Replace Hadoop with MSSQL in test data
Previously, in the UT data, Hadoop had only windows in the
"supported_os" field in the config. Now that that field is stripped out
from the config, the supported OSes are picked up from the main code
(from `SUPPORTED_OS` in the master's `Exploiter` class) which has both
winodws and linux for Hadoop. This caused the tests to fail.

This commit changes the UT data to include the MSSQL exploiter (windows
only) instead of the Hadoop exploiter. The tests pass now.
2022-06-23 08:10:56 -07:00
vakarisz 68c27969d3 Agent: Fix a bug in incompatible os check
web_rce.py checks for incompatible OS on the victim. Bug was that it checked linux twice instead of linux and windows
2022-06-23 16:30:38 +03:00
vakaris_zilius 717801e9ad Agent: Add telemetry json encoder
Telemetry json encoder is needed to encode OperatingSystems enums when sending back telemetries
2022-06-23 11:51:25 +00:00
vakarisz 77f8be523c UT: Use operating systems consts 2022-06-23 11:51:21 +00:00
vakarisz 4c1c8044cd Agent: Use operating systems consts 2022-06-23 11:51:17 +00:00
Shreya Malviya 1fc0eae480 UT: Change import order in conftest.py 2022-06-22 09:35:46 -07:00
Shreya Malviya 104c7ac210 Island: Fix function call to load config in new configuration resource 2022-06-22 09:10:47 -07:00
Shreya Malviya e25eb194a1 UT: Remove `supported_os` for exploiters from all tests 2022-06-22 09:10:47 -07:00
Shreya Malviya fd41d9179e Agent: Add `SUPPORTED_OS` dict for exploiters and change checking logic in master 2022-06-22 09:10:41 -07:00
Shreya Malviya 26ece213a2 Island: Remove logic to add `supported_os` for exploiters to configuration 2022-06-22 09:07:02 -07:00
Shreya Malviya 03037b5662 Common: Remove `supported_os` field for exploiters in configuration 2022-06-22 09:06:35 -07:00
Mike Salvatore 665f7e4adf Merge branch 'fix-depth-logic' into 1960-configuration-object 2022-06-22 11:20:01 -04:00
Shreya Malviya 142eed72ac Island: Remove logic to remove/add config metadata in new configuration resource 2022-06-22 08:12:09 -07:00
Mike Salvatore eeba0e0616 UT: Add tests for should_propagate 2022-06-22 10:59:46 -04:00
Shreya Malviya ec710d9e5f Island: Get rid of ResponseContents and ImportStatuses in new configuration resource 2022-06-22 07:48:34 -07:00
Mike Salvatore 1199c72f0d Island: Modify skipping propagation log message 2022-06-22 10:44:02 -04:00
vakarisz 8d2078048c Agent: Change the positive_int definition to contain 0 2022-06-22 17:39:25 +03:00
Shreya Malviya d861def86c Island: Add logic to add metadata to config in new configuration resource's GET 2022-06-22 07:35:19 -07:00
Shreya Malviya 922495785c Island: Create class variable for agent config schema in new configuration resource 2022-06-22 07:35:19 -07:00
Shreya Malviya 6b45d62d81 Island: Fix logic to remove metadata from config in new configuration resource's POST 2022-06-22 07:35:19 -07:00
Shreya Malviya 32fe7c6a4b Island: Remove unneeded fields from `ResponseContents` in new configuration resource 2022-06-22 07:35:19 -07:00
Shreya Malviya 63d5330386 Island: Remove unneeded patch function in new configuration resource 2022-06-22 07:35:19 -07:00
Shreya Malviya 00e38391b4 Island: Catch appropriate `marshmallow` error when loading config which could be invalid, in new configuration resource 2022-06-22 07:35:19 -07:00
Shreya Malviya 15615e08c4 Island: Get rid of unsafe config options' check in new configuration resource 2022-06-22 07:35:19 -07:00
Shreya Malviya 8c14423c4e Island: Prepend 'agent' to everything having 'configuration' in new configuration resource 2022-06-22 07:35:19 -07:00
Shreya Malviya 0d8cc713d2 Island: Rename `file_agent_configuration_repository` to `agent_configuration_repository` in new configuration resource 2022-06-22 07:35:19 -07:00
Shreya Malviya 74bc55e077 Island: Remove config type logic from new configuration resource 2022-06-22 07:35:19 -07:00
Ilija Lazoroski 5f253e79b3 Island: Init Configuration resource 2022-06-22 07:35:18 -07:00
Shreya Malviya 138480f021 Island: Roughly implement POST in new Configuration resource
+ lots of questions
2022-06-22 07:35:18 -07:00
Shreya Malviya 5dd27eeea5 Island: Add definition for GET in new Configuration resource 2022-06-22 07:35:18 -07:00
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
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
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 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 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
Mike Salvatore b99ad70774 Island: Add StorageError 2022-06-17 19:56:09 -04:00
Mike Salvatore cb7dae28bf Island: Add a docstring for RetrievalError 2022-06-17 19:55:47 -04:00
Mike Salvatore 58733f7572
Merge pull request #2031 from guardicore/1960-configuration-repository
1960 configuration repository
2022-06-17 19:44:09 -04:00
Mike Salvatore 58ea11ae9f Common: Move DEFAULT_AGENT_CONFIGURATION to its own file 2022-06-17 19:16:19 -04:00
Mike Salvatore e4a2a04765 UT: Remove duplicate SingleFileRepository
This was added by mistake. Remove it!
2022-06-17 19:14:38 -04:00
Mike Salvatore d3a03d2653 Agent: Remove disused constants 2022-06-17 13:11:47 -04:00
Mike Salvatore e730695407 Agent: Remove disused Configuration class 2022-06-17 13:11:30 -04:00
Mike Salvatore 764bc1559b Island: Add IAgentConfigurationRepository to the DIContainer 2022-06-17 13:08:22 -04:00
Mike Salvatore 45168b5ba7 Island: Return default configuration from get_configuration() 2022-06-17 12:56:55 -04:00
Mike Salvatore a3e3e3e324 Common: Add DEFAULT_AGENT_CONFIGURATION 2022-06-17 12:48:54 -04:00
Mike Salvatore 9a216e9c3d Island: Add "raises" to docstring in get_configuration() 2022-06-17 12:17:22 -04:00
Mike Salvatore 922cb8cea9 Island: Add RetrievalError 2022-06-17 12:17:21 -04:00
Mike Salvatore 30065952a5 Island: Add RetrievalError 2022-06-17 12:13:18 -04:00
Mike Salvatore 73ead3bb26 Island: Rename set_configuration() -> store_configuration() 2022-06-17 12:10:43 -04:00
Mike Salvatore bdce5f84a6 Island: Add FileAgentConfigurationRepository 2022-06-17 12:09:30 -04:00
Mike Salvatore 5ebdb60ea4 Island: Add @abstractmethod in IAgentConfigurationRepository 2022-06-17 11:41:29 -04:00
Mike Salvatore a75041e93f Island: Rename IConfigurationRepository IAgentConfigurationRepository 2022-06-17 11:36:50 -04:00
Mike Salvatore 7cb7f7ab5a UT: Extract agent configuration from test_agent_configuration.py 2022-06-17 11:33:01 -04:00
Mike Salvatore ace3eb8718 UT: Extract SingleFileRepository from test_pba_file_upload.py 2022-06-17 11:19:11 -04:00
Mike Salvatore 91476a7a06 Island: Protract config -> configuration in IConfigurationRepository 2022-06-17 11:11:14 -04:00
Mike Salvatore 59e29456c0 Island: Rename i_config_repository.py -> i_configuration_repository.py 2022-06-17 11:10:16 -04:00
Mike Salvatore ae0c440603 Island: Add documentation for IConfigRepository 2022-06-17 11:08:45 -04:00
Mike Salvatore 62056175a1 Island: Remove unneeded methods in IConfigRepository
Also remove stale comments. No encryption is needed here because
configuration does not contain anything sensitive.
2022-06-17 11:06:23 -04:00
Mike Salvatore 84db00b728 Island: Use AgentConfiguration in IConfigRepository 2022-06-17 11:05:10 -04:00
Mike Salvatore f25a81635c
Merge pull request #2030 from guardicore/1960-configuration-schema
1960 configuration schema
2022-06-17 10:31:56 -04:00
Mike Salvatore ed39d155bf Common: Remove sub-configuration and sub-schemas from configuration 2022-06-17 10:23:43 -04:00
Mike Salvatore 291b82c28d Common: Separate agent sub configurations and schemas 2022-06-17 10:20:49 -04:00
vakarisz f8855d290d Agent: Remove WormConfiguration and cleanup related infrastructure 2022-06-17 16:40:40 +03:00
Mike Salvatore e0ae109368 Common: Add AgentConfiguration 2022-06-17 09:27:51 -04:00
Mike Salvatore 7039ccf708 Common: Switch configuration timeouts from ms to floating-point seconds 2022-06-17 09:14:22 -04:00
Mike Salvatore bd7ea7fdb1 Common: Add maximum_depth to PropagationConfiguration 2022-06-17 09:07:13 -04:00
Mike Salvatore a41b2e3ea4 Common: Add PropagationConfiguration 2022-06-17 09:04:00 -04:00
Mike Salvatore 9bbf5c8ae7 Common: Add NetworkScanConfiguration 2022-06-17 08:50:48 -04:00
Mike Salvatore 5845bb73af Common: Reorder scan and exploit configuration classes 2022-06-17 08:33:43 -04:00
Mike Salvatore 3c879f444d Common: Add ScanTargetConfigurationSchema 2022-06-17 08:30:42 -04:00
Mike Salvatore 7e9c481992 Common: Rename marshmallow post_load methods to be protected 2022-06-17 08:22:31 -04:00
Mike Salvatore ee8e949a0d Common: Add ICMPScanConfigurationSchema 2022-06-17 08:20:26 -04:00
Mike Salvatore 0b810f5d56 Common: Add TCPScanConfigurationSchema 2022-06-17 08:14:35 -04:00
vakarisz 2e561181ea Common: Add TCPScanConfiguration dataclass to agent_configuration.py 2022-06-17 15:10:46 +03:00
vakarisz af761ea48f Common: Add ICMPScanConfiguration dataclass to agent_configuration.py 2022-06-17 15:10:45 +03:00
vakarisz 969f916cf5 Common: Add ScanTargetConfiguration dataclass to agent_configuration.py 2022-06-17 15:10:43 +03:00
Mike Salvatore e8001d8cf7
Merge pull request #2027 from guardicore/register-di-conventions
Register di conventions
2022-06-17 07:33:33 -04:00
Mike Salvatore 42f0cb42d2 UT: Use container fixture in test_unregistered_type 2022-06-17 07:25:18 -04:00
Mike Salvatore a18814a83b Common: Fix incorrect docstring in DIContainer 2022-06-17 07:16:50 -04:00
Mike Salvatore df23cc42f4
Common: Fix spelling error
Co-authored-by: VakarisZ <36815064+VakarisZ@users.noreply.github.com>
2022-06-17 07:13:07 -04:00
Mike Salvatore 4065bc23fb Common: Add ExploitationConfiguration 2022-06-16 20:20:35 -04:00
Mike Salvatore db9d57a526 Common: Remove `class Meta` from marshmallow schemas
`RAISE` is the default behavior, so there's no need to copy/paste this
all over the place.
2022-06-16 20:20:35 -04:00
Mike Salvatore afd3160c2f Common: Add ExploitationOptionsConfiguration 2022-06-16 20:20:35 -04:00
Mike Salvatore 70e8bca1ea Common: Use OperatingSystems enum in ExploiterConfigurationSchema 2022-06-16 20:20:35 -04:00
unknown 737aacf0bd Agent: Add marshmallow-enum to dependencies 2022-06-16 20:20:35 -04:00
unknown 526fe24aa6 Island: Add marshmallow-enum to dependencies 2022-06-16 20:20:35 -04:00
Mike Salvatore 39e18b9c73 Common: Add OperatingSystems enum
Enough is enough! I have had it with these monkey-fighting strings on
this Monday to Friday plane! Everybody strap in.

Seriously, it's time to stop using strings all over the place to
identify the OS. An Enum is a better, more strongly-typed solution.
2022-06-16 20:20:35 -04:00
Mike Salvatore 9d73252ff5 Common: Add ExploiterConfiguration 2022-06-16 20:20:35 -04:00
Mike Salvatore 88dbf4feb7 Common: Use Dict instead of dict in PluginConfiguration 2022-06-16 20:20:35 -04:00
Mike Salvatore bdad41057c Common: Add CustomPBAConfiguration 2022-06-16 20:20:35 -04:00
Mike Salvatore c79f62e682 Common: Add PluginConfiguration 2022-06-16 20:20:35 -04:00
unknown 660c1421c0 Agent: Add marshmallow to dependencies 2022-06-16 20:20:35 -04:00
unknown f9f5861ae3 Island: Add marshmallow to dependencies 2022-06-16 20:20:35 -04:00
Mike Salvatore 1f1c5585f0 Island: Remove HTTP_PORTS from top-level agent configuration
Resolves #2028
2022-06-16 20:19:56 -04:00
Mike Salvatore 5db04c3580 Island: Register the data directory as a convention 2022-06-16 09:26:04 -04:00
Mike Salvatore c53864cdd7 Common: Add release_convention() 2022-06-16 09:26:04 -04:00
Mike Salvatore 8fb97fc8c0 Common: Remove posessive from release()'s docstring 2022-06-16 09:26:04 -04:00
Mike Salvatore c3789c4766 Common: Document dependency resolution precedence 2022-06-16 09:26:04 -04:00
Mike Salvatore ab94ddeb88 Commmon: Add register_convention() 2022-06-16 09:26:02 -04:00
vakarisz 0082cd2193 Island: Style improvements in ip_addresses.py 2022-06-16 15:46:08 +03:00
vakarisz 5fbe01a32e Island: Display tunneling ports in T1065
Non standard ports attack technique should include ports agent used for tunneling
2022-06-16 12:11:55 +03:00
Mike Salvatore 6345780182 Common: Add UnregisteredConventionError 2022-06-15 21:02:04 -04:00
Ilija Lazoroski 136747b1c8 Island: Use tunnel or island port in T1065
* adds get_tunnel_info in monkey model
2022-06-15 17:45:07 +03:00
Ilija Lazoroski ed3c369eef Island: Rename local-ips resource to ip-addresses 2022-06-15 17:45:07 +03:00
Ilija Lazoroski 8ae6bb8c73 UI: Remove testing from InternalConfig
* leftover from renaming credential_classes
2022-06-15 17:45:07 +03:00
Ilija Lazoroski 7b415be883 UT: Fix island config tests 2022-06-15 17:45:07 +03:00
Ilija Lazoroski 8af665c0a8 UI: Use local_ips endpoint to get command_servers 2022-06-15 17:45:07 +03:00
Ilija Lazoroski d76fad9e17 Island: Remove current_server and command_servers from config
* It removes whole island_server section from internal config
2022-06-15 17:45:07 +03:00
Ilija Lazoroski 9444f1a9d7 Island: Add local_ips resource 2022-06-15 17:45:07 +03:00
Mike Salvatore ac172dc81f
Merge pull request #2024 from guardicore/2019-mssql-batch-cleanup
Remove temporary "payload" file in MSSQL exploiter
2022-06-15 10:25:38 -04:00
Mike Salvatore 353594f505
Merge pull request #2021 from guardicore/mssql-method-improvements
MSSQL method improvements
2022-06-15 10:25:10 -04:00
Mike Salvatore 4e71f4b6e4 Agent: Improve MSSQL command logging 2022-06-15 08:45:56 -04:00
Mike Salvatore 95acfc36ad Agent: Remove MSSQL temporary file and directory
This temporary file was only needed when commands were subject to 128
character limit. Writing commands to a batch file and executing it was a
way to run larger commands. Now that we know single quotes circumvent
this limit, the temporary file and directory are no longer necessary.
2022-06-15 08:37:54 -04:00
Mike Salvatore f9b3d7f5eb Agent: Move agent server methods within MSSQLExploiter 2022-06-15 08:33:18 -04:00
Mike Salvatore c2170ffc4a Agent: Rename run_agent() -> _run_agent() 2022-06-15 08:32:30 -04:00
Mike Salvatore e73c9307bf Agent: Add missing type hints to MSSQLExploiter 2022-06-15 08:16:32 -04:00
Mike Salvatore 7aca587964 Agent: Replace references to "monkey" with "agent" in MSSQLExploiter 2022-06-15 08:16:26 -04:00
Mike Salvatore 79fbd8b600 Agent: Remove stale comment 2022-06-15 08:15:49 -04:00
Mike Salvatore 339619cc56 Agent: Move _brute_force() 2022-06-15 08:15:49 -04:00
Mike Salvatore 04460e1d44 Agent: Encapsulate "monkey server" details in _upload_monkey() 2022-06-15 08:15:49 -04:00
Mike Salvatore 0204ba6343 Agent: Prefix protected methods in MSSQLExploiter with "_" 2022-06-15 08:15:49 -04:00
Mike Salvatore fd0a197b7f
Merge pull request #2020 from guardicore/2018-mangled-mssql-dropper-command
2018 mangled mssql dropper command
2022-06-15 08:15:22 -04:00
Mike Salvatore 62cc401981 Agent: Add a comment about escaping single quotes in SQL 2022-06-15 08:14:29 -04:00
Mike Salvatore 8d9a2c536f Agent: Reorder methods in MSSQLExploiter 2022-06-14 14:22:43 -04:00
Mike Salvatore 819262ef73 Agent: Remove disused "Payload" classes 2022-06-14 14:22:43 -04:00
Mike Salvatore a54eca96ba Agent: Remove disused MSSQLLimitedSizePayload 2022-06-14 14:22:43 -04:00
Mike Salvatore 0e2a63b6ac Agent: Remove disused run_mssql_commands() 2022-06-14 14:22:43 -04:00
Mike Salvatore ff83f41b4a Agent: Remove disused run_mssql_command() 2022-06-14 14:22:43 -04:00
Mike Salvatore 522e62ad14 Agent: Refactor MSSQL create directory commands
Use _run_mssql_command() and remove the dependency on
MSSQLLimitedSizePayload.
2022-06-14 14:22:43 -04:00
Mike Salvatore 7b356cf893 Agent: Refactor MSSQL run payload file commands
Use _run_mssql_command() and remove the dependency on
MSSQLLimitedSizePayload.
2022-06-14 14:22:43 -04:00
Mike Salvatore f349e1a334 Agent: Refactor MSSQL run agent commands
Remove the dependency on the MSSQLLimitedSizePayload and use simple
methods like "_write_command_to_batch_file()".
2022-06-14 14:22:43 -04:00
Mike Salvatore b2aa8333c3 Agent: Refactor MSSQL cleanup commands
* Simplify!
    * Remove the dependency on MSSQLLimitedSizePayload.
    * Use f-strings
2022-06-14 14:22:43 -04:00
Mike Salvatore 257c6b0b05 Agent: Refactor MSSQL agent download command
The first step in exploitation is to instruct the victim to download the
agent. This commit refactors this code to remove the dependency on the
MSSQLLimitedSizePayload. To do this, it introduces
`_write_command_to_batch_file()` which will be reused by the agent
execution command.
2022-06-14 14:22:43 -04:00
Mike Salvatore 7846a6cac1 Agent: Remove create_empty_payload_file() in MSSQLExploiter
Since the commands are no longer split up into 128 character chunks,
it's simpler to just overwrite an existing file using `>` than to create
an empty file and append to it.
2022-06-14 14:22:43 -04:00
Mike Salvatore ea980c4594 Agent: Use PureWindowsPath in MSSQLExploiter
When using PurePath, Linux agents use the wrong path separator to build
Windows paths. Windows corrects this, so there's no actual issue, but
it's sloppy. Using PureWindowsPath objects creates the paths with the
correct separators

Before: xp_cmdshell "NUL>%temp%\tmp_monkey_dir/tmp_monkey.bat"
After: xp_cmdshell "NUL>%temp%\tmp_monkey_dir\tmp_monkey.bat"
2022-06-14 14:22:43 -04:00
Mike Salvatore ef63f2699b Agent: Use single quotes to avoid 128 character limit
The logic that splits up commands into 128 character chunks in
MSSQLExploiter is flawed, which results in malformed commands being
written to a batch file on the victim. By using single quotes instead of
double quotes, the 128 character limit is circumvented and there's no
longer any need to break up the commands. See #2018 for more details.

Fixes #2018
2022-06-14 14:22:43 -04:00
Mike Salvatore 6db63d3c69 Agent: Add additional debug logging to MSSQLExploiter 2022-06-14 14:22:43 -04:00
Ilija Lazoroski 5ff617b811 UT: Pass MagicMock instead of instance of ControlClient 2022-06-14 16:53:16 +02:00
vakarisz e6e6587f46 Agent: Fix bugs in control.py
Bugs happened because of incorrect indentation in the recent refactoring attempting to remove worm config dependency
2022-06-14 16:50:26 +03:00
Mike Salvatore f1bc5f4707 Agent: Use f-strings in _connect_to_island() 2022-06-14 08:26:38 -04:00
Ilija Lazoroski ec2d736984 Agent: Add github permalink to BaseTelem in ControlClient 2022-06-14 12:55:33 +02:00
vakarisz 444b34d548 UT: Change send telemetry spy syntax in conftest.py 2022-06-14 12:14:27 +03:00
Ilija Lazoroski bbcac32172 Agent: Remove unused control channel from build_master 2022-06-14 11:58:25 +03:00
Ilija Lazoroski 17a0be2fa0 Agent: Fix control_client_object TODOs 2022-06-14 11:58:25 +03:00
Ilija Lazoroski 7fe6c170cd UT: Fix control client location 2022-06-14 11:58:25 +03:00
Ilija Lazoroski 3c8530cf14 Agent: Rename cc_client to control_client 2022-06-14 11:58:25 +03:00
Ilija Lazoroski 02a30e6950 Agent: Remove `current_server` option from custom_pba 2022-06-14 11:58:25 +03:00
Ilija Lazoroski df116e4fb7 Agent: Remove current_server and command_servers from WormConfiguration 2022-06-14 11:58:25 +03:00
Ilija Lazoroski c467dde145 Agent: Add control_client_object to ControlClient
* Workaround global class attribute
2022-06-14 11:58:25 +03:00
Ilija Lazoroski 94dbd9a8e2 Agent: Add proxies to the initialization of ControlChannel 2022-06-14 11:58:25 +03:00
Ilija Lazoroski fb1a577823 Agent: Add control client proxies to tunnel telem initialization 2022-06-14 11:58:25 +03:00
Ilija Lazoroski 799ff3d6fd UT: Fix control client and custom pba tests 2022-06-14 11:58:25 +03:00
vakarisz a099f21f61 Agent: Initialize CustomPBA with a ControlClient object
This is done to refactor ControlClient from a global
2022-06-14 11:17:31 +03:00
vakarisz 049eb1b174 Agent: Add control client to the agent initialization 2022-06-14 11:17:27 +03:00
Mike Salvatore 133f7f5da1 Island: Add TODO about removing local_ips() 2022-06-13 13:01:57 -04:00
Shreya Malviya 324413aee9 UT: Remove `export_monkey_telems` from config in data for tests 2022-06-10 12:10:52 -07:00
Shreya Malviya 2ff32545d3 Island: Remove `export_monkey_telems` from config 2022-06-10 12:10:52 -07:00
Shreya Malviya 0647f6202d Agent: Remove `export_monkey_telems` from config 2022-06-10 12:10:52 -07:00
Shreya Malviya 16bb4b1c8a Common: Remove `EXPORT_MONKEY_TELEMS_PATH` constant 2022-06-10 12:10:44 -07:00
Shreya Malviya 7e766d2c4f Island: Remove `TestTelemStore` and related code 2022-06-10 12:10:35 -07:00
Ilija Lazoroski 153436371b Agent: Remove send_config_error from ControlClient 2022-06-10 14:44:27 +02:00
Ilija Lazoroski 6314ddd71a Island: Remove PATCH method from api/agent
* Remove config_error from monkey document
2022-06-10 13:48:05 +02:00
VakarisZ 3f69b0efd4
Merge pull request #1980 from guardicore/dependabot/npm_and_yarn/monkey/monkey_island/cc/ui/npm-8.11.0
Bump npm from 7.24.2 to 8.11.0 in /monkey/monkey_island/cc/ui
2022-06-10 10:38:42 +03:00
VakarisZ eb7e74cd82
Merge pull request #2009 from guardicore/1997-rename-credential_collector_classes
Rename `credential_collector_classes`
2022-06-10 10:38:06 +03:00
VakarisZ 1f4f573aaa
Merge pull request #2008 from guardicore/1994-remove-unused-aws-config-options
Remove unused AWS config fields
2022-06-10 10:37:43 +03:00
vakarisz 1cef7874d4 Island: Rename credential collector const 2022-06-10 10:24:53 +03:00
Shreya Malviya 42df8ee757 UT: Fix tests' `smb_download_timeout` from 300 to 30 2022-06-09 21:00:15 -07:00
Shreya Malviya 4c2e33bc5e UT: Remove `smb_download_timeout` from config in data for tests 2022-06-09 16:38:12 -07:00
Shreya Malviya 8af267248b Island: Create `SMB_DOWNLOAD_TIMEOUT` and pass in exploiter options 2022-06-09 16:37:41 -07:00
Shreya Malviya 5e59160698 Island: Remove `smb_download_timeout` from config schema 2022-06-09 16:35:31 -07:00
Shreya Malviya 0ad5554dfa UT: Rename `credential_collector_classes` to `credential_collectors` 2022-06-09 15:19:07 -07:00
Shreya Malviya 3368153507 Island: Rename `credential_collector_classes` to `credential_collectors` 2022-06-09 15:18:38 -07:00
Shreya Malviya 794ad6e5b0 Agent: Rename `credential_collector_classes` to `credential_collectors` 2022-06-09 15:17:37 -07:00
Shreya Malviya 61e3d71968 UT: Remove AWS config fields from data for tests 2022-06-09 15:03:08 -07:00