continue # Not UDP ldns_obj = pldns.ldns(udp.payload) test_println("%5d: %s -> %s" % (n, udp.src_prefix, udp.dst_prefix), get_tag()) if not ldns_obj.is_ok(): test_println("%sCouldn't make ldns_obj, status = <%s>" % ( margin, ldns_obj.errorstr(ldns_obj.status)), get_tag()) continue rk = 'query' if ldns_obj.is_response: rk = 'response' test_println("%s%s, ident=%04x, opcode=%d (%s), rcode=%d (%s)" % (margin, rk, ldns_obj.ident, ldns_obj.opcode, pldns.opcodestr(ldns_obj.opcode), ldns_obj.rcode, pldns.rcodestr(ldns_obj.rcode)), get_tag()) q_rr_list = ldns_obj.query_rr_list if not q_rr_list: test_println("%sQuery list empty" % margin, get_tag()) else: test_println("%sQuery list (%d items)" % (margin, len(q_rr_list)), get_tag()) for rr in q_rr_list: test_println("%s %s\t%3d" % (margin, rr.owner, rr.type), get_tag()) if ldns_obj.is_response: an_rr_list = ldns_obj.response_rr_list if not an_rr_list: test_println("%sResponse list empty" % margin, get_tag()) else: test_println("%sResponse list (%d items)" % (margin, len(an_rr_list)), get_tag())
ldns_obj = pldns.ldns(udp.payload) print("%5d: %s -> %s" % (n, udp.src_prefix, udp.dst_prefix)) if not ldns_obj.is_ok(): print("%sCouldn't make ldns_obj, status = <%s>\n" % (margin, ldns_obj.errorstr(ldns_obj.status))) continue rk = 'query' if ldns_obj.is_response: rk = 'response' print("%s%s, ident=%04x, opcode=%d (%s), rcode=%d (%s)" % (margin, rk, ldns_obj.ident, ldns_obj.opcode, pldns.opcodestr(ldns_obj.opcode), ldns_obj.rcode, pldns.rcodestr(ldns_obj.rcode))) q_rr_list = ldns_obj.query_rr_list if not q_rr_list: print("%sQuery list empty" % margin) else: print("%sQuery list (%d items)" % (margin, len(q_rr_list))) for rr in q_rr_list: print("%s %s\t%3d" % (margin, rr.owner, rr.type)) if ldns_obj.is_response: an_rr_list = ldns_obj.response_rr_list if not an_rr_list: print("%sResponse list empty" % margin) else: print("%sResponse list (%d items)" % (margin, len(an_rr_list)))
test_println("%5d: %s -> %s" % (n, tcp.src_prefix, tcp.dst_prefix), get_tag()) if not ldns_obj.is_ok(): test_println( "%sCouldn't make ldns_obj, status = <%s>" % (margin, ldns_obj.errorstr(ldns_obj.status)), get_tag()) continue rk = 'query' if ldns_obj.is_response: rk = 'response' test_println( "%s%s, ident=%04x, opcode=%d (%s), rcode=%d (%s)" % (margin, rk, ldns_obj.ident, ldns_obj.opcode, pldns.opcodestr( ldns_obj.opcode), ldns_obj.rcode, pldns.rcodestr(ldns_obj.rcode)), get_tag()) q_rr_list = ldns_obj.query_rr_list if not q_rr_list: test_println("%sQuery list empty" % margin, get_tag()) else: test_println("%sQuery list (%d items)" % (margin, len(q_rr_list)), get_tag()) for rr in q_rr_list: test_println("%s %s\t%3d" % (margin, rr.owner, rr.type), get_tag()) if ldns_obj.is_response: an_rr_list = ldns_obj.response_rr_list if not an_rr_list:
if not payload: continue ldns_obj = pldns.ldns(payload) test_println("%5d: %s -> %s" % (n, tcp.src_prefix, tcp.dst_prefix), get_tag()) if not ldns_obj.is_ok(): test_println("%sCouldn't make ldns_obj, status = <%s>" % ( margin, ldns_obj.errorstr(ldns_obj.status)), get_tag()) continue rk = 'query' if ldns_obj.is_response: rk = 'response' test_println("%s%s, ident=%04x, opcode=%d (%s), rcode=%d (%s)" % (margin, rk, ldns_obj.ident, ldns_obj.opcode, pldns.opcodestr(ldns_obj.opcode), ldns_obj.rcode, pldns.rcodestr(ldns_obj.rcode)), get_tag()) q_rr_list = ldns_obj.query_rr_list if not q_rr_list: test_println("%sQuery list empty" % margin, get_tag()) else: test_println("%sQuery list (%d items)" % (margin, len(q_rr_list)), get_tag()) for rr in q_rr_list: test_println("%s %s\t%3d" % (margin, rr.owner, rr.type), get_tag()) if ldns_obj.is_response: an_rr_list = ldns_obj.response_rr_list if not an_rr_list: test_println("%sResponse list empty" % margin, get_tag()) else: test_println("%sResponse list (%d items)" % (margin, len(an_rr_list)), get_tag())