keylogger-osx icon indicating copy to clipboard operation
keylogger-osx copied to clipboard

keystroke.log gets created but doesnt record anything

Open moulie415 opened this issue 9 years ago • 3 comments

When i run the program keystroke.log gets created but it isnt recording anything, can u help?

moulie415 avatar Jul 08 '15 16:07 moulie415

Having the same issue here

williamfiset avatar Aug 19 '15 22:08 williamfiset

Hi, The same for me but it's not really important because the code can be changed. For instance, if you comment L49:

// fprintf(logFile, "%s %s\n", fmtTime, keyCodeToReadableString(keyCode));

and replace simply by a console output:

printf("%s %s\n", fmtTime, keyCodeToReadableString(keyCode));

Then, it works like a charm when launched with sudo. Though, since my keyboard layout is not QWERTY (I am French, we have AZERTY and it sucks) it responds like if I had a US keyboard. Doesn't really matter, just have to tweak the keyCodeToReadableString() function.

jonathanlurie avatar Mar 05 '16 19:03 jonathanlurie

@moulie415, @williamfiset, @jonathanlurie, and whom it may concern.

In order to write to the log file without terminating the execution you need to close the file handle with fclose or flush the buffer with fflush. Otherwise the entire buffer is not saved to the file while the program is running. It depends on where the buffer is kept, but it either writes on successful termination or gets deleted instead. See this SO answer for reference.

To get an idea of how you would go about flushing see these lines in caseyscarborough's keylogger.

Sorry for bumping a corpse.

CC: @dannvix

cytodev avatar Feb 22 '17 20:02 cytodev