[IPv6 #1] IPv6 address uniqueness
This commit is contained in:
parent
bff795f6f0
commit
6a46f7f657
1 changed files with 21 additions and 0 deletions
21
kjg/IPv6/overlap.py
Normal file
21
kjg/IPv6/overlap.py
Normal file
|
@ -0,0 +1,21 @@
|
|||
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")
|
Loading…
Reference in a new issue