Browse Source

new tool: makeiplistunique.py

Marius Schwarz 4 years ago
parent
commit
02c586fd30
1 changed files with 17 additions and 0 deletions
  1. 17 0
      makeiplistunique.py

+ 17 - 0
makeiplistunique.py

@@ -0,0 +1,17 @@
+from netaddr import IPNetwork as CIDR
+import sys
+
+if len(sys.argv) != 2:
+    print(f"usage: {sys.argv[0]} <iplist.txt>")
+    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")