Skip to content

Commit

Permalink
slips_utils: make sure the given str is an ip before converting it to…
Browse files Browse the repository at this point in the history
… ip_address obj
  • Loading branch information
AlyaGomaa committed Dec 11, 2024
1 parent d78e85c commit c1f5016
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions slips_files/common/slips_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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_):
Expand Down

0 comments on commit c1f5016

Please sign in to comment.