mirror of
https://github.com/vel21ripn/nDPI.git
synced 2026-05-01 00:19:42 +00:00
While the lists ina6ff0dd0and2f5f445fare somehow provided by the companies themselves (or by some interested parties), these new lists are directly extracted from BGP information, via AS prefixes. *Usually*, these new lists are far more stable than the previous ones. TODO: * add some other ASNs (see `src/lib/ndpi_content_match.c.inc`) * IPv6, as usual :-(
20 lines
389 B
Python
Executable file
20 lines
389 B
Python
Executable file
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import socket
|
|
import struct
|
|
import netaddr
|
|
|
|
if len (sys.argv) == 3:
|
|
proto = sys.argv[2]
|
|
|
|
if len(sys.argv) < 2:
|
|
print("Usage: mergeipaddrlist.py <file>")
|
|
sys.exit (1)
|
|
|
|
ipFile = open(sys.argv[1])
|
|
ipAddresses = list(ipFile.readlines())
|
|
ipAddresses = sorted(ipAddresses)
|
|
cidrs = netaddr.cidr_merge(ipAddresses)
|
|
for cidr in cidrs:
|
|
print(cidr)
|