Foro de elhacker.net

Programación => Scripting => Mensaje iniciado por: BigBear en 4 Abril 2012, 18:24 pm



Título: [Python] Buscador de sueños 0.1
Publicado por: BigBear en 4 Abril 2012, 18:24 pm
Un simple buscador de sueños hecho en Python.

Código
  1. #!usr/bin/python
  2. #coding: utf-8
  3. #Buscador de sueños 0.1
  4. #Coded By Doddy H
  5.  
  6. import urllib2,re,sys
  7.  
  8. def toma(web) :
  9. nave = urllib2.Request(web)
  10. 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');
  11. op = urllib2.build_opener()
  12. return op.open(nave).read()
  13.  
  14. def head():
  15.  print "\n-- == Buscador de sueños == --\n"
  16.  
  17. def copyright():
  18. print "\n\n(C) Doddy Hackman 2012\n"
  19. raw_input()
  20. sys.exit(1)
  21.  
  22. head()
  23.  
  24. url = raw_input("\n\n[+] Texto : ")
  25.  
  26. try:
  27. code = toma("http://www.mis-suenos.org/interpretaciones/buscar?text="+url)
  28. if (re.findall("<li>(.*)<\/li>",code)):
  29.   re = re.findall("<li>(.*)<\/li>",code)
  30.   re = re[0]
  31.   if not re=="":
  32.     print "\n\n[+] Significado : "+re
  33.   else:
  34.     print "[-] No se encontro significado\n"
  35. except:
  36. print "[-] Error\n"
  37.  
  38. copyright()
  39.  
  40. # The End
  41.