Mike Salvatore
6563be8222
Agent: Remove unnecessary local variable
2022-09-19 12:16:20 -04:00
Mike Salvatore
db75806a08
Agent: Rename _get_server() -> _connect_to_island_api()
2022-09-19 12:13:03 -04:00
Ilija Lazoroski
bc19b5ea93
Agent: Modify find_server to return tuple of server and IIslandAPIClient
2022-09-19 17:24:00 +02:00
Ilija Lazoroski
f4b47f8238
Agent: Use HTTPIslandAPIClient in find_server
2022-09-19 16:44:37 +02:00
Mike Salvatore
787af6ae1b
Agent: Fix send relay disconnect to unneeded relays
...
Since `find_server()` is parallelized, the iterator was completely
exhausted when `send_remove_from_waitlist_control_message_to_relays()`
was called, making it effectively a NOOP.
2022-09-19 16:40:04 +02:00
Shreya Malviya
9456a30bd9
Agent: Remove unnecessary logic in _check_if_island_server()
2022-09-19 16:40:04 +02:00
Shreya Malviya
69b26287b6
UT: Fix Island API errors' import in network/relay/test_utils.py
2022-09-19 16:40:04 +02:00
Shreya Malviya
8a4666fba2
Agent: Fix Island API client import in network/relay/utils.py
2022-09-19 16:40:04 +02:00
Ilija Lazoroski
11da608fe6
Agent: Modify find_server to use IslandApiClient
2022-09-19 16:40:04 +02:00
Mike Salvatore
310b58392f
Merge pull request #2313 from guardicore/2292-island-api-client
...
2292 island api client
2022-09-19 10:25:29 -04:00
Mike Salvatore
9f697e57d2
Merge pull request #2317 from guardicore/fix-zerologon
...
Fix zerologon
2022-09-19 10:16:19 -04:00
Ilija Lazoroski
2857e70fa2
Island: Change credentials stolen event subscriber argument name
2022-09-19 15:52:44 +02:00
Shreya Malviya
1b037c4b3a
Agent: Add IslandAPIRequestError for errors that are the client's mistake
2022-09-19 19:08:15 +05:30
Mike Salvatore
04e82de641
Agent: Make language consistent in IIslandAPIClient docstrings
2022-09-19 09:25:56 -04:00
Mike Salvatore
f4f9ca6317
Agent: Update island API client docstrings
2022-09-19 08:18:46 -04:00
Mike Salvatore
43d6ebcc15
Agent: Rename IslandAPIClient -> HTTPIslandAPIClient
2022-09-19 08:03:45 -04:00
Mike Salvatore
6d5503bd6e
Agent: Move IslandAPIClient to island_api_client package
2022-09-19 08:00:00 -04:00
Mike Salvatore
184e54228d
Agent: Use relative import for errors in IslandAPIClient
2022-09-19 07:56:34 -04:00
Mike Salvatore
ca1bc06c55
Agent: Add IIslandAPIClient
2022-09-19 07:51:50 -04:00
Shreya Malviya
b432a9f567
Agent: Fix docstrings in IslandAPIClient
2022-09-19 17:16:10 +05:30
Shreya Malviya
d53b3d5026
UT: Fix Island API errors' import
2022-09-19 17:11:14 +05:30
Shreya Malviya
f5279a6cb1
Agent: Import Island API errors in transport/__init__.py
2022-09-19 17:09:52 +05:30
Shreya Malviya
672fde0b94
UT: Change IslandApiClient -> IslandAPIClient
2022-09-19 17:06:41 +05:30
Shreya Malviya
d217d30b2e
Agent: Change IslandApiClient -> IslandAPIClient
2022-09-19 17:05:56 +05:30
vakarisz
8386a006d0
Agent: Implement IslandApiClient
2022-09-19 11:11:50 +02:00
vakarisz
0b0f039474
Agent: Add 4 IslandAPIErrors
2022-09-16 17:39:46 +03:00
Mike Salvatore
f677096439
Agent: Make BatchingTelemetryMessenger sleep period configurable
...
The ransomware integration tests were sometimes painfully slow because
they were waiting for the BatchingTelemetryMessenger to stop its
internal thread. This commit surfaces the sleep period parameter to the
`build_ransomware()` function so that the unit tests can set it to a
very small value. This is somewhat of a hack, but
BatchingTelemetryMessenger is going away very soon, as Telemetry is
being replaced by Events.
2022-09-16 10:34:31 -04:00
Shreya Malviya
2146985e51
Island: Undo accidental change to cc/repository/zero_trust/IEventRepository.py
2022-09-16 19:17:19 +05:30
Mike Salvatore
4e1ca659a9
Merge branch '2293-rename-event-serializers' into develop
...
PR #2300
2022-09-16 09:41:37 -04:00
Mike Salvatore
5669bdd8a2
Agent: Add a comment about locking bcrypt and cryptography
2022-09-16 09:36:26 -04:00
Mike Salvatore
9ec55f20ba
Merge pull request #2302 from guardicore/lock-cryptography
...
Lock cryptography and bcrypt
2022-09-16 09:34:30 -04:00
vakarisz
998c1d7a4f
Agent: Rename EVENTS_API_URL to AGENT_EVENTS_API_URL
2022-09-16 16:20:58 +03:00
vakarisz
77a23b7920
Island, Common: Delete the cached versions of ip retrieval
2022-09-16 16:05:56 +03:00
Mike Salvatore
f0e8691bc4
UT: Rename common/events -> common/agent_events
2022-09-16 09:02:09 -04:00
Mike Salvatore
83279cb1b7
UT: Fix CredentialsStolenEvent event import
2022-09-16 08:59:28 -04:00
Shreya Malviya
f8134e505e
UT: Fix imports common.events -> common.agent_events
2022-09-16 08:58:02 -04:00
Shreya Malviya
d93eb4565b
Island: Fix imports common.events -> common.agent_events
2022-09-16 08:58:02 -04:00
Shreya Malviya
c8d11cdfe7
Agent: Fix imports common.events -> common.agent_events
2022-09-16 08:58:02 -04:00
Shreya Malviya
b5736fdd3e
Common: Rename common/events/ -> common/agent_events/
2022-09-16 08:58:02 -04:00
Shreya Malviya
89a8ed7a5e
Island: Rename i_event_repository.py -> i_agent_event_repository.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
be612abb23
UT: Change IEventRepository -> IAgentEventRepository
2022-09-16 08:58:02 -04:00
Shreya Malviya
0dccbd32b6
Island: Rename IEventRepository -> IAgentEventRepository
2022-09-16 08:58:02 -04:00
Shreya Malviya
f0d5545f28
Island: Rename cc/resources/events.py -> cc/resources/agent_events.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
66eaccb698
Agent: `/api/agent-events` in place of `/api/events`
2022-09-16 08:58:02 -04:00
Shreya Malviya
cfc0905d0c
Island: Rename `/api/events` to `/api/agent-events`
2022-09-16 08:58:02 -04:00
Shreya Malviya
354d6624d3
UT: Use AgentEvents in place of Events in test_events.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
c37876cb97
Island: Rename resource Events -> AgentEvents
2022-09-16 08:58:02 -04:00
Shreya Malviya
edce35efef
Agent: Make log message more specific in agent_event_forwarder.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
5ad5de9c4a
UT: Change event_serializer_registry -> agent_event_serializer_registry in test_agent_event_serializer_registry.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
e6db64bf88
UT: Rename test_event_serializer_registry.py -> test_agent_event_serializer_registry.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
edb1c97e0a
UT: Rename event_serializers/ -> agent_event_serializers/
2022-09-16 08:58:02 -04:00
Shreya Malviya
7bfc2da539
UT: Fix import common.event_serializers -> common.agent_event_serializers
2022-09-16 08:58:02 -04:00
Shreya Malviya
91b973cfe3
Island: Fix import common.event_serializers -> common.agent_event_serializers
2022-09-16 08:58:02 -04:00
Shreya Malviya
922db9c583
Agent: Fix import common.event_serializers -> common.agent_event_serializers
2022-09-16 08:58:02 -04:00
Shreya Malviya
d7327272a0
Common: Rename event_serializers/ -> agent_event_serializers/
2022-09-16 08:58:02 -04:00
Shreya Malviya
2f748516a8
UT: Change pydantic_event_serializer -> pydantic_agent_event_serializer in test_pydantic_agent_event_serializer.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
d694591d1e
UT: Rename test_pydantic_event_serializer.py -> test_pydantic_agent_event_serializer.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
f5a0b42319
Common: Rename pydantic_event_serializer.py -> pydantic_agent_event_serializer.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
d729b514e5
UT: Use PydanticAgentEventSerializer in place of PydanticEventSerializer
2022-09-16 08:58:02 -04:00
Shreya Malviya
43fd978ce4
Common: Rename PydanticEventSerializer -> PydanticAgentEventSerializer
2022-09-16 08:58:02 -04:00
Shreya Malviya
940b479ca2
Common: Rename event_serializer_registry.py -> agent_event_serializer_registry.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
2568d52730
UT: Use AgentEventSerializerRegistry in place of EventSerializerRegistry
2022-09-16 08:58:02 -04:00
Shreya Malviya
4a23f5a95b
Island: Use AgentEventSerializerRegistry in place of EventSerializerRegistry
2022-09-16 08:58:02 -04:00
Shreya Malviya
19a59bf3c2
Agent: Use AgentEventSerializerRegistry in place of EventSerializerRegistry
2022-09-16 08:58:02 -04:00
Shreya Malviya
6ced4af5dc
Common: Rename EventSerializerRegistry -> AgentEventSerializerRegistry
2022-09-16 08:58:02 -04:00
Shreya Malviya
c4ab5d99a9
Agent: Fix import in agent_event_forwarder.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
3b22bf0cb4
Common:Rename i_event_serializer.py -> i_agent_event_serializer.py
2022-09-16 08:58:02 -04:00
Shreya Malviya
619dc68c0e
UT: Use IAgentEventSerializer in place of IEventSerializer
2022-09-16 08:58:02 -04:00
Shreya Malviya
0e2b165c15
Agent: Rename IEventSerializer -> IAgentEventSerializer
2022-09-16 08:58:02 -04:00
Mike Salvatore
c82ee2ce97
Common: Call get_network_interfaces() from get_my_ip_addresses()
2022-09-16 08:52:54 -04:00
vakarisz
247441663d
Common: Rename "get_local_interfaces" to "get_network_interfaces"
2022-09-16 15:45:07 +03:00
vakarisz
135da9631d
Common: Rename "get_local_ip_addresses" to "get_my_ip_addresses"
2022-09-16 15:45:07 +03:00
vakarisz
6bcf44da69
Agent: Remove unused propagation_credentials_repository parameter
2022-09-16 15:45:07 +03:00
vakarisz
11318dad14
Island, Agent: Move local IP and interface retrieval to common
...
Both, island and agent needs to get local IP's/interfaces. We should also consider merging them, since interfaces also contain IP's
2022-09-16 15:45:07 +03:00
Mike Salvatore
ae073de766
Merge pull request #2301 from guardicore/2180-credentials-event-encoding
...
2180 credentials event encoding
2022-09-16 08:35:45 -04:00
Ilija Lazoroski
7c554ec157
Agent: Relock Pipfile on windows
2022-09-16 14:35:40 +02:00
Mike Salvatore
ec40a9c6ad
Common: Inherit from InfectionMonkeyModelConfig in CredsStolenEvent
2022-09-16 08:34:46 -04:00
Mike Salvatore
54f1bd2197
Agent: Add more well-known ports
2022-09-16 08:27:42 -04:00
Mike Salvatore
1b4f1dba4e
Agent: Change the order of COMMON_PORTS
...
COMMON_PORTS should be ordered with the the most likely to succeed ports
first.
2022-09-16 08:16:46 -04:00
Ilija Lazoroski
ecccace870
Agent: Lock bcrypt to 3.2.2
2022-09-16 13:45:29 +02:00
vakarisz
46f7390a05
Common: Use SecretEncodingConfig in credentials_stolen_events.py
2022-09-16 14:26:36 +03:00
vakarisz
9577c5569e
Common, Agent: Extract credential encoding related methods
2022-09-16 14:26:31 +03:00
Kekoa Kaaikala
017cce22d6
Agent: Add cryptography dependency
2022-09-15 19:15:25 +00:00
Mike Salvatore
004a543310
Common: Make Credentials.Config a subclass of InfectionMonkeyModelConfig
2022-09-15 12:23:52 -04:00
Mike Salvatore
729d2beee8
UT: Add missing tests for MongoAgentRepository
...
Increases code coverage to 100%
2022-09-15 12:10:14 -04:00
Mike Salvatore
deacd18cbe
Island: Make ICredentialsRepository methods abstract
2022-09-15 12:03:38 -04:00
Mike Salvatore
a7a2968a99
Island: Remove superfluous "pass" from ICredentialsRepository
2022-09-15 12:03:23 -04:00
Mike Salvatore
3fd27c6503
Island: Add ICredentialsRepository.reset()
2022-09-15 12:03:21 -04:00
Mike Salvatore
07815eed93
Island: Wrap drop() Exceptions with RemovalError
2022-09-15 11:56:58 -04:00
Mike Salvatore
84c8de6a7c
UT: Test error conditions in MongoCredentialsRepository
...
Increases test coverage to 100% for MongoCredentialsRepository
2022-09-15 11:55:48 -04:00
Mike Salvatore
5aff1c62c3
Island: Use drop() to clear mongo credentials collections
2022-09-15 11:54:06 -04:00
Mike Salvatore
6e47d3272d
Island: Use monkey_island database in MongoCredentialsRepository
2022-09-15 11:48:12 -04:00
Mike Salvatore
ef821f75e2
Agent: Add agent source to CredentialsStolenEvent in ZerologonExploiter
2022-09-15 08:01:58 -04:00
Shreya Malviya
0b2039fb76
UT: Remove test_credentials_telem.py
2022-09-15 12:30:39 +05:30
Shreya Malviya
08fc1c6d39
Common: Remove CREDENTIALS from TelemCategoryEnum
2022-09-15 12:30:06 +05:30
Shreya Malviya
eba94293d4
Agent: Remove CredentialsTelem
2022-09-15 12:29:18 +05:30
Shreya Malviya
775b0e69eb
Island: Remove usage of credential telemetry
2022-09-15 12:28:37 +05:30
Shreya Malviya
b00e0ff427
Agent: Remove usage of CredentialsTelem from master
2022-09-15 12:11:55 +05:30
Shreya Malviya
0a73ca717c
Agent: Fix some mypy issues in zerologon.py
2022-09-15 12:07:03 +05:30
Shreya Malviya
97dcbe6168
Agent: Remove usage of CredentialsTelem from Zerologon exploiter
2022-09-15 11:53:22 +05:30
Mike Salvatore
51d5176986
UT: Improve MongoNodeRepository test coverage
...
Setting the MagicMock members to lambda's did not work as expected. A
look at the code coverage report revealed that not all branches were
covered. Setting them to new MagicMock objects with the correct return
type added coverage to branches that were previously skipped.
2022-09-14 15:58:35 -04:00
Mike Salvatore
4f29326da9
Merge pull request #2295 from guardicore/2180-mongo-event-repository
...
2180 mongo event repository
2022-09-14 15:49:13 -04:00
Kekoa Kaaikala
25c3552061
UT: Clarify mongo repository reset test
2022-09-14 19:35:37 +00:00
Kekoa Kaaikala
9ec91ec97a
Island: Remove unneccessary call to list()
2022-09-14 19:35:05 +00:00
Kekoa Kaaikala
cd84280e79
Island: Simplify event query and deserialization
2022-09-14 19:14:35 +00:00
Kekoa Kaaikala
8311fc79a9
Island: Add message to error on save
2022-09-14 18:43:52 +00:00
Kekoa Kaaikala
5f44204583
UT: Clean up mongo fixture
2022-09-14 18:38:56 +00:00
Kekoa Kaaikala
7e96c11204
Island: Add docstring to MongoEventRepository
2022-09-14 18:35:18 +00:00
Mike Salvatore
2155e9681e
UT: Double sleep time to prevent false failures
2022-09-14 14:17:19 -04:00
Mike Salvatore
5742681b13
Island: Rename agent_event_subscribers -> agent_event_handlers
2022-09-14 13:58:12 -04:00
Mike Salvatore
03c49fe4da
Island: Shorten subscription code
2022-09-14 13:55:13 -04:00
Mike Salvatore
b3e9bbe05f
Island: Subscribe save_stolen_credentials_to_repository()
2022-09-14 13:54:38 -04:00
Mike Salvatore
4db251dd7d
Island: Add save_stolen_credentials_to_repository
2022-09-14 13:52:29 -04:00
Mike Salvatore
d5979fae16
Island: Fix typo and grammar in save_event_to_event_repository()
2022-09-14 13:48:55 -04:00
Kekoa Kaaikala
5c762930bf
Island: Search UUID by string value
2022-09-14 17:45:44 +00:00
Kekoa Kaaikala
89954223e8
Island: Match type based on __name__
2022-09-14 17:45:44 +00:00
Kekoa Kaaikala
ad5bba9e2f
Island: Use EventSerializerRegistry
2022-09-14 17:45:44 +00:00
Kekoa Kaaikala
f5e398c175
Island: Add MongoEventRepository
2022-09-14 17:45:41 +00:00
Mike Salvatore
0b5dd3832b
Merge pull request #2291 from guardicore/2180-save-event-to-repository
...
2180 save event to repository
2022-09-14 13:40:19 -04:00
Mike Salvatore
6f4c3d4669
Island: Register StubbedEventRepository in DIContainer
2022-09-14 13:36:55 -04:00
Mike Salvatore
f5711e2fab
Island: Add StubbedEventRepository
...
A placeholder until MongoEventRepository is implemented
2022-09-14 13:35:49 -04:00
Mike Salvatore
9fc91239f2
Agent: Use private module variable for ID caching
...
mypy complains about setting an attribute on the function object. Using
`global _id` accomplishes the same thing and doesn't upset mypy
2022-09-14 12:59:44 -04:00
Mike Salvatore
8faf8de4dd
Agent: Use HardwareID as the return type for get_machine_id()
2022-09-14 12:57:40 -04:00
Mike Salvatore
f7ab5c5dd8
Common: Use MachineID instead of int in AbstractAgentEvent.target
2022-09-14 12:54:49 -04:00
Mike Salvatore
1b2b316e1f
Island: Move MachineID to common
2022-09-14 12:53:42 -04:00
Mike Salvatore
99b0f5bcd6
Merge pull request #2279 from guardicore/2177-agent-all-events-subscriber
...
Subscriber to send all Agent events to Island
2022-09-14 12:12:26 -04:00
Mike Salvatore
d179a5563f
UT: Add note about potentially slow or racey tests
2022-09-14 12:11:51 -04:00
Mike Salvatore
996225deef
Agent: Fix line length
2022-09-14 12:09:42 -04:00
Mike Salvatore
fbd5bb9a9e
Agent: Rename _agent_events_to_island_sender
2022-09-14 12:08:45 -04:00
Mike Salvatore
9471db378f
UT: Reduce sleep time from 0.05 to 0.01 in test_agent_event_forwarder
2022-09-14 12:07:36 -04:00
Ilija Lazoroski
83f1e4cc2a
Island: Use agent_event_handlers on island setup
2022-09-14 17:19:28 +02:00
Ilija Lazoroski
5a836daaa7
Island: Add agent_event_handlers
2022-09-14 17:18:55 +02:00
Ilija Lazoroski
26fc6fd5b9
Island: Add save_event_to_event_repository subscriber
2022-09-14 17:17:32 +02:00
vakarisz
b81f7ad69c
Merge branch '2216-tcp-relay' into develop
2022-09-14 17:47:13 +03:00
Shreya Malviya
218363d40e
UT: Reduce sleep time from 0.1 to 0.05 in test_agent_event_forwarder.py
2022-09-14 19:59:19 +05:30
Shreya Malviya
5c1613bc79
Agent: Add log statement when sending Agent events to Island
2022-09-14 19:54:36 +05:30
Shreya Malviya
7fed97530f
UT: Use BatchingAgentEventForwarder instead of AgentEventsToIslandSender
2022-09-14 19:52:33 +05:30
Shreya Malviya
c24fd9ddab
Agent: Rename AgentEventsToIslandSender -> BatchingAgentEventForwarder
2022-09-14 19:52:10 +05:30
Shreya Malviya
83a828ada5
UT: Rename test_send_all_events_to_island.py -> test_agent_event_forwarder.py
2022-09-14 19:51:15 +05:30
Shreya Malviya
984ce2e8bc
UT: Use agent_event_forwarder instead send_all_events_to_island in import
2022-09-14 19:50:33 +05:30
Shreya Malviya
04b1caeb4c
Agent: Rename send_all_events_to_island.py -> agent_event_forwarder.py
2022-09-14 19:49:35 +05:30
Shreya Malviya
0775beda7a
Agent: Rename SendAllAgentEventsToIsland -> AgentEventForwarder
2022-09-14 19:47:53 +05:30
Shreya Malviya
4eabf6e77b
Agent: Use create_daemon_thread() instead of threading.Thread() in AgentEventsToIslandSender
2022-09-14 19:45:12 +05:30
vakarisz
f3fd2fca8b
Agent: Fix SSH exploiter to be able to exploit unknown OS
...
Previously if the agent couldn't detect the OS, agent failed with errors
2022-09-14 17:08:52 +03:00
Ilija Lazoroski
bb0910371c
Island: Refactor api/events to publish list of events
...
PR #2285
2022-09-14 09:48:16 -04:00
Mike Salvatore
2fe3a2ece3
Merge pull request #2287 from guardicore/2180-i-event-repository
...
Island: Add IEventRepository
2022-09-14 09:44:17 -04:00
Mike Salvatore
c977d8c212
Island: Use TypeVar for IEventRepository.get_events_by_type()
2022-09-14 09:41:58 -04:00
Mike Salvatore
4bb914316f
Merge pull request #2283 from guardicore/2255-mongo-node-repository
...
2255 mongo node repository
2022-09-14 09:35:16 -04:00
Mike Salvatore
f52f8eccd5
UT: Use sets for simpler sequence comparison
2022-09-14 09:19:56 -04:00
Mike Salvatore
1a8c285d8e
UT: Use set.intersection() for simpler set comparison
2022-09-14 09:18:00 -04:00