Last active
August 29, 2015 14:07
-
-
Save agalazis/e747b448100fbf8633a8 to your computer and use it in GitHub Desktop.
sample stdout spying script for a process using strace (in this case for mplayer)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#track all (write sys call) output but clear from system call functions(only the text in quotes) | |
strace -p$(pgrep mplayer |head -n1 ) -s9999 -e write 2>&1 |grep -Po '".*?"' | |
#track volume changes | |
strace -p$(pgrep mplayer |head -n1 ) -s9999 -e write 2>&1 |grep -Po 'KVolume.*? %' | |
#track information and volume changes | |
strace -p$(pgrep mplayer |head -n1 ) -s9999 -e write 2>&1 |grep -Po 'KVolume.*? %|Title:.*?\\n|Album:.*?\\n|Year:.*?\\n|Track:.*?\\n' | |
#or | |
strace -p$(pgrep mplayer |head -n1 ) -s9999 -e write 2>&1 |grep -Po 'KVolume.*?\\n|Title:.*?\\n|Album:.*?\\n|Year:.*?\\n|Track:.*?\\n' | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment