diff --git a/monkey/infection_monkey/network/info.py b/monkey/infection_monkey/network/info.py index eee01040a..2ae49b056 100644 --- a/monkey/infection_monkey/network/info.py +++ b/monkey/infection_monkey/network/info.py @@ -1,7 +1,7 @@ import itertools import socket import struct -from collections import namedtuple +from dataclasses import dataclass from ipaddress import IPv4Interface from random import randint # noqa: DUO102 from typing import List @@ -18,9 +18,11 @@ SIOCGIFNETMASK = 0x891B # get network PA mask RTF_UP = 0x0001 # Route usable RTF_REJECT = 0x0200 -# TODO: We can probably replace both of these namedtuples with classes in Python's ipaddress -# library: https://docs.python.org/3/library/ipaddress.html -NetworkAddress = namedtuple("NetworkAddress", ("ip", "domain")) + +@dataclass +class NetworkAddress: + ip: str + domain: str def get_local_network_interfaces() -> List[IPv4Interface]: diff --git a/monkey/infection_monkey/network_scanning/scan_target_generator.py b/monkey/infection_monkey/network_scanning/scan_target_generator.py index b25cbdf25..0efbaee1c 100644 --- a/monkey/infection_monkey/network_scanning/scan_target_generator.py +++ b/monkey/infection_monkey/network_scanning/scan_target_generator.py @@ -2,7 +2,7 @@ import itertools import logging import socket from ipaddress import IPv4Interface -from typing import Any, Dict, List +from typing import Dict, List from common.network.network_range import InvalidNetworkRangeError, NetworkRange from infection_monkey.network import NetworkAddress @@ -40,7 +40,7 @@ def compile_scan_target_list( def _remove_redundant_targets(targets: List[NetworkAddress]) -> List[NetworkAddress]: - reverse_dns: Dict[Any, Any] = {} + reverse_dns: Dict[str, str] = {} for target in targets: domain_name = target.domain ip = target.ip diff --git a/vulture_allowlist.py b/vulture_allowlist.py index b203a2bea..5ab45088a 100644 --- a/vulture_allowlist.py +++ b/vulture_allowlist.py @@ -218,6 +218,7 @@ stop_time parent_id cc_server hardware_id +network_interfaces connections # TODO DELETE AFTER RESOURCE REFACTORING