diff --git a/kjg/IPv6/overlap.py b/kjg/IPv6/overlap.py new file mode 100644 index 0000000..1ded373 --- /dev/null +++ b/kjg/IPv6/overlap.py @@ -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")