elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.
 
Inicio Ayuda Buscar Ingresar Registrarse
29 Mayo 2012, 05:15  


Tema destacado: ¿Eres nuevo? ¿Tienes dudas acerca del funcionamiento de la comunidad? Lee las Reglas Generales

+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting (Moderadores: Novlucker, Leo Gutiérrez., EleKtro H@cker)
| | |-+  [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 583 veces)
The Swash

Conectado Conectado

Mensajes: 104


Programmer


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

Código
#------------------------------------------------------------------------------
# Pequeño script de escritorio para utilizar Codepad.org
# Programmer: The Swash
# Website: http://h-sec.org
#------------------------------------------------------------------------------
 
import urllib, urllib2, re
 
def GetResponse(lang, code):
   code = urllib.urlencode({'lang':lang, 'code':code,'run':'True','submit':'Submit'})
   web = urllib2.urlopen('http://codepad.org',code)
   source = web.read()
 
   resp = re.findall('<td width="100%" style="vertical-align: top">\n<div class="highlight">\n<pre>\n([^\b]+)</pre>', source)
   temp = resp[0]
   if re.findall('<a href="#line-[\d]">(.+)</a>', temp):
       err = re.findall('<a href="#line-[0-9]">(.+)</a>', temp)
       val = re.sub('<a href="#line-[0-9]">(.+)</a>', err[0], temp)
       return val
   else:
       return temp
 
langs = ('Python','C','C++','PHP','Perl','Ruby')
lang = 0
print "Bienvenido, lenguajes disponibles: \n"
length = len(langs)
for i in range(length):
   print str(i+1) + '- ' + langs[i]
 
while not((ord(str(lang)) >= 49) and (ord(str(lang)) <= 54)):
   print "Elige el numero correspondiente: "
   lang = input()
 
try:
   path = raw_input("Ingrese la ubicacion completa del archivo: ")
   lfile = open(path, "r")
   buff = lfile.read()
   lfile.close()
 
except:
   print "Error al procesar archivo"
   exit()
 
Resp = GetResponse(langs[lang-1], buff)
print "Output:\n"
print Resp
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 665 Último mensaje 19 Agosto 2008, 19:54
por Kasswed
[python] Script Blind Sql Injection
Scripting
nacho87 0 960 Último mensaje 24 Septiembre 2009, 12:11
por nacho87
[python] ayuda con script ¨^^(SOLUCIONADO)
Scripting
EvilGoblin 3 1,180 Último mensaje 17 Abril 2010, 03:02
por Novlucker
Recomendaciones, sugerencias script python
Scripting
Arnau27 1 1,121 Último mensaje 8 Septiembre 2011, 01:28
por S3kh
Ayuda con script python
Scripting
Xenomorfo77 5 381 Último mensaje 4 Mayo 2012, 02:13
por Xenomorfo77
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines