From 247441663d526a57398224cec85d91ab9893ce3b Mon Sep 17 00:00:00 2001 From: vakarisz Date: Fri, 16 Sep 2022 15:44:14 +0300 Subject: [PATCH] Common: Rename "get_local_interfaces" to "get_network_interfaces" --- monkey/common/network/network_utils.py | 2 +- monkey/infection_monkey/master/control_channel.py | 4 ++-- monkey/infection_monkey/monkey.py | 4 ++-- monkey/monkey_island/cc/server_utils/network_utils.py | 4 ++-- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/monkey/common/network/network_utils.py b/monkey/common/network/network_utils.py index 6f5bc3ab5..f2afe47ae 100644 --- a/monkey/common/network/network_utils.py +++ b/monkey/common/network/network_utils.py @@ -13,7 +13,7 @@ def get_my_ip_addresses() -> Sequence[str]: return ip_list -def get_local_interfaces() -> List[IPv4Interface]: +def get_network_interfaces() -> List[IPv4Interface]: local_interfaces = [] for interface in interfaces(): addresses = ifaddresses(interface).get(AF_INET, []) diff --git a/monkey/infection_monkey/master/control_channel.py b/monkey/infection_monkey/master/control_channel.py index 18029b148..76be63b5d 100644 --- a/monkey/infection_monkey/master/control_channel.py +++ b/monkey/infection_monkey/master/control_channel.py @@ -11,7 +11,7 @@ from common import AgentRegistrationData from common.agent_configuration import AgentConfiguration from common.common_consts.timeouts import SHORT_REQUEST_TIMEOUT from common.credentials import Credentials -from common.network.network_utils import get_local_interfaces +from common.network.network_utils import get_network_interfaces from infection_monkey.i_control_channel import IControlChannel, IslandCommunicationError from infection_monkey.utils import agent_process from infection_monkey.utils.ids import get_agent_id, get_machine_id @@ -34,7 +34,7 @@ class ControlChannel(IControlChannel): # parent_id=parent, parent_id=None, # None for now, until we change GUID to UUID cc_server=self._control_channel_server, - network_interfaces=get_local_interfaces(), + network_interfaces=get_network_interfaces(), ) try: diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 3d2fc3555..17a66d6b3 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -17,8 +17,8 @@ from common.event_serializers import ( from common.events import CredentialsStolenEvent from common.network.network_utils import ( address_to_ip_port, - get_local_interfaces, get_my_ip_addresses, + get_network_interfaces, ) from common.utils.argparse_types import positive_int from common.utils.attack_utils import ScanStatus, UsageEnum @@ -224,7 +224,7 @@ class InfectionMonkey: return agent_event_serializer_registry def _build_master(self, relay_servers: List[str]): - local_network_interfaces = get_local_interfaces() + local_network_interfaces = get_network_interfaces() # TODO control_channel and control_client have same responsibilities, merge them propagation_credentials_repository = AggregatingPropagationCredentialsRepository( diff --git a/monkey/monkey_island/cc/server_utils/network_utils.py b/monkey/monkey_island/cc/server_utils/network_utils.py index f27823789..d3611f0e5 100644 --- a/monkey/monkey_island/cc/server_utils/network_utils.py +++ b/monkey/monkey_island/cc/server_utils/network_utils.py @@ -3,7 +3,7 @@ from typing import Sequence from ring import lru -from common.network.network_utils import get_local_interfaces, get_my_ip_addresses +from common.network.network_utils import get_my_ip_addresses, get_network_interfaces @lru(maxsize=1) @@ -17,4 +17,4 @@ def get_cached_local_ip_addresses() -> Sequence[IPv4Address]: # change, the Island process needs to be restarted. @lru(maxsize=1) def get_cached_local_interfaces() -> Sequence[IPv4Interface]: - return get_local_interfaces() + return get_network_interfaces()