1PCSC-SPY(1) PC/SC lite PCSC-SPY(1)
2
3
4
6 pcsc-spy - A PC/SC spy command
7
9 pcsc-spy [-n|--nocolor] [-d|--diffable] [-h|--help] [-v|--version]
10 [-t|--thread] [fifo_filename]
11
13 pcsc-spy displays PC/SC calls of an application. It must be used with
14 the libpcscspy.so library.
15
16 To be able to spy the PC/SC layer, the application flow must be
17 modified so that all PC/SC calls are redirected. Two options are
18 available:
19
20 - the application is linked with libpcsclite.so.1
21 - the application loads the libpcsclite.so.1 library using dlopen(3)
22
24 -d, --diffable
25 Remove the variable parts (like handler values) from the output so
26 that two execution can be more easily compared.
27
28 -h, --help
29 Display a short help text.
30
31 -n, --nocolor
32 Disable the output colorization (if you want redirect the output in
33 a file for example).
34
35 -v, --version
36 Print the version of the pcsc-spy program plus a copyright, a list
37 of authors.
38
39 -t, --thread
40 Add a thread number before each line of log to identify the calls
41 from the same threads.
42
44 Applications linked with libpcsclite.so.1
45 We will use the standard "LD_PRELOAD" loader option to load our spying
46 library.
47
48 Example:
49
50 LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libpcscspy.so pcsc_scan
51
52 Application loading libpcsclite.so.1
53 This is the case for the PC/SC wrappers like pyscard (for Python) and
54 pcsc-perl (for Perl). The LD_PRELOAD mechanism can't be used. Instead
55 we replace the libpcsclite.so.1 library by the spying one.
56
57 You may use install_spy.sh and uninstall_spy.sh to install and
58 uninstall the spying library.
59
60 Using the spying library without pcsc-spy is not a problem but has side
61 effects:
62
63 - a line "libpcsclite_nospy.so.1: cannot open shared object file: No
64 such file or directory" will be displayed
65
66 - some CPU time will be lost because of the PC/SC calls redirection
67
68 Starting the spy tool
69 pcsc-spy
70
71 If a command argument is passed we use it instead of the default
72 ~/pcsc-spy FIFO file. It is then possible to record an execution log
73 and use pcsc-spy multiple times on the same log.
74
75 To create the log file just do:
76
77 mkfifo ~/pcsc-spy
78 cat ~/pcsc-spy > logfile
79
80 and run your PC/SC application.
81
83 ~/pcsc-spy FIFO file is used by libpcsclite.so.1 to send the raw log
84 lines
85
87 pcscd(8)
88
90 This manual page was written by Ludovic Rousseau <rousseau@free.fr>
91
92
93
94pcsc-lite 1.9.4 2021-10-04 PCSC-SPY(1)