forked from p15670423/monkey
Agent: Rework send_control_relay_message a bit
This commit is contained in:
parent
60f9aa6a4e
commit
20172230f1
|
@ -52,10 +52,13 @@ def _open_socket_to_server(server: str):
|
||||||
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as d_socket:
|
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as d_socket:
|
||||||
d_socket.settimeout(MEDIUM_REQUEST_TIMEOUT)
|
d_socket.settimeout(MEDIUM_REQUEST_TIMEOUT)
|
||||||
|
|
||||||
|
ip, port = address_to_ip_port(server)
|
||||||
|
logger.info(f"Control message was sent to the server/relay {server}")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
address, port = address_to_ip_port(server)
|
d_socket.connect((ip, int(port)))
|
||||||
d_socket.connect((address, int(port)))
|
|
||||||
d_socket.send(RELAY_CONTROL_MESSAGE)
|
d_socket.send(RELAY_CONTROL_MESSAGE)
|
||||||
logger.info(f"Control message was sent to the server/relay {server}")
|
|
||||||
except OSError as err:
|
except OSError as err:
|
||||||
logger.error(f"Error connecting to socket {server}: {err}")
|
logger.error(f"Error connecting to socket {server}: {err}")
|
||||||
|
except TimeoutError as err:
|
||||||
|
logger.error(f"Timed out while connecting to socket {server}: {err}")
|
||||||
|
|
Loading…
Reference in New Issue