def dns_meta_data(self):
        """Pull out the dns metadata for packet/transport in the input_stream"""

        # For each packet process the contents
        for packet in self.input_stream:
            # Skip packets without transport info (ARP/ICMP/IGMP/whatever)
            if 'transport' not in packet:
                continue
            try:
                dns_meta = dpkt.dns.DNS(packet['transport']['data'])
                _raw_info = data_utils.make_dict(dns_meta)
                packet['dns'] = self._dns_info_mapper(_raw_info)
                packet['dns']['_raw'] = _raw_info
            except (dpkt.dpkt.NeedData, dpkt.dpkt.UnpackError):
                if 'dns' in packet:
                    del packet['dns']

            # All done
            yield packet
def dns_meta_data ( self ) : for packet in self . input_stream : if 'transport' not in packet : continue try : dns_meta = dpkt . dns . DNS ( packet [ 'transport' ] [ 'data' ] ) _raw_info = data_utils . make_dict ( dns_meta ) packet [ 'dns' ] = self . _dns_info_mapper ( _raw_info ) packet [ 'dns' ] [ '_raw' ] = _raw_info except ( dpkt . dpkt . NeedData , dpkt . dpkt . UnpackError ) : if 'dns' in packet : del packet [ 'dns' ] yield packet
Pull out the dns metadata for packet/transport in the input_stream