MCPcopy Create free account
hub / github.com/TheRook/subbrute / parseAnswers

Method parseAnswers

dnslib/digparser.py:116–140  ·  view source on GitHub ↗
(self,a,auth,ar,dns)

Source from the content-addressed store, hash-verified

114 getattr(CLASS,qclass)))
115
116 def parseAnswers(self,a,auth,ar,dns):
117 sect_map = {'a':'add_answer','auth':'add_auth','ar':'add_ar'}
118 for sect in 'a','auth','ar':
119 f = getattr(dns,sect_map[sect])
120 for rr in locals()[sect]:
121 rname,ttl,rclass,rtype = rr[:4]
122 rdata = rr[4:]
123 rd = RDMAP.get(rtype,RD)
124 try:
125 if rd == RD and \
126 any([ x not in string.hexdigits for x in rdata[-1]]):
127 # Only support hex encoded data for fallback RD
128 pass
129 else:
130 f(RR(rname=rname,
131 ttl=int(ttl),
132 rtype=getattr(QTYPE,rtype),
133 rclass=getattr(CLASS,rclass),
134 rdata=rd.fromZone(rdata)))
135 except DNSError as e:
136 if self.debug:
137 print("DNSError:",e,rr)
138 else:
139 # Skip records we dont understand
140 pass
141
142 def __iter__(self):
143 return self.parse()

Callers 1

parseMethod · 0.95

Calls 3

RRClass · 0.90
getMethod · 0.45
fromZoneMethod · 0.45

Tested by

no test coverage detected