Iterates through all DNS strings that can be compressed
(dns_pkt)
| 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""" |
no test coverage detected
searching dependent graphs…