0

I am interested in a keylogger that logs all keys pressed, especially Ctrl, Alt, Shift, Alt Gr and all the media hotkeys such as Play, Stop, Next, Previous and so on.

As I only found keyloggers that do record neither Ctrl, Alt and Shift as isolated keys nor media hotkeys, I started to gather code snippets in Python which should provides all functionality to code such a simple keylogger on my own.

On the one hand I found pywinusb which is able to record media keys coming from a HID, on the other hand I found code snippets like this one.

I added print "event.Ascii = ", event.Ascii to get the ASCII value, but for Ctrl, Alt and Shift, the output always is event.Ascii = 0. Is there a way to determine those keys with any available library? I finally want to be able to run the keylogger in the background, so it is not suitable to use wxPython for example, since apparently the key press events always have to be bound to something inside a frame, and when being in a different window, no keys are being logged.

Alfe
  • 56,346
  • 20
  • 107
  • 159
  • try the code snipped described here: https://books.google.com/books?id=9MS9BQAAQBAJ&pg=PA114&dq=keylogger+python+ctrl&hl=en&sa=X&redir_esc=y#v=onepage&q=keylogger%20python%20ctrl&f=false they specifically describe how to deal with special keys like ctrl and alt. The book is Black Hat Python: Python Programming for Hackers and Pentesters. – Maximilian Peters Apr 21 '16 at 15:32
  • Exactly what I was looking for, thank you. Mainly it is about using `event.Key` instead of `event.Ascii`. (I can't find the "accept" option on your answer, sorry.) – ajaulensaek Apr 22 '16 at 05:50

0 Answers0