LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-02-2011, 07:33 AM   #1
preets100
LQ Newbie
 
Registered: Jul 2011
Posts: 1

Rep: Reputation: Disabled
an idea for a webapp in python


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 but it was very weird as in it is showing faces like this:

WAITING FOR CONNECTION.........

.........recieved from : ('127.0.0.1', 59339)

╟╝☺ ☺ ♥www♠google♥com ☺ ☺

The `waiting for connection` and the `received from` is from my server. How do i get a human readable dns query?



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 data
 
Old 07-02-2011, 11:18 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974Reputation: 1974
So what's the question? you want to know how to interpret the DNS request? Well if you want to do it properly yourself you would read the RFC's for the DNS protocol and pull apart the packet accordingly. Bit shifting and decding from Hex as appropriate.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Reasons to use VPN vs. SSL for webapp? Donny Bahama Linux - Security 3 09-02-2009 12:21 AM
[SOLVED] Can launch Java webapp from rc.local navigat0 Linux - Server 2 07-01-2009 10:48 AM
PHP WebApp with windows clients barghota Programming 3 05-04-2009 07:05 PM
Webapp that emulates FTP? cabe Linux - Software 16 12-13-2006 09:48 PM
Shared Document Webapp? humbletech99 Linux - Networking 1 12-13-2006 09:09 PM


All times are GMT -5. The time now is 03:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration