def launch(cidrBlock,lowport,highport): setcore.PrintStatus("SET is now scanning the IPs specified... please be patient.") if not validateCIDRBlock(cidrBlock): # validate its really an ip address if solo ip_check = setcore.is_valid_ip(cidrBlock) if ip_check != False: setcore.PrintStatus("CIDR notation not specified. Trying single IP address.") scan(cidrBlock, int(lowport), int(highport)) return host_list else: setcore.PrintWarning("Invalid IP Address, try again.") else: printCIDR(cidrBlock,lowport,highport) return host_list
def launch(cidrBlock, lowport, highport): setcore.PrintStatus( "SET is now scanning the IPs specified... please be patient.") if not validateCIDRBlock(cidrBlock): # validate its really an ip address if solo ip_check = setcore.is_valid_ip(cidrBlock) if ip_check != False: setcore.PrintStatus( "CIDR notation not specified. Trying single IP address.") scan(cidrBlock, int(lowport), int(highport)) return host_list else: setcore.PrintWarning("Invalid IP Address, try again.") else: printCIDR(cidrBlock, lowport, highport) return host_list
def printCIDR(c, lowport, highport): parts = c.split("/") baseIP = ip2bin(parts[0]) subnet = int(parts[1]) # Python string-slicing weirdness: # if a subnet of 32 was specified simply print the single IP if subnet == 32: ipaddr = bin2ip(baseIP) # for any other size subnet, print a list of IP addresses by concatenating # the prefix with each of the suffixes in the subnet else: ipPrefix = baseIP[:-(32 - subnet)] for i in range(2**(32 - subnet)): ipaddr = bin2ip(ipPrefix + dec2bin(i, (32 - subnet))) ip_check = setcore.is_valid_ip(ipaddr) if ip_check != False: scan(str(ipaddr), int(lowport), int(highport)) time.sleep(1)
def printCIDR(c,lowport,highport): parts = c.split("/") baseIP = ip2bin(parts[0]) subnet = int(parts[1]) # Python string-slicing weirdness: # if a subnet of 32 was specified simply print the single IP if subnet == 32: ipaddr = bin2ip(baseIP) # for any other size subnet, print a list of IP addresses by concatenating # the prefix with each of the suffixes in the subnet else: ipPrefix = baseIP[:-(32-subnet)] for i in range(2**(32-subnet)): ipaddr = bin2ip(ipPrefix+dec2bin(i, (32-subnet))) ip_check = setcore.is_valid_ip(ipaddr) if ip_check != False: scan(str(ipaddr), int(lowport), int(highport)) time.sleep(1)