Smart Card Digging Utilities

It is time to wipe out the dust and disclose more x-files from my personal
archive. Some of you have asked and waited for this particular one for few years
already. Thus, without further ado, let me introduce SMACADU – Smart Card Digging
(or Dumb if you wish) Utilities. It is a set of very simple command line tools
to poke around smart cards. By using these tools, you may explore an unknown or
an obscure smart card to reveal its layout and functionality. There are three
tools in SMACADU: smacdig, smacget and smactty.

smacdig

This tool let you map all existing objects within specified Dedicated File, even
if the smart card does not have DIR command or it tries to hide an object from
DIR. Such mapping is a continuous procedure which you may terminate any moment
by pressing a key. You may also specify a DF path and/or initial object ID to
start from.

smacget

You can dump any publicly accessible Elementary File (EF) from smart card to file
by using smacget. Simply specify the full path of EF and it will be
extracted to file named as EF's ID.

smactty

This is the APDU console that you may use to directly send commands to a smart
card. To use this tool, you need to know what is PC/SC and at least
C0 A4 00 00 02 3F 00 must ring some bells.

Run any of these tools without parameters will output usage info and a list of
available smart card readers. You must specify desired smart card reader by its
name as a first parameter then. You do not need to specify a whole name actually.
A unique substring from the name would do just fine. For smactty, you may
specify characters inside APDU commands as is, without remembering their hexadecimal
representation by using "-" in front of a character. For example, you may simply
type -p-a-s-s-w-o-r-d instead of 70 61 73 73 77 6F 72 64.

SMACADU were written as Windows console applications to be compiled with
Microsoft Visual C compiler. If you want to port these utilities to gcc/Linux
then feel free to do so. The source code is provided below.