Skip to content

Commit e529c70

Browse files
committed
fix is_private_ip()
1 parent c1f5016 commit e529c70

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

slips_files/common/slips_utils.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,14 +397,13 @@ def is_port_in_use(self, port: int) -> bool:
397397
def is_private_ip(
398398
self, ip: Union[ipaddress.IPv4Address, ipaddress.IPv6Address, str]
399399
) -> bool:
400-
if self.detect_ioc_type(ip) != "ip":
401-
return False
402-
403400
ip_classes = {ipaddress.IPv4Address, ipaddress.IPv6Address}
404401
for class_ in ip_classes:
405402
if isinstance(ip, class_):
406403
return ip and ip.is_private
407404

405+
if self.detect_ioc_type(ip) != "ip":
406+
return False
408407
# convert the given str ip to obj
409408
ip_obj = ipaddress.ip_address(ip)
410409
return ip_obj.is_private

0 commit comments

Comments
 (0)