I have got a very simple idea in mind that i want to try out. Say i have a browser, chrome for instance, and i want to search for the ip of the domain name, say `www.google.com`. I use windows 7 and i have set the dns lookup properties to manual and have given the address `127.0.0.1` where my server (written in Python) is running. I started my server and i could see the dns query like this:
WAITING FOR CONNECTION......... .........recieved from : ('127.0.0.1', 59339) "'~\\x17\\x01\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x03www\\x06google\\x02co\\x02in\\x00\\x00\\x01\\x00\\x01'" The `waiting for connection` and the `received from` is from my server. How do i get a breakdown form(a human readable form) of this message?? This is my server code(quiet elementary but still): Here is the code: from time import sleep import socket host='' port=53 addr_list=(host,port) buf_siz=1024 udp=socket.socket(socket.AF_INET,socket.SOCK_DGRAM) udp.bind(addr_list) while True: print 'WAITING FOR CONNECTION.........' data,addr = udp.recvfrom(buf_siz) print '.........recieved from : ',addr sleep(3) print repr(data) is there any better way to get the dns request fro my browser first ,extract the domain name and then send it to a name server that i wish all in python ? if here is pl explain it without any third party modules i wouldn mind re-inventing the wheel as long as i can learn all python concepts properly Thanking you in advance!!! Yours thankfully, Preetam (A python freak)
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor