Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
module for DNS queries
#1
i recall once seeing a module for doing DNS queries of all kinds. i thought it was one in the Python package but i don't see one, now. so i did a pip search and there seems to be a zillion (2**'zillion') of them. but i don't see one that would be a core lookup tool (to build a special DNS lookup tracer). i want to be able to do many parallel queries at the same time. note that is for core queries (select record type and option bits) with a logical structure of the responses, not generic lookups to find hosts.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
I am sure you can do this with Scapy but I am not familiar enough with this module to show you some example. And with the networking too. So I did a quick research.

Here is the first one.
Another one. Simple enough. Python 2.
One more.

Installing it for Python 3... python command refers to python3 on my system so I'm just using pip but you may use pip3 instead. The packet is scapy-python3. It appears that I did not install it for Python 3 her so I just did it.

Perhaps Scapy is the greatest tool out there available for Python. I wish I have more time to dig into it.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#3
i think i need to look for and verify it can set bits/options in the request like the NOREC bit. what i am thinking of involves my code doing the recursion, with some changes on the fly.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#4
As I know you can create whatever packet you want and send it.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#5
right, but what i'd like to have is a tool that can construct a proper DNS request into a datagram, and either send it, or give to me to let me send it. and i would also like to have a tool that breaks down and helps me parse, interpret, and understand the responses.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#6
Well, create the packet, send it and parse the answer. You have to write that tool alone. I doubt that you will find the program you want. Scapy lets you do that.
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply
#7
i can write the logic i need. i'm just looking for a tool that can construct a request and deconstruct a response and let me do the logic i want. i have looked DNS details enough to knows that construct/deconstruct is a complex and difficult part of the whole process.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#8
This should work for your specific request - setting norec bit. I had to dig first what that means Smile

# rd: recurse desired ( norec ). In this case there will be recursion. Or not :D
response = sr1(IP(dst="dns_server_address")/UDP()/DNS(rd=1,qd=DNSQR(qname="python-forum.io"))) 
"As they say in Mexico 'dosvidaniya'. That makes two vidaniyas."
https://freedns.afraid.org
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  module to do DNS queries Skaperen 2 2,151 Jan-01-2019, 08:19 PM
Last Post: Skaperen

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020