From c1f50169e9bdecb324a419079a620e8030fd601a Mon Sep 17 00:00:00 2001 From: alya Date: Thu, 12 Dec 2024 00:08:56 +0200 Subject: [PATCH] slips_utils: make sure the given str is an ip before converting it to ip_address obj --- slips_files/common/slips_utils.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/slips_files/common/slips_utils.py b/slips_files/common/slips_utils.py index 84aceaeaa..bfc71f6a6 100644 --- a/slips_files/common/slips_utils.py +++ b/slips_files/common/slips_utils.py @@ -397,6 +397,9 @@ 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_):