Arin Blocks Missing
AlexanderPotapov opened this issue · 2 comments
AlexanderPotapov commented
Hello
First of all, thank you for this amazing script!
I noticed, that Arin data base is missing. Even in your example output it has 0 blocks. Any idea how to fix this?
2020-06-23 20:24:43,942 - create_db - INFO - MainProcess - arin.db - parsing database file: ./databases/arin.db
2020-06-23 20:24:43,946 - create_db - INFO - MainProcess - arin.db - Got 0 blocks
Best regards
Alexander
jtkristoff commented
An imperfect hack, but it should get some of the ARIN data into the database:
--- create_db.py
+++ arin.create_db.py
@@ -89,6 +89,16 @@
rb'^inet4num:[\s]*((?:\d{1,3}\.){3}\d{1,3}/\d{1,2})', block, re.MULTILINE)
if match:
return match[0]
+ # ARIN route IPv4
+ match = re.findall(
+ rb'^route:[\s]*((?:\d{1,3}\.){3}\d{1,3}/\d{1,2})', block, re.MULTILINE)
+ if match:
+ return match[0]
+ # ARIN route6 IPv6
+ match = re.findall(
+ rb'^route6:[\s]*([0-9a-fA-F:\/]{1,43})', block, re.MULTILINE)
+ if match:
+ return match[0]
logger.warning(f"Could not parse inetnum on block {block}")
return None
@@ -147,7 +157,7 @@
continue
# block end
if line.strip() == b'':
- if single_block.startswith(b'inetnum:') or single_block.startswith(b'inet6num:'):
+ if single_block.startswith(b'inetnum:') or single_block.startswith(b'inet6num:') or single_block.startswith(b'route:') or single_block.startswith(b'route6:'):
# add source
single_block += b"cust_source: %s" % (cust_source)
blocks.append(single_block)
@@ -182,6 +192,9 @@
inetnum = parse_property_inetnum(block)
netname = parse_property(block, b'netname')
+ # No netname field in ARIN block, try origin
+ if not netname:
+ netname = parse_property(block, b'origin')
description = parse_property(block, b'descr')
country = parse_property(block, b'country')
maintained_by = parse_property(block, b'mnt-by')
firefart commented
Thanks! I've added your changes as they seem to work :)