WIP / RFC for pysim 'next generation;' aka pysim-shell

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Mychaela Falconia mychaela.falconia at gmail.com
Thu Feb 4 07:01:19 UTC 2021


[Responding to Harald's updates regarding pysim-shell]

Just as an FYI, if there is anyone else besides me who strongly
dislikes Python, and/or finds Python3-based stuff extremely difficult
to get working under Slackware, I just recently (between Jan 24 and
now) implemented my own alternative SIM and UICC manipulation tools
written in pure C, interfacing to CCID card "readers" via pcsc-lite.
The tools live in my freecalypso-hwlab Hg repository:

https://www.freecalypso.org/hg/freecalypso-hwlab/

simtool directory under the top level contains fc-simtool, and uicc
directory contains fc-uicc-tool.  As with most of my software, the
source code is the only documentation at the moment.  fc-simtool
speaks GSM 11.11 protocol to the card, fc-uicc-tool speaks the UICC
protocol per ETSI TS 102 221.  The principal difference is in the CLA
byte of each command and the format of SELECT responses.  I wrote
fc-simtool first, then ported some of the commands to fc-uicc-tool,
but not all functionality of the former is replicated in the latter,
only a subset.  Both tools operate as an interactive shell, with a
minimal scriping facility also included.

Right now not a whole lot of functionality is implemented, just enough
for the use cases of interest to me at the moment:

* fc-simtool can be used to test SIMs for 2G compatibility, i.e.,
distinguish good SIMs that support GSM 11.11 from evil ones that have
this support artificially removed, even though the physical 2G RAN is
still operational.  In USA there is only one physical operator with a
GSM/2G network, but a whole slew of MVNOs running on it; some MVNO
SIMs are still good, and fc-simtool works to test and identify them.

* In his talk about SIM cards at the last CCC, Harald made a statement
along the lines of "no one stores contacts on SIMs any more".  That
statement is factually wrong because I am still alive - once I die,
Harald's statement will become correct, but for as long as I am alive,
there is One Person On The Planet who does store contacts on SIMs -
and that person is me!  fc-simtool aids defiant users like me by
providing commands to dump, restore and manually edit SIM phonebooks,
and it also provides a save-sms-bin command to save the content of
EF_SMS (SIM SMS store) in a binary file which can then be fully
decoded with pcm-sms-decode from FC host tools package.

* fc-uicc-tool in its current state is mostly for testing whether or
not a given card has USIM and/or ISIM applications in addition to
classic SIM.  It can dump EF_DIR in decoded form, but it also allows
a select-aid command to be issued manually, without going through
EF_DIR.  The latter capability is intended to detect whether or not a
given card "really truly" has USIM/ISIM or not, even if someone wrote
all FF bytes into EF_DIR to hide them.  By the ETSI spec the SELECT by
AID command allows truncated AIDs, i.e., one can send just the first 7
bytes of USIM or ISIM AID that are known without reading EF_DIR, and
at least sysmoISIM-SJA2 accepts such truncated AIDs - I have yet to
test on other cards.

My ideal dream SIMs for running my own GSM/2G network (a network whose
sole purpose is to provide service to classic GSM/2G phones) would be
those that have only the classic SIM application, and NO USIM or ISIM.
And I would really like for USIM and ISIM to be truly-truly Not There,
rather than just hidden from EF_DIR.  I am currently in negotiations
with Grcard in China, who are telling me that they can supply me with
such SIMs, and at an affordable price too, without a cost-prohibitive
MOQ.  They are in the process of sending me a few sample pieces
(hoping they will actually go out before China closes for Lunar New
Year), I will test them with fc-simtool and fc-uicc-tool (the latter
to verify the absence of unwanted USIM and ISIM), and if these sample
cards really are what I want, then I will place a bigger order with
custom printing (FreeCalypso Community SIM), and I will make 10-pack
sets of these SIMs available to the GSM/2G community in the same
manner as how Sysmocom sells their USIM/ISIM-enabled version.  1FF+2FF
form factor of course, with the 2FF card being a fully solid piece, NO
3FF or 4FF cuts - the whole purpose is to provide service to users of
traditional GSM/2G phones, *not* "modern" abomination smartphones.  If
you need to stick one of these SIMs into an Abomination phone, cut it
down yourself.  And of course fc-simtool will be the officially
recommended tool for programming these GSM-only SIMs. :-)

Hasta la Victoria, Siempre,
Mother Mychaela of FreeCalypso



More information about the OpenBSC mailing list