Click here to Skip to main content
15,886,791 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi,

this is my first post.
i want make DNS packet to send to port 53 (DNS SERVER) and get reply.

the problem is that i dont know how to make the packet.

i know the stracture is : Header - Question - Anwser - Authority - additional

but i dont know how to put each byte in each section...


for example help me to make packet fo www.google.com;

tnx
Posted
Comments
Richard MacCutchan 16-Nov-13 6:57am    
Since you have not told us what language your program is written in it is difficult to make a valid suggestion.
Sajad Hoseinpoor 16-Nov-13 14:34pm    
i use c# .net 3.5 - help me how to code and make the structure of packet.tnx
Richard MacCutchan 17-Nov-13 5:32am    
Just create a byte array and set each byte to the values as required by the protocol. The Google search I provided contains links to articles that explain the message content.
Richard MacCutchan 16-Nov-13 6:58am    
Some of the links at https://www.google.com/search?q=dns+query+packet should help you.
Sajad Hoseinpoor 16-Nov-13 14:35pm    
i searched this in google but not solved

1 solution

Solved...

I just checked the packet send by wireshark an checked the packed structure.

i made packet useing byte array.

header section almost is static , for the query name made a dynamic byte array.
and Qtype and QClass were static.

so i put whole the arrays in a unit array that containing the bytes which were required.

do like this:
C#
byte [] id={0x11,0x12};
byte [] Flags={0x00,0x00};
byte [] QDcount={0x00,0x01};
byte [] .......



tnx again.
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900