Relative Content

Tag Archive for c++linuxkeylogger

Keylogger. How to get a character from a key code?

I need to write a keylogger for Linux that would match the keys pressed with the process to which the input belonged at that moment. After reading various articles on the Internet and looking at many examples of keylogging implementation, I chose the method – subscribe to events from X11. Those. I subscribe to keyboard events and get keypresses in any window. But unfortunately, I can’t solve two problems: I get some code for the key pressed and I can’t translate it into a symbol on the keyboard, taking into account the language layout. The second difficulty is that I can’t find the PID of the process to which the keyboard input belonged at that moment in time. Can anyone tell me how to solve my two problems?