Showing posts with label nslookup. Show all posts
Showing posts with label nslookup. Show all posts

Friday, May 23, 2008

NSLOOKUP in Python

from socket import gethostbyaddr 

def nslooky(ip):
      try: 
           output = gethostbyaddr(ip)
           return output[0]
     except: 
           output = "not found" 
           return output

 your_ip = request.META.get('REMOTE_ADDR') 
# above is Django module object
 your_name = nslooky(your_ip)
Original code by Cluther