From e529c700480db1f23ea69ac64e9395dd508f9c71 Mon Sep 17 00:00:00 2001 From: alya Date: Thu, 12 Dec 2024 00:44:46 +0200 Subject: [PATCH] fix is_private_ip() --- slips_files/common/slips_utils.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/slips_files/common/slips_utils.py b/slips_files/common/slips_utils.py index bfc71f6a6..a4b228e6b 100644 --- a/slips_files/common/slips_utils.py +++ b/slips_files/common/slips_utils.py @@ -397,14 +397,13 @@ def is_port_in_use(self, port: int) -> bool: def is_private_ip( self, ip: Union[ipaddress.IPv4Address, ipaddress.IPv6Address, str] ) -> bool: - if self.detect_ioc_type(ip) != "ip": - return False - ip_classes = {ipaddress.IPv4Address, ipaddress.IPv6Address} for class_ in ip_classes: if isinstance(ip, class_): return ip and ip.is_private + if self.detect_ioc_type(ip) != "ip": + return False # convert the given str ip to obj ip_obj = ipaddress.ip_address(ip) return ip_obj.is_private