scsniff

scsniff grabs serial data captured from between smart card and reader, and formats it so that it can be analyzed. The stream of data is split into packets, and the direction of each transfer is shown (when it can be known).

The sniffer adjusts protocol and baud rate based on what is negotiated between the card and the reader.

The code as available at https://github.com/yarrick/scsniff, and is released under the ISC license.

Running it looks like this:
$ ./scsniff /dev/ttyUSB0 5600
== Opened /dev/ttyUSB0
== Speed: 5600 baud
== Waiting for reset..  Done
+0.023680s | CARD>>> | 3B 7F 18 00 00 43 55 32 69 AA 20 00 32 20 20 20 20 20 20 00
+0.072785s | CARD<<< | FF 10 13 FC
+0.083557s | CARD>>> | FF 10 13 FC
== Switching to 93 ticks per ETU (22400 baud) after PPS
+0.106063s | CARD<<< | 00 CA 01 00 00
+0.109960s | CARD>>> | 6C 16
+0.111310s | CARD<<< | 00 CA 01 00 16
+0.115236s | CARD>>> | CA
+0.115794s | CARD>>> | 43 6F 6D 62 4F 53 20 55 42 53 20 41 63 63 65 73 73 20 43 61 72 64
+0.128261s | CARD>>> | 90 00
^C

This is the data logger used for development (card into black part, right side into reader):


Back to code.kryo.se
Contact us: code at kryo dot se