From c2c2993ff79dbd4cc57f7cc067db14153f8179bf Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Mon, 12 Sep 2022 15:01:21 +0000 Subject: [PATCH] Agent: Fix a bug(peeking socket consumes data) sock.recv takes two parameters instead of one --- .../network/relay/relay_connection_handler.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/network/relay/relay_connection_handler.py b/monkey/infection_monkey/network/relay/relay_connection_handler.py index 964a1121a..91f37b520 100644 --- a/monkey/infection_monkey/network/relay/relay_connection_handler.py +++ b/monkey/infection_monkey/network/relay/relay_connection_handler.py @@ -26,7 +26,9 @@ class RelayConnectionHandler: addr, _ = sock.getpeername() addr = IPv4Address(addr) - control_message = sock.recv(socket.MSG_PEEK) + control_message = sock.recv( + len(RELAY_CONTROL_MESSAGE_REMOVE_FROM_WAITLIST), socket.MSG_PEEK + ) if control_message.startswith(RELAY_CONTROL_MESSAGE_REMOVE_FROM_WAITLIST): self._relay_user_handler.disconnect_user(addr)