Common: Rename "get_local_ip_addresses" to "get_my_ip_addresses"

This commit is contained in:
vakarisz 2022-09-16 15:41:11 +03:00
parent 6bcf44da69
commit 135da9631d
4 changed files with 7 additions and 7 deletions

View File

@ -5,7 +5,7 @@ from typing import List, Optional, Sequence, Tuple
from netifaces import AF_INET, ifaddresses, interfaces
def get_local_ip_addresses() -> Sequence[str]:
def get_my_ip_addresses() -> Sequence[str]:
ip_list = []
for interface in interfaces():
addresses = ifaddresses(interface).get(AF_INET, [])

View File

@ -7,7 +7,7 @@ import requests
from urllib3 import disable_warnings
from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT, MEDIUM_REQUEST_TIMEOUT
from common.network.network_utils import get_local_ip_addresses
from common.network.network_utils import get_my_ip_addresses
from infection_monkey.config import GUID
from infection_monkey.network.info import get_host_subnets
from infection_monkey.utils import agent_process
@ -39,7 +39,7 @@ class ControlClient:
monkey = {
"guid": GUID,
"hostname": hostname,
"ip_addresses": get_local_ip_addresses(),
"ip_addresses": get_my_ip_addresses(),
"networks": get_host_subnets(),
"description": " ".join(platform.uname()),
"parent": parent,

View File

@ -18,7 +18,7 @@ from common.events import CredentialsStolenEvent
from common.network.network_utils import (
address_to_ip_port,
get_local_interfaces,
get_local_ip_addresses,
get_my_ip_addresses,
)
from common.utils.argparse_types import positive_int
from common.utils.attack_utils import ScanStatus, UsageEnum
@ -205,7 +205,7 @@ class InfectionMonkey:
self._cmd_island_port,
client_disconnect_timeout=config.keep_tunnel_open_time,
)
relay_servers = [f"{ip}:{relay_port}" for ip in get_local_ip_addresses()]
relay_servers = [f"{ip}:{relay_port}" for ip in get_my_ip_addresses()]
if not maximum_depth_reached(config.propagation.maximum_depth, self._current_depth):
self._relay.start()

View File

@ -3,12 +3,12 @@ from typing import Sequence
from ring import lru
from common.network.network_utils import get_local_interfaces, get_local_ip_addresses
from common.network.network_utils import get_local_interfaces, get_my_ip_addresses
@lru(maxsize=1)
def get_cached_local_ip_addresses() -> Sequence[IPv4Address]:
return get_local_ip_addresses()
return get_my_ip_addresses()
# The subnets list should not change often. Therefore, we can cache the result and never call this