From 4cf448ebe193eaf0eacd04b9d1924a0082280b6e Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 15 Mar 2022 13:25:59 -0400 Subject: [PATCH] Agent: Remove disused struct_unpack_tracker*() --- monkey/infection_monkey/network/tools.py | 26 ------------------------ 1 file changed, 26 deletions(-) diff --git a/monkey/infection_monkey/network/tools.py b/monkey/infection_monkey/network/tools.py index 1a1981616..7a863ea7d 100644 --- a/monkey/infection_monkey/network/tools.py +++ b/monkey/infection_monkey/network/tools.py @@ -12,32 +12,6 @@ BANNER_READ = 1024 logger = logging.getLogger(__name__) -def struct_unpack_tracker(data, index, fmt): - """ - Unpacks a struct from the specified index according to specified format. - Returns the data and the next index - :param data: Buffer - :param index: Position index - :param fmt: Struct format - :return: (Data, new index) - """ - unpacked = struct.unpack_from(fmt, data, index) - return unpacked, struct.calcsize(fmt) - - -def struct_unpack_tracker_string(data, index): - """ - Unpacks a null terminated string from the specified index - Returns the data and the next index - :param data: Buffer - :param index: Position index - :return: (Data, new index) - """ - ascii_len = data[index:].find(b"\0") - fmt = "%ds" % ascii_len - return struct_unpack_tracker(data, index, fmt) - - def check_tcp_port(ip, port, timeout=DEFAULT_TIMEOUT, get_banner=False): """ Checks if a given TCP port is open