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 the pcsc-spy program, 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 by libpcscspy.so.0 to 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 is perl v5.42.0, dated 2024-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