Writing a keylogger application in Windows
This post is a little bit of a side-step. I was looking through the linux programming interface and set myself a task to obtain keyboard input using only unix commands. One problem: I only have access to a windows PC at the moment! While I could use a virtual machine, I thought it would be interesting to try and do the same thing in Windows using various methods. The code for this post is on my git here . The first method was to avoid using the Windows API as much as possible. The second was to use the SetWindowsHookEx method. Method I If you look at the code on my github, inside the main function we have something like this while ( 1 ) { for ( char i = 0 ; i < 127 ; i ++ ) { if (GetAsyncKeyState(i) == - 32767 ) { of << i; of.flush(); } } } The only alien command is GetAsyncKeyState. This obtains the current state of the key. Using GetKeyState would be the wrong thing to do as we are not...