def main(argv): log.logger = log.Logger() out = None zone = None try: nsec3_chain = {} try: opts, args = getopt.gnu_getopt(argv[1:], "z:o:v") except getopt.GetoptError, err: usage(argv) for opt, arg in opts: if opt == '-z': zone = n3map.name.fqdn_from_text(arg) if opt == '-o': out = open(arg, "wb") if opt == '-v': log.logger.loglevel += 1 if out is None: out = sys.stdout if len(args) < 1: usage(argv) records_file = rrfile.open_input_rrfile(args[0]) salt = None iterations = None for nsec3 in records_file.nsec3_reader(): if salt == None or iterations == None: salt = nsec3.salt iterations = nsec3.iterations elif salt != nsec3.salt or iterations != nsec3.iterations: raise ZoneChangedError, "zone salt or iterations not unique!" nsec3_chain[nsec3.hashed_owner] = nsec3 records_file.close() log.info("read {0:d} records. ready for input!".format( len(nsec3_chain))) if len(nsec3_chain) == 0: return 0 if sys.stdin.isatty(): try: while True: line = raw_input() lookup_nsec3(nsec3_chain, salt, iterations, zone, line, out) except (EOFError), e: pass
def main(argv): log.logger = log.Logger() try: if len(argv) < 2: usage(argv) if len(argv) == 3: out = open(argv[2], "wb") else: out = sys.stdout records_file = rrfile.open_input_rrfile(argv[1]) for nsec3 in records_file.nsec3_reader(): nsec3_hash = util.str_to_hex(nsec3.hashed_owner) zone = str(nsec3.zone) iterations = "{0:d}".format(nsec3.iterations) salt = util.str_to_hex(nsec3.salt) out.write("$NSEC3$" + "$".join((iterations, salt, nsec3_hash, zone)) + "\n") except (IOError, N3MapError), e: log.fatal(e)
def main(argv): log.logger = log.Logger() try: if len(argv) < 2: usage(argv) if len(argv) == 3: out = open(argv[2], "wb") else: out = sys.stdout records_file = rrfile.open_input_rrfile(argv[1]) for nsec3 in records_file.nsec3_reader(): nsec3_hash = util.base32_ext_hex_encode(nsec3.hashed_owner).lower() zone = str(nsec3.zone) zone = re.sub('\.$', '', zone) iterations = "{0:d}".format(nsec3.iterations) salt = util.str_to_hex(nsec3.salt) out.write(":".join((nsec3_hash, "." + zone, salt, iterations)) + "\n") except (IOError, N3MapError), e: log.fatal(e)
def main(argv): log.logger = log.Logger() try: (options, nslist, zone) = parse_arguments(argv) except N3MapError, e: log.fatal_exit(2, e)