forked from p34709852/monkey
Common: Rename "get_local_interfaces" to "get_network_interfaces"
This commit is contained in:
parent
135da9631d
commit
247441663d
|
@ -13,7 +13,7 @@ def get_my_ip_addresses() -> Sequence[str]:
|
||||||
return ip_list
|
return ip_list
|
||||||
|
|
||||||
|
|
||||||
def get_local_interfaces() -> List[IPv4Interface]:
|
def get_network_interfaces() -> List[IPv4Interface]:
|
||||||
local_interfaces = []
|
local_interfaces = []
|
||||||
for interface in interfaces():
|
for interface in interfaces():
|
||||||
addresses = ifaddresses(interface).get(AF_INET, [])
|
addresses = ifaddresses(interface).get(AF_INET, [])
|
||||||
|
|
|
@ -11,7 +11,7 @@ from common import AgentRegistrationData
|
||||||
from common.agent_configuration import AgentConfiguration
|
from common.agent_configuration import AgentConfiguration
|
||||||
from common.common_consts.timeouts import SHORT_REQUEST_TIMEOUT
|
from common.common_consts.timeouts import SHORT_REQUEST_TIMEOUT
|
||||||
from common.credentials import Credentials
|
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.i_control_channel import IControlChannel, IslandCommunicationError
|
||||||
from infection_monkey.utils import agent_process
|
from infection_monkey.utils import agent_process
|
||||||
from infection_monkey.utils.ids import get_agent_id, get_machine_id
|
from infection_monkey.utils.ids import get_agent_id, get_machine_id
|
||||||
|
@ -34,7 +34,7 @@ class ControlChannel(IControlChannel):
|
||||||
# parent_id=parent,
|
# parent_id=parent,
|
||||||
parent_id=None, # None for now, until we change GUID to UUID
|
parent_id=None, # None for now, until we change GUID to UUID
|
||||||
cc_server=self._control_channel_server,
|
cc_server=self._control_channel_server,
|
||||||
network_interfaces=get_local_interfaces(),
|
network_interfaces=get_network_interfaces(),
|
||||||
)
|
)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
|
|
@ -17,8 +17,8 @@ from common.event_serializers import (
|
||||||
from common.events import CredentialsStolenEvent
|
from common.events import CredentialsStolenEvent
|
||||||
from common.network.network_utils import (
|
from common.network.network_utils import (
|
||||||
address_to_ip_port,
|
address_to_ip_port,
|
||||||
get_local_interfaces,
|
|
||||||
get_my_ip_addresses,
|
get_my_ip_addresses,
|
||||||
|
get_network_interfaces,
|
||||||
)
|
)
|
||||||
from common.utils.argparse_types import positive_int
|
from common.utils.argparse_types import positive_int
|
||||||
from common.utils.attack_utils import ScanStatus, UsageEnum
|
from common.utils.attack_utils import ScanStatus, UsageEnum
|
||||||
|
@ -224,7 +224,7 @@ class InfectionMonkey:
|
||||||
return agent_event_serializer_registry
|
return agent_event_serializer_registry
|
||||||
|
|
||||||
def _build_master(self, relay_servers: List[str]):
|
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
|
# TODO control_channel and control_client have same responsibilities, merge them
|
||||||
propagation_credentials_repository = AggregatingPropagationCredentialsRepository(
|
propagation_credentials_repository = AggregatingPropagationCredentialsRepository(
|
||||||
|
|
|
@ -3,7 +3,7 @@ from typing import Sequence
|
||||||
|
|
||||||
from ring import lru
|
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)
|
@lru(maxsize=1)
|
||||||
|
@ -17,4 +17,4 @@ def get_cached_local_ip_addresses() -> Sequence[IPv4Address]:
|
||||||
# change, the Island process needs to be restarted.
|
# change, the Island process needs to be restarted.
|
||||||
@lru(maxsize=1)
|
@lru(maxsize=1)
|
||||||
def get_cached_local_interfaces() -> Sequence[IPv4Interface]:
|
def get_cached_local_interfaces() -> Sequence[IPv4Interface]:
|
||||||
return get_local_interfaces()
|
return get_network_interfaces()
|
||||||
|
|
Loading…
Reference in New Issue