forked from p15670423/monkey
Agent: Use HTTPIslandAPIClient in find_server
This commit is contained in:
parent
787af6ae1b
commit
f4b47f8238
|
@ -5,13 +5,13 @@ from ipaddress import IPv4Address
|
||||||
from typing import Dict, Iterable, Iterator, MutableMapping, Optional
|
from typing import Dict, Iterable, Iterator, MutableMapping, Optional
|
||||||
|
|
||||||
from common.network.network_utils import address_to_ip_port
|
from common.network.network_utils import address_to_ip_port
|
||||||
from infection_monkey.network.relay import RELAY_CONTROL_MESSAGE_REMOVE_FROM_WAITLIST
|
from infection_monkey.island_api_client import (
|
||||||
from infection_monkey.transport import (
|
HTTPIslandAPIClient,
|
||||||
IslandAPIClient,
|
|
||||||
IslandAPIConnectionError,
|
IslandAPIConnectionError,
|
||||||
IslandAPIError,
|
IslandAPIError,
|
||||||
IslandAPITimeoutError,
|
IslandAPITimeoutError,
|
||||||
)
|
)
|
||||||
|
from infection_monkey.network.relay import RELAY_CONTROL_MESSAGE_REMOVE_FROM_WAITLIST
|
||||||
from infection_monkey.utils.threading import (
|
from infection_monkey.utils.threading import (
|
||||||
ThreadSafeIterator,
|
ThreadSafeIterator,
|
||||||
create_daemon_thread,
|
create_daemon_thread,
|
||||||
|
@ -54,7 +54,7 @@ def _check_if_island_server(server: str) -> bool:
|
||||||
logger.debug(f"Trying to connect to server: {server}")
|
logger.debug(f"Trying to connect to server: {server}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
IslandAPIClient(server)
|
HTTPIslandAPIClient(server)
|
||||||
|
|
||||||
return True
|
return True
|
||||||
except IslandAPIConnectionError as err:
|
except IslandAPIConnectionError as err:
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import pytest
|
import pytest
|
||||||
import requests_mock
|
import requests_mock
|
||||||
|
|
||||||
|
from infection_monkey.island_api_client import IslandAPIConnectionError
|
||||||
from infection_monkey.network.relay.utils import find_server
|
from infection_monkey.network.relay.utils import find_server
|
||||||
from infection_monkey.transport import IslandAPIConnectionError
|
|
||||||
|
|
||||||
SERVER_1 = "1.1.1.1:12312"
|
SERVER_1 = "1.1.1.1:12312"
|
||||||
SERVER_2 = "2.2.2.2:4321"
|
SERVER_2 = "2.2.2.2:4321"
|
||||||
|
|
Loading…
Reference in New Issue