blob: 637491af64701f695bf96a57fb587798d9e5628c [file] [log] [blame]
Harald Welte7e555692023-06-09 11:14:44 +02001pySim-trace
2===========
3
4pySim-trace is a utility for high-level decode of APDU protocol traces such as those obtained with
5`Osmocom SIMtrace2 <https://osmocom.org/projects/simtrace2/wiki>`_ or `osmo-qcdiag <https://osmocom.org/projects/osmo-qcdiag/wiki>`_.
6
7pySim-trace leverages the existing knowledge of pySim-shell on anything related to SIM cards,
8including the structure/encoding of the various files on SIM/USIM/ISIM/HPSIM cards, and applies this
9to decoding protocol traces. This means that it shows not only the name of the command (like READ
10BINARY), but actually understands what the currently selected file is, and how to decode the
11contents of that file.
12
13pySim-trace also understands the parameters passed to commands and how to decode them, for example
14of the AUTHENTICATE command within the USIM/ISIM/HPSIM application.
15
16
17Demo
18----
19
20To get an idea how pySim-trace usage looks like, you can watch the relevant part of the 11/2022
21SIMtrace2 tutorial whose `recording is freely accessible <https://media.ccc.de/v/osmodevcall-20221019-laforge-simtrace2-tutorial#t=2134>`_.
22
23
24Running pySim-trace
25-------------------
26
27Running pySim-trace requires you to specify the *source* of the to-be-decoded APDUs. There are several
28supported options, each with their own respective parameters (like a file name for PCAP decoding).
29
30See the detailed command line reference below for details.
31
32A typical execution of pySim-trace for doing live decodes of *GSMTAP (SIM APDU)* e.g. from SIMtrace2 or
33osmo-qcdiag would look like this:
34
35::
36
37 ./pySim-trace.py gsmtap-udp
38
39This binds to the default UDP port 4729 (GSMTAP) on localhost (127.0.0.1), and decodes any APDUs received
40there.
41
42
43
44pySim-trace command line reference
45----------------------------------
46
47.. argparse::
48 :module: pySim-trace
49 :func: option_parser
50 :prog: pySim-trace.py
51
52
53Constraints
54-----------
55
56* In order to properly track the current location in the filesystem tree and other state, it is
57 important that the trace you're decoding includes all of the communication with the SIM, ideally
58 from the very start (power up).
59
60* pySim-trace currently only supports ETSI UICC (USIM/ISIM/HPSIM) and doesn't yet support legacy GSM
61 SIM. This is not a fundamental technical constraint, it's just simply that nobody got around
62 developing and testing that part. Contributions are most welcome.
63
64