From 43d6ebcc157634820d32c81d584913dfa77b92ff Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 19 Sep 2022 08:03:45 -0400 Subject: [PATCH] Agent: Rename IslandAPIClient -> HTTPIslandAPIClient --- monkey/infection_monkey/island_api_client/__init__.py | 2 +- .../{island_api_client.py => http_island_api_client.py} | 4 ++-- ...land_api_client.py => test_http_island_api_client.py} | 4 ++-- vulture_allowlist.py | 9 ++++++--- 4 files changed, 11 insertions(+), 8 deletions(-) rename monkey/infection_monkey/island_api_client/{island_api_client.py => http_island_api_client.py} (89%) rename monkey/tests/unit_tests/infection_monkey/island_api_client/{test_island_api_client.py => test_http_island_api_client.py} (91%) diff --git a/monkey/infection_monkey/island_api_client/__init__.py b/monkey/infection_monkey/island_api_client/__init__.py index 957e734ef..9fae9b510 100644 --- a/monkey/infection_monkey/island_api_client/__init__.py +++ b/monkey/infection_monkey/island_api_client/__init__.py @@ -5,4 +5,4 @@ from .island_api_client_errors import ( IslandAPITimeoutError, ) from .i_island_api_client import IIslandAPIClient -from .island_api_client import IslandAPIClient +from .http_island_api_client import HTTPIslandAPIClient diff --git a/monkey/infection_monkey/island_api_client/island_api_client.py b/monkey/infection_monkey/island_api_client/http_island_api_client.py similarity index 89% rename from monkey/infection_monkey/island_api_client/island_api_client.py rename to monkey/infection_monkey/island_api_client/http_island_api_client.py index ab8436bbb..d38c640d4 100644 --- a/monkey/infection_monkey/island_api_client/island_api_client.py +++ b/monkey/infection_monkey/island_api_client/http_island_api_client.py @@ -4,12 +4,12 @@ import requests from common.common_consts.timeouts import MEDIUM_REQUEST_TIMEOUT -from . import IslandAPIConnectionError, IslandAPIError, IslandAPITimeoutError +from . import IIslandAPIClient, IslandAPIConnectionError, IslandAPIError, IslandAPITimeoutError logger = logging.getLogger(__name__) -class IslandAPIClient: +class HTTPIslandAPIClient(IIslandAPIClient): """ A client for requests from the Agent to the Island API """ diff --git a/monkey/tests/unit_tests/infection_monkey/island_api_client/test_island_api_client.py b/monkey/tests/unit_tests/infection_monkey/island_api_client/test_http_island_api_client.py similarity index 91% rename from monkey/tests/unit_tests/infection_monkey/island_api_client/test_island_api_client.py rename to monkey/tests/unit_tests/infection_monkey/island_api_client/test_http_island_api_client.py index 0e1d7412b..f213b0569 100644 --- a/monkey/tests/unit_tests/infection_monkey/island_api_client/test_island_api_client.py +++ b/monkey/tests/unit_tests/infection_monkey/island_api_client/test_http_island_api_client.py @@ -3,7 +3,7 @@ import requests import requests_mock from infection_monkey.island_api_client import ( - IslandAPIClient, + HTTPIslandAPIClient, IslandAPIConnectionError, IslandAPIError, IslandAPITimeoutError, @@ -27,4 +27,4 @@ def test_island_api_client(actual_error, expected_error): m.get(ISLAND_URI, exc=actual_error) with pytest.raises(expected_error): - IslandAPIClient(SERVER) + HTTPIslandAPIClient(SERVER) diff --git a/vulture_allowlist.py b/vulture_allowlist.py index 07a0213f2..340d506f2 100644 --- a/vulture_allowlist.py +++ b/vulture_allowlist.py @@ -9,8 +9,11 @@ from common.agent_configuration.agent_sub_configurations import ( ) from common.credentials import Credentials, LMHash, NTHash from infection_monkey.exploit.log4shell_utils.ldap_server import LDAPServerFactory -from infection_monkey.island_api_client import IIslandAPIClient -from infection_monkey.transport import IslandAPIClient, IslandAPIRequestFailedError +from infection_monkey.island_api_client import ( + HTTPIslandAPIClient, + IIslandAPIClient, + IslandAPIRequestFailedError, +) from monkey_island.cc.event_queue import IslandEventTopic, PyPubSubIslandEventQueue from monkey_island.cc.models import Report from monkey_island.cc.models.networkmap import Arc, NetworkMap @@ -333,5 +336,5 @@ IslandEventTopic.RESET_AGENT_CONFIGURATION # TODO: Remove after #2292 is closed IIslandAPIClient -IslandAPIClient +HTTPIslandAPIClient IslandAPIRequestFailedError