method to log stdin characters to any command line program (linux)?

时间:2018-02-01 18:37:17

标签: logging stdin

On linux is there a tool to see exactly which characters a certain program is reading from stdin? Preferably logging them to a file with time stamps, but just logging them raw to a file will do.

This input is actually translated characters from an IR remote, and I need to see exactly which ones and how many are actually reaching the application. In this case I'm working with somebody else's binary, and even if I did get a version of the source code and compiled it the issue is not actually in the target program, it is upstream. So a more general solution would be preferred. The intercepting tool can be run as root, if that is required.

Note that in this case the program whose input I want to monitor is normally started by yet another program. So what I'm looking for is a tool that does something like:

   intercept -stdin -pid $PID_OF_RUNNING_PROGRAM -log file

0 个答案:

没有答案