def update_STORED_DATA(ip, name): buffer="insert into dns_ips (ip_addr, ip_name) values ('%s', '%s')"% (ip, name); if(cx_db.exececute_command(buffer)) == 0: print >> sys.stderr, "Failed to add record to the Stored DNS DATA (NAC.dns_ips)"
else: word = word.replace(addr, name); #for addr in v6matches: print word, sys.stdout.flush() print sys.stdout.flush() if __name__ == "__main__": (UpdateStored, PrintBoth, ReSet, file_name)=get_options(); if (UpdateStored == 1): myList=cx_db.get_list("select ip_addr, ip_name from dns_ips"); for ip_addr, name in myList: STORED_DATA[ip_addr]=name; if ReSet == 1: cx_db.exececute_command("truncate table dns_ips"); if len(file_name) > 0: try: with open(file_name) as myFile: for line in myFile: process_line(line.strip(), PrintBoth, UpdateStored); except IOError as e: print "Failed to open file", file_name print e else: OK=1; while(OK != 0): try: line=raw_input(); process_line(line.strip(), PrintBoth, UpdateStored); except (EOFError, KeyboardInterrupt):