PCSC-SPY(1)
π pcsc-spy β the PC/SC spy command, bestie
okay so real talk: this is pcsc-spy, and it lives in the User Contributed Perl Documentation section of the manual (that's the manual name, iykyk β section 1 π). It's a little spy tool for your smartcard stack and honestly it's giving main character energy. Let's get into it.
β¨ SYNOPSIS β¨
pcsc-spy [-n|--nocolor] [-d|--diffable] [-h|--help] [-v|--version]
[-t|--thread] [fifo_filename]
That's the whole vibe check right there. π
π¦ DESCRIPTION π¦
So pcsc-spy displays PC/SC calls of an application. It literally watches everything your app says to the PC/SC layer and prints it out. Iconic. π
But β and this is important β it must be used with the libpcscspy.so.0 library. No library, no spying. That's the deal. π€
And to be able to spy on the PC/SC layer, the application flow has to be modified using LIBPCSCLITE_DELEGATE, so that all PC/SC calls get redirected. That's the whole trick, no cap. πͺ
πΈ OPTIONS πΈ
-d,--diffableβ removes the variable parts (like handler values, for example) from the output, so you can compare two executions way more easily. Slay for diffing. π-h,--helpβ displays a short help text. The classic. π«Ά-n,--nocolorβ disables the output colorization. Use this if you wanna redirect the output into a file, for example. (RIP the pretty colors, but at least your log file isn't a crime scene. π)-v,--versionβ prints the version of thepcsc-spyprogram, plus a copyright, plus a list of authors. Give the people credit fr fr. π-t,--threadβ adds a thread number before each line of the log, so you can identify which calls came from the same threads. Multi-threaded chaos, but organized. π§΅
π§ EXAMPLES π§
So we're gonna use the LIBPCSCLITE_DELEGATE environment variable to load our spying library. That's the move. β¨
Example:
sh /usr/share/doc/libpcsclite-dev/setup_spy.sh
export LIBPCSCLITE_DELEGATE=/lib/x86_64-linux-gnu/libpcscspy.so.0
LIBPCSCLITE_DELEGATE=/lib/x86_64-linux-gnu/libpcscspy.so.0 my_application
Like, that's literally it. Set the variable, run your app, watch the magic. π
π₯ Starting the spy tool
pcsc-spy
Okay so if a command argument is passed, we use it instead of the default ~/pcsc-spy FIFO file. And once you do that, it's then possible to record an execution log and use pcsc-spy multiple times on the same log β yes, rewatch the whole thing, it's that good. π
To create the log file, just do:
mkfifo ~/pcsc-spy
cat ~/pcsc-spy > logfile
and then run your PC/SC application. Boom. Logged. π
π FILES π
~/pcsc-spyβ the FIFO file used bylibpcscspy.so.0to send the raw log lines. That's the whole pipeline, bestie. π
β SEE ALSO β
π AUTHOR π
This manual page was written by Ludovic Rousseau <rousseau@free.fr>. Thank you king, we appreciate you. π«Άπ
lowkey a reminder: this page isperl v5.42.0, dated2024-01-01β that's the version and date of this little doc, so now you know exactly where it came from. π
okay that's the whole page, go forth and spy responsibly, mwah π§β¨π
π¦ where this page comes from
- alpine 3.23: pcsc-lite-doc 2.4.0-r1 Β· BSD-3-Clause AND BSD-2-Clause AND ISC
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms