22 lines
485 B
Python
22 lines
485 B
Python
|
from sys import argv
|
||
|
import ipaddress
|
||
|
|
||
|
# read the argument how to run this
|
||
|
try:
|
||
|
script, ip1, ip2 = argv
|
||
|
a = ip1.split('/')
|
||
|
b = ip2.split('/')
|
||
|
|
||
|
a = ipaddress.ip_network(a[0]).supernet(new_prefix=int(a[1]))
|
||
|
b = ipaddress.ip_network(b[0]).supernet(new_prefix=int(b[1]))
|
||
|
|
||
|
test1 = ipaddress.IPv6Network(a).overlaps(ipaddress.IPv6Network(b))
|
||
|
|
||
|
if test1 :
|
||
|
print("overlap")
|
||
|
else:
|
||
|
print("no overlap")
|
||
|
|
||
|
except:
|
||
|
print("wrong inpit")
|