def arp_ping_start(): arp_ping_prepare() t1 = datetime.now() map(q.put, xrange(1, 254)) threads = [threading.Thread(target=worker) for i in xrange(50)] map(lambda x: x.start(), threads) q.join() print "finish in " + str(datetime.now() - t1) print "---------------------------" main.select_discovery()
def arp_ping_prepare(): print "===========================\n" print("Select one from this " + number_interfaces + " interface:\n\n" + interfaces + "\n") interface = raw_input("[arp ping] Select > ") if interface == "bk": print "===========================\n" main.select_discovery() elif interface == "exit": sys.exit() else: global ip, prefix ip = subprocess.check_output( "ifconfig " + interface + " | grep 'netmask' | cut -d' ' -f10 | cut -d'.' -f1-3", shell=True).strip() prefix = ip.split('.')[0] + '.' + ip.split('.')[1] + '.' + ip.split( '.')[2] + '.' print("===========================\n") print "These IP are alive:\n"
def select(): answer3 = raw_input("[discovery-ACK] Select > ") if answer3 == "1.1": list_ips() ips1() elif answer3 == "1.2": list_ips() ips2() elif answer3 == "2": list_iptxt() iptxt_start() elif answer3 == "show": list_select() select() elif answer3 == "bk": print"===========================\n" main.select_discovery() elif answer3 == "exit": sys.exit() else: print"===========================\n" print"No Such Number,Select again.\n" select()