MCPcopy Create free account
hub / github.com/secdev/scapy / field_gen

Function field_gen

scapy/layers/dns.py:251–263  ·  view source on GitHub ↗

Iterates through all DNS strings that can be compressed

(dns_pkt)

Source from the content-addressed store, hash-verified

249 build_pkt = raw(dns_pkt)
250
251 def field_gen(dns_pkt):
252 """Iterates through all DNS strings that can be compressed"""
253 for lay in [dns_pkt.qd, dns_pkt.an, dns_pkt.ns, dns_pkt.ar]:
254 if not lay:
255 continue
256 for current in lay:
257 for field in current.fields_desc:
258 if isinstance(field, DNSStrField) or \
259 (isinstance(field, MultipleTypeField) and
260 current.type in [2, 3, 4, 5, 12, 15, 39, 47]):
261 # Get the associated data and store it accordingly # noqa: E501
262 dat = current.getfieldval(field.name)
263 yield current, field.name, dat
264
265 def possible_shortens(dat):
266 """Iterates through all possible compression parts in a DNS string"""

Callers 1

dns_compressFunction · 0.85

Calls 1

getfieldvalMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…