dns - webapp in python -
i have got simple idea in mind want try out. have browser, chrome instance, , want search ip of domain name, www.google.com. use windows 7 , have set dns lookup properties manual , have given address 127.0.0.1 server (written in python running). started server , see dns query weird in showing faces this:
waiting connection......... .........recieved : ('127.0.0.1', 59339) ╟╝☺ ☺ ♥www♠google♥com ☺ ☺ the waiting connection , received from server. how human readable dns query?
this server code(quiet elementary still):
here 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 connection.........' data,addr = udp.recvfrom(buf_siz) print '.........recieved : ',addr sleep(3) print data
dns uses compression algorithm , uses [length]string represent parts of domain name (as far remember). e.g. [3]www[6]google[3]com.
have @ dns rfcs, e.g. http://www.zoneedit.com/doc/rfc/rfc1035.txt
Comments
Post a Comment