Project

General

Profile

Wiki » History » Version 68

laforge, 05/29/2024 05:48 PM

1 40 fixeria
h1. pySim WiKi
2 4 wirelesss
3 40 fixeria
{{>toc}}
4 1 laforge
5 49 laforge
pySim is a suite of programs (develped in python) for interfacing with SIM/UICC/USIM/ISIM cards.
6 1 laforge
7 64 laforge
* [[pySim-shell]] is an interactive command line tool for navigating around the card file system, reading/writing data to the files as well as administrative commands. It is the most sophisticated general purpose tool of the pySim suite and has long surpassed the capabilities of its older cousins like @pySim-prog@.
8
* [[pySim-prog]] is a small command line utility for programming a small subset of parameters like IMSI, K, OP[c], SMSP in (batches of) various programmable SIM/USIM cards.
9 49 laforge
* @pySim-read@ is a small command line utility for reading some commonly used fields of a SIM card
10 65 laforge
* [[pySim-trace]] is a high-level decoder of SIM card protocol traces (for example, traces generated by [[SIMtrace2:]])
11 49 laforge
12 39 laforge
Such SIM/USIM cards are special cards, which - unlike those issued by regular commercial operators - come with the kind of keys that allow you to write the files/fields that normally only an operator can program.
13 1 laforge
14
This is useful particularly if you are running your own cellular network, and want to issue your own SIM/USIM cards for that network.
15
16
h2. Supported Cards
17
18 49 laforge
* Generic SIM/UICC/USIM/ISIM card
19
** only ETSI/3GPP standard files supported on generic cards
20
** writing of most fields is typically not possible as nobody except the card-issuing operator posesses the keys / ADM1 PIN to write
21
* Actively supported, fully programmable cards
22 56 laforge
** [[cellular-infrastructure:sysmoISIM-SJA2]] (3GPP Release 16 SIM + USIM + ISIM)
23
** [[cellular-infrastructure:sysmoISIM-SJA5]] (3GPP Release 17 SIM + USIM + ISIM + HPSIM)
24 49 laforge
* Older fully programmable cards
25
** [[cellular-infrastructure:sysmoUSIM-SJS1]] (SIM + USIM)
26
* Older much less configurable cards
27
** [[cellular-infrastructure:GrcardSIM]] (SIM)
28
** [[cellular-infrastructure:GrcardSIM2]] (SIM)
29
** [[cellular-infrastructure:MagicSIM]] (SIM)
30 1 laforge
31 49 laforge
h2. Supported Card Interfaces ("Readers")
32 1 laforge
33 49 laforge
The best-supported/recommended configuration is to use a Smart Card Interface device compliant with the _USB CCID_ specification, using the libccid/pcsc-lite driver stack.
34 41 laforge
35 49 laforge
However, pySim supports multiple card interface back-ends:
36
37
* @pcsc@: any reader suppored by "pcsc-lite":https://pcsclite.apdu.fr/
38 41 laforge
** pcsc-lite supports any reader that provides a so-called @ifd_handler@ driver. Those could come e.g. from reader vendors, but
39 54 laforge
** pcsc-lite is very well integrated with "libccid":https://ccid.apdu.fr/, whose reader support status is indicated at https://ccid.apdu.fr/ccid/section.html
40 49 laforge
* @serial@: simple serial/UART based readers, as sometimes shipped with GRcard SIMs
41
* @calypso@: A calypso chipset based mobile phone runnung [[OsmocomBB:]]
42
* @modem_atcmd@: Any cellular modem offering the @AT+CSIM@ command
43 47 laforge
44 55 laforge
The pySim developers as well as the continuous integration / automatic testing are utilizing USB-CCID readers via pcsc-lite.  Your milage with other backends (not used much, not automatically tested) may vary!
45
46 47 laforge
h2. Documentation
47
48
h3. User Manual
49
50
The manual / documentation can be built from the source code by @(cd docs && make html latexpdf)@.
51 48 laforge
52 47 laforge
Pre-rendered versions of the current @master@ branch are available as "PDF":https://ftp.osmocom.org/docs/latest/osmopysim-usermanual.pdf and "HTML":https://downloads.osmocom.org/docs/latest/pysim/
53
54
h3. Video on pySim-shell usage
55
56 66 laforge
|_.Title|_.Event|_.Date|
57
|"pySim-shell - next generation SIM configuration tool":https://people.osmocom.org/tnt/osmodevcall/osmodevcall-20210409-laforge-pysim-shell_h264_420.mp4|OsmoDevCall|2021-04-09|
58
|"Using pySim-shell on sysmoISIM-SJA5 cards":https://media.ccc.de/v/osmodevcall-20231220-laforge-pysim-shell-sysmoisim-sja5|OsmoDevCall|2023-12-20|
59
|"Exploring eUICCs and eSIMs using pySim, lpac and osmo-smdpp":https://media.ccc.de/v/osmodevcall-20240117-laforce-euicc-esim|OsmoDevCall|2024-01-17|
60
61
h3. Recorded lectures on SIM/USIM/UICC technology
62
63
|_.Title|_.Event|_.Date|
64
|"SIM Card technology from A-Z":https://media.ccc.de/v/36c3-10737-sim_card_technology_from_a-z|36C3|2019-12-27|
65
|"SIM card profile creation, personalization, production":https://media.ccc.de/v/osmodevcall-20211022-laforge-sim|OsmoDevCall|2021-10-22|
66
|"Advanced SIM Card topics: SCP02, OTA, ARA-M, ISIM":https://media.ccc.de/v/osmodevcall-20220225-laforge-advanced-sim-topics|OsmoDevCall|2022-02-25|
67
|"Demystifying eSIM Technology":https://media.ccc.de/v/camp2023-57190-demystifying_esim_technology|ccccamp2023|2023-09-15|
68 1 laforge
|"GlobalPlatform in USIM and eUICC":https://media.ccc.de/v/osmodevcon2024-173-globalplatform-in-usim-and-euicc|OsmoDevCon2024|2024-05-04|
69 67 laforge
|"Detailed workings of OTA for SIM/USIM/eUICC":https://media.ccc.de/v/osmodevcon2024-175-detailed-workings-of-ota-for-sim-usim-euicc|OsmoDevCon2024|2024-05-04|
70 68 laforge
|"onomondo softsim":https://media.ccc.de/v/osmodevcon2024-180-onomondo-softsim-a-software-usim-implementation|OsmoDevCon2024|2024-05-04|
71 47 laforge
72 62 laforge
h3. Installation instructions
73 1 laforge
74 60 laforge
Please follow the instructions provided in [source:README.md]
75
76 61 laforge
h3. Usage instructions
77 16 wirelesss
78 37 wirelesss
* Connect SIM card reader.
79 1 laforge
* Insert programmable SIM card
80 37 wirelesss
81 61 laforge
h4. Check the status of connection by entering the following command:
82 37 wirelesss
83 34 wirelesss
<pre>
84 37 wirelesss
 pcsc_scan
