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
This commit is contained in:
VakarisZ 2021-12-08 17:27:38 +02:00 committed by vakarisz
parent 913ba02e0b
commit 4bc07442ac
1 changed files with 3 additions and 1 deletions

View File

@ -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)