From 19bcaad7f2a76ff29286aa39bbe619c8a8bccfca Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Fri, 17 Dec 2021 07:08:48 -0500 Subject: [PATCH] Agent: Fix broken logic in get_local_network_interfaces() --- monkey/infection_monkey/network/info.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/infection_monkey/network/info.py b/monkey/infection_monkey/network/info.py index 0ebd03a62..19d1bb0d0 100644 --- a/monkey/infection_monkey/network/info.py +++ b/monkey/infection_monkey/network/info.py @@ -23,11 +23,13 @@ RTF_REJECT = 0x0200 def get_local_network_interfaces() -> List[NetworkInterface]: + network_interfaces = [] for i in get_host_subnets(): netmask_bits = IPv4Network(f"{i['addr']}/{i['netmask']}", strict=False).prefixlen cidr_netmask = f"/{netmask_bits}" + network_interfaces.append(NetworkInterface(i["addr"], cidr_netmask)) - return [NetworkInterface(i["addr"], cidr_netmask) for i in get_host_subnets()] + return network_interfaces def get_host_subnets():