[Python] Whois Online 0.1

Iniciado por BigBear, Abril 23, 2012, 12:18:27 PM

Tema anterior - Siguiente tema

0 Miembros y 1 Visitante están viendo este tema.

Abril 23, 2012, 12:18:27 PM Ultima modificación: Mayo 03, 2014, 09:43:54 AM por Flemon
Un simple script en Python para realizar un whois de forma online (mediante una pagina).

Código: python

#!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("&quot;","",resul)
   resul = re.sub("&gt;&gt;&gt;","",resul)
   resul = re.sub("&lt;&lt;&lt;","",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