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