from netaddr import IPNetwork as CIDR import sys if len(sys.argv) != 2: print(f"usage: {sys.argv[0]} ") exit(0) try: with open(sys.argv[1], "r") as iplist: networks = iplist.read().strip().split("\n") except FileNotFoundError as e: print("[-] File not found") exit(1) for nw in networks: for ip in CIDR(nw): sys.stdout.write(f"{str(ip)}\n")