def addressoverlap(): for i in range(0, len(list2)): for j in range (1, len(list2)): if i==j: continue n1 = ipaddr.IPNetwork(list2[i]) n2 = ipaddr.IPNetwork(list2[j]) s = n1.overlaps(n2) if s: v=n1,"overlaps",n2 write_to_file("AddrOverlap.txt",str(v))
def addressoverlap(): for i in range(0, len(list2)): for j in range(1, len(list2)): if i == j: continue n1 = ipaddr.IPNetwork(list2[i]) n2 = ipaddr.IPNetwork(list2[j]) s = n1.overlaps(n2) if s: v = n1, "overlaps", n2 write_to_file("AddrOverlap.txt", str(v))
from CheckAddressOverlap import addressoverlap import os total = 0 client_name = raw_input('Enter client name: ') file = open("input_list.txt") while 1: line = file.readline() if not line: break else: count = 0 for ip in IPNetwork(line): z = str(ip) write_to_file("IP_list.txt", z ) count = count + 1 ip_who = line.split('/') ip2 = "whois " + ip_who[0] s = cmdline(ip2) if client_name.lower() in s.lower(): write_to_file("Whois_Info.txt", s ) else: write_to_file("Non_Client_Whois_Info.txt", s ) hostst = str(line) + " : " + str(count) write_to_file("Hosts_total.txt", hostst) total = total + count total_to_file = "Total Hosts: " + str(total) write_to_file("Hosts_total.txt", total_to_file)