elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Introducción a la Factorización De Semiprimos (RSA)


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [Python] Little Script Codepad
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Python] Little Script Codepad  (Leído 2,050 veces)
The Swash

Desconectado Desconectado

Mensajes: 194


Programmer


Ver Perfil WWW
[Python] Little Script Codepad
« en: 2 Noviembre 2011, 03:35 am »

Código
  1. #------------------------------------------------------------------------------
  2. # Pequeño script de escritorio para utilizar Codepad.org
  3. # Programmer: The Swash
  4. # Website: http://h-sec.org
  5. #------------------------------------------------------------------------------
  6.  
  7. import urllib, urllib2, re
  8.  
  9. def GetResponse(lang, code):
  10.    code = urllib.urlencode({'lang':lang, 'code':code,'run':'True','submit':'Submit'})
  11.    web = urllib2.urlopen('http://codepad.org',code)
  12.    source = web.read()
  13.  
  14.    resp = re.findall('<td width="100%" style="vertical-align: top">\n<div class="highlight">\n<pre>\n([^\b]+)</pre>', source)
  15.    temp = resp[0]
  16.    if re.findall('<a href="#line-[\d]">(.+)</a>', temp):
  17.        err = re.findall('<a href="#line-[0-9]">(.+)</a>', temp)
  18.        val = re.sub('<a href="#line-[0-9]">(.+)</a>', err[0], temp)
  19.        return val
  20.    else:
  21.        return temp
  22.  
  23. langs = ('Python','C','C++','PHP','Perl','Ruby')
  24. lang = 0
  25. print "Bienvenido, lenguajes disponibles: \n"
  26. length = len(langs)
  27. for i in range(length):
  28.    print str(i+1) + '- ' + langs[i]
  29.  
  30. while not((ord(str(lang)) >= 49) and (ord(str(lang)) <= 54)):
  31.    print "Elige el numero correspondiente: "
  32.    lang = input()
  33.  
  34. try:
  35.    path = raw_input("Ingrese la ubicacion completa del archivo: ")
  36.    lfile = open(path, "r")
  37.    buff = lfile.read()
  38.    lfile.close()
  39.  
  40. except:
  41.    print "Error al procesar archivo"
  42.    exit()
  43.  
  44. Resp = GetResponse(langs[lang-1], buff)
  45. print "Output:\n"
  46. print Resp
  47. raw_input("Presione enter para salir..")

Un pequeño script para gestión con Codepad.
Acepto críticas.

Un saludo.


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Python] Script que descarga un MP3 de GOEAR
Scripting
Kasswed 0 2,164 Último mensaje 19 Agosto 2008, 19:54 pm
por Kasswed
[python] Script Blind Sql Injection
Scripting
nacho87 0 2,946 Último mensaje 24 Septiembre 2009, 12:11 pm
por nacho87
[python] ayuda con script ¨^^(SOLUCIONADO)
Scripting
EvilGoblin 3 3,481 Último mensaje 17 Abril 2010, 03:02 am
por Novlucker
Ayuda con script python
Scripting
Xenomorfo77 5 3,678 Último mensaje 4 Mayo 2012, 02:13 am
por Xenomorfo77
[Python] - Script que devuelva que caracter se repite mas [Ayuda]
Scripting
Pryato 1 2,228 Último mensaje 24 Noviembre 2013, 17:17 pm
por Eleкtro
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines