forked from p15670423/monkey
Agent: Simplify logic in SocketAddress object creation in monkey.py and network/relay/utils.py
This commit is contained in:
parent
6a29702846
commit
8a609e0871
|
@ -3,7 +3,7 @@ import logging
|
|||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
from ipaddress import IPv4Address, IPv4Interface
|
||||
from ipaddress import IPv4Interface
|
||||
from pathlib import Path, WindowsPath
|
||||
from typing import List, Mapping, Optional, Tuple
|
||||
|
||||
|
@ -123,9 +123,7 @@ class InfectionMonkey:
|
|||
self._cmd_island_ip, self._cmd_island_port = address_to_ip_port(server)
|
||||
self._cmd_island_port = int(self._cmd_island_port)
|
||||
|
||||
self._island_address = SocketAddress(
|
||||
IPv4Address(self._cmd_island_ip), self._cmd_island_port
|
||||
)
|
||||
self._island_address = SocketAddress(self._cmd_island_ip, self._cmd_island_port)
|
||||
|
||||
self._control_client = ControlClient(
|
||||
server_address=server, island_api_client=self._island_api_client
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import logging
|
||||
import socket
|
||||
from contextlib import suppress
|
||||
from ipaddress import IPv4Address
|
||||
from typing import Dict, Iterable, Iterator, Optional
|
||||
|
||||
from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT
|
||||
|
@ -90,8 +89,7 @@ def send_remove_from_waitlist_control_message_to_relays(servers: Iterable[str]):
|
|||
|
||||
|
||||
def _send_remove_from_waitlist_control_message_to_relay(server: str):
|
||||
ip, port = address_to_ip_port(server)
|
||||
server_address = SocketAddress(IPv4Address(ip), int(port))
|
||||
server_address = SocketAddress(*address_to_ip_port(server))
|
||||
notify_disconnect(server_address)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue