• Fuentes

 #477107  por Doddy
 31 Ago 2015, 01:12
Un simple script en Python para realizar un whois de forma online (mediante una pagina).
#!usr/bin/python
#Whois Online 0.1
#Coded By Doddy H
 
import urllib2,sys,re
 
nave = urllib2.build_opener()	
nave.add_header = [('User-Agent','Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.5) Gecko/2008120122 Firefox/3.0.5')]	
 
def tomar(web,vars) :
 return nave.open(web,vars).read()
 
def head():
 print "\n-- == Whois Online 0.1 == --\n\n"
 
def copyright():
 print "\n(C) Doddy Hackman 2012\n"
 sys.exit(1)
 
def sintax():
 print "[+] Sintax : ",sys.argv[0]," <domain>\n"
 
def whois(domain):
 try:
  code = tomar("http://networking.ringofsaturn.com/Tools/whois.php","domain="+domain+"&"+"submit=submit")
  if (re.findall("<PRE>(.*?)<\/PRE>",code,re.S)):
   found = re.findall("<PRE>(.*?)<\/PRE>",code,re.S)
   resul = found[0]
   resul = re.sub(""","",resul)
   resul = re.sub(">>>","",resul)
   resul = re.sub("<<<","",resul)
   return resul
  else:
   return "Not Found"
 except:
  print "[-] Page offline\n"

head()
if len(sys.argv) != 2 : 
 sintax()
else :
 print whois(sys.argv[1])
copyright()
 
# The End