Skip to content

get all dns answers from a dns packet #682

Open
@amirfirouzi

Description

@amirfirouzi

Hello Everyone,

I'm using Pyshark to parse different types of packets.

For some reason, I cannot get all the DNS answers.
there are two issues, first, not all answers are available to get. I have a packet which shows 4 different Answers in Wireshark, but only one answer is shown in the dns.Answers object, or have another packet which has 11 answers in Wireshark, but only 3 are showing in the object.
The second issue is a unique and stable way to get the answers. for some packets, I can get the only answer using answer = getattr(dns.Answers, dns.Answers.field_names[0]). But for packets with more answers, this doesn't work. and I need to get all dns.Answers.field_names, and loop through them to see which one is a domain, sample result might be like this: ['net', 'e28578.d.akamaiedge.net', 'assets.msn.com', 'assets.msn.com.edgekey.net', 'com'] and I need to discard .net and .com entries, and get the name of the domains and access the actual answer object.

Not sure if I'm doing something wrong here or this is a bug, or... Looked in the wiki and searched I the web but couldn't find anything.

Appreciate your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions