Skip to content

Commit

Permalink
inetnum
Browse files Browse the repository at this point in the history
  • Loading branch information
firefart committed Aug 19, 2023
1 parent 4686194 commit 478f7a8
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions create_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,13 @@ def parse_property_inetnum(block: str) -> str:
ip_end = match[0][1].decode('utf-8')
cidrs = iprange_to_cidrs(ip_start, ip_end)
return cidrs
# IPv6
match = re.findall(
rb'^inet6num:[\s]*([0-9a-fA-F:\/]{1,43})', block, re.MULTILINE)
# direct CIDR in lacnic db
match = re.findall(rb'^inetnum:[\s]*((?:\d{1,3}\.){3}\d{1,3}/\d+)', block, re.MULTILINE)
if match:
return match[0]
# LACNIC translation for IPv4
# IPv6
match = re.findall(
rb'^inet4num:[\s]*((?:\d{1,3}\.){3}\d{1,3}/\d{1,2})', block, re.MULTILINE)
rb'^inet6num:[\s]*([0-9a-fA-F:\/]{1,43})', block, re.MULTILINE)
if match:
return match[0]
# ARIN route IPv4
Expand Down

0 comments on commit 478f7a8

Please sign in to comment.