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