You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
403 B
12 lines
403 B
import argparse
|
|
|
|
import netaddr
|
|
|
|
|
|
if __name__ == '__main__':
|
|
parser = argparse.ArgumentParser(description='Merge IP addresses into the smallest possible list of CIDRs.')
|
|
parser.add_argument('--source', nargs='?', type=argparse.FileType('r'), required=True, help='Source file path')
|
|
args = parser.parse_args()
|
|
|
|
for addr in netaddr.cidr_merge(args.source.readlines()):
|
|
print(addr)
|
|
|