From 4bc07442acc1e968e1577b3c144e5e63270f0869 Mon Sep 17 00:00:00 2001 From: VakarisZ Date: Wed, 8 Dec 2021 17:27:38 +0200 Subject: [PATCH] Agent: fix network_range.py to generate a correct range object for ip strings with /32 cidr notation This will fix the case where user inputs 10.0.0.10/32 expecting 10.0.0.10 getting scanned, but getting an error instead --- monkey/common/network/network_range.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey/common/network/network_range.py b/monkey/common/network/network_range.py index 1ab199943..e58fffcec 100644 --- a/monkey/common/network/network_range.py +++ b/monkey/common/network/network_range.py @@ -44,9 +44,11 @@ class NetworkRange(object, metaclass=ABCMeta): if not address_str: # Empty string return None address_str = address_str.strip() + if address_str.endswith("/32"): + address_str = address_str[:-3] if NetworkRange.check_if_range(address_str): return IpRange(ip_range=address_str) - if -1 != address_str.find("/"): + if "/" in address_str: return CidrRange(cidr_range=address_str) return SingleIpRange(ip_address=address_str)