85 5 wirelesss
</pre>
86 37 wirelesss
87 32 wirelesss
* If SIM card reader is recognised then we can expect something similar to the below output:
88 37 wirelesss
89 5 wirelesss
<pre>
90
 $ pcsc_scan
91 1 laforge
 PC/SC device scanner
92 5 wirelesss
 V 1.4.25 (c) 2001-2011, Ludovic Rousseau ludovic.rousseau@free.fr
93
 Compiled with PC/SC lite version: 1.8.14
94
 Using reader plug'n play mechanism
95
 Scanning present readers...
96
 0: SCM Microsystems Inc. SCR 3310 [CCID Interface] 00 00 
97
 Tue Oct 18 11:48:08 2016
98
 Reader 0: SCM Microsystems Inc. SCR 3310 [CCID Interface] 00 00
99
 Card state: Card inserted, 
100
 ATR: 3B 99 18 00 11 88 22 33 44 55 66 77 60
101
 + TS = 3B --> Direct Convention
102
 + T0 = 99, Y(1): 1001, K: 9 (historical bytes)
103 20 wirelesss
  TA(1) = 18 --> Fi=372, Di=12, 31 cycles/ETU
104 1 laforge
  129032 bits/s at 4 MHz, fMax for Fi = 5 MHz => 161290 bits/s
105 20 wirelesss
  TD(1) = 00 --> Y(i+1) = 0000, Protocol T = 0 
106 1 laforge
 -----
107
 + Historical bytes: 11 88 22 33 44 55 66 77 60
108 20 wirelesss
 Category indicator byte: 11 (proprietary format)
109 1 laforge
 Possibly identified card (using /usr/share/pcsc/smartcard_list.txt):
110
 3B 99 18 00 11 88 22 33 44 55 66 77 60
111
 sysmocom sysmoSIM-GR1
112
113 20 wirelesss
</pre>
114 37 wirelesss
115 20 wirelesss
** Exit pcsc_scan : _Ctrl+C_
116 37 wirelesss
117 61 laforge
h4. Read (a few fields of) your SIM card
118 5 wirelesss
119
 ./pySim-read.py -p0 or ./pySim-read.py -p1 
120 32 wirelesss
121 37 wirelesss
* Using sysmoSIM-GR1 and if everything is done correctly, you will see something similar to:
122 1 laforge
 
123 37 wirelesss
<pre>
124 1 laforge
 $ ./pySim-read.py -p0 
125 5 wirelesss
 Reading ...
126
 ICCID: 1791198229180000071
127
 IMSI: 001640000000071
128
 SMSP: ffffffffffffffffffffffffe1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
129
 ACC: ffff
130
 MSISDN: Not available
131
 Done !
132 37 wirelesss
133 43 laforge
</pre>
134 44 roh
135 63 laforge
h4. bulk programming of some common SIM parameters
136
137
See [[pySim-prog]] 
138
139
h4. interactive exploration and/or programming of any parameter in any file
140
141
See [[pySim-shell]]
142
143 61 laforge
h2. Continuous Integration / Automatic Testing
144 45 laforge
145 44 roh
pySim is continuously and automatically tested by a [[TestRig]] run by sysmocom
146 45 laforge
147 1 laforge
{{include(cellular-infrastructure:MacroCommercialSupport)}}
Add picture from clipboard (Maximum size: 48.8 MB)