mirror of
https://github.com/C24Be/AS_Network_List.git
synced 2026-01-25 07:26:59 +03:00
RIPE DB
This commit is contained in:
8
pylib/ip.py
Executable file
8
pylib/ip.py
Executable file
@@ -0,0 +1,8 @@
|
||||
import ipaddress
|
||||
|
||||
def convert_to_cidr(ip_range):
|
||||
start_ip, end_ip = ip_range.split(' - ')
|
||||
start_ip = ipaddress.IPv4Address(start_ip)
|
||||
end_ip = ipaddress.IPv4Address(end_ip)
|
||||
cidrs = ipaddress.summarize_address_range(start_ip, end_ip)
|
||||
return [str(cidr) for cidr in cidrs]
|
||||
Reference in New Issue
Block a user