Agent: Fix type hints
This commit is contained in:
parent
fedfe4e45d
commit
70a9251c5b
|
@ -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]:
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -218,6 +218,7 @@ stop_time
|
|||
parent_id
|
||||
cc_server
|
||||
hardware_id
|
||||
network_interfaces
|
||||
connections
|
||||
|
||||
# TODO DELETE AFTER RESOURCE REFACTORING
|
||||
|
|
Loading…
Reference in New Issue