I am currently creating a c program that counts all of the keys I press in a day and sorts the key types by amount, so I can tell which ones I press most often. It was more of a side project than anything else but I have become annoyed with the fact that my program doesn't seem to be able to intercept any input to password fields. I suppose this is a good thing, but I have been spending hours looking at documentation and trying to figure how to do this. I am not trying to create any sort of malicious software. Is there a way around this? My program is running as root. I am using the ApplicationServices
framework and CGEventRef
and the CGEventTapCreate
funcion. Should I be using a different framework or struct? Also, is there a difference between kCGHIDEventTap
, kCGSessionEventTap
, and kCGAnnotatedSessionEventTap
? I have tried using each of them and it does not seem to make a difference in my program.
I am running this on OS X 10.9
UPDATE Apparently I cannot capture keystrokes going to terminal either, which is where I spend most of my time on my laptop. This is a problem.