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/.

Harald Welte laforge at gnumonks.org
Tue Apr 6 22:49:57 UTC 2021


Dear Osmocom community,

two months later, a lot of work has been going into pySim-shell. The following
features are now available from pysim.git master:

* we now have a 'tree' command to list the filesystem hierarchy

* you can now select arbitrary files by FID, even those not specified in 3GPP

* there is now an 'export' command, which will iterate over all records in all
  files and dump them in an output format that can be used by pySim-shell itself
  to restore the data

* we have the start of a user manual including a reference to the various
  pySim-shell comamnds. A preview is available at
  https://people.osmocom.org/laforge/tmp/pysim-doc-test/html/

* you can now use python setuptools to build and install dependencies, etc.

* pySim-shell can retriev the card-specific ADM PIN from a CSV file in your home

The latest invention (just pushed to gerrit for review) is the
integration of JSONpath support, wich allows you to specify certain
parts of a decoded file or record[s] to be updated.  If you've never
heard of JSONpath: It is to JSON what XPath is to XML.

First example on how to use this:

------------------------------------------
pySIM-shell (MF/ADF.USIM/EF.FPLMN)> read_binary_decoded
[
    {
        "mcc": 262,
        "mnc": 42
    },
    {
        "mcc": 262,
        "mnc": 42
    },
    {
        "mcc": 262,
        "mnc": 42
    },
    {
        "mcc": 262,
        "mnc": 42
    }
]
pySIM-shell (MF/ADF.USIM/EF.FPLMN)> update_binary_decoded --json-path [*] null
pySIM-shell (MF/ADF.USIM/EF.FPLMN)> read_binary_decoded
[
    null,
    null,
    null,
    null
]
pySIM-shell (MF/ADF.USIM/EF.FPLMN)> update_binary_decoded --json-path [2] '{"mcc":"262", "mnc":"42"}'
pySIM-shell (MF/ADF.USIM/EF.FPLMN)> read_binary_decoded
[
    null,
    null,
    {
        "mcc": 262,
        "mnc": 42
    },
    null
]
------------------------------------------

Second example, illustrating its use in more complex JSON types:

------------------------------------------
pySIM-shell (MF/ADF.USIM/EF.AD)> read_binary_decoded
{
    "ms_operation_mode": "normal",
    "specific_facilities": {
        "ofm": true
    },
    "len_of_mnc_in_imsi": 2
}
pySIM-shell (MF/ADF.USIM/EF.AD)> update_binary_decoded --json-path specific_facilities.ofm false
pySIM-shell (MF/ADF.USIM/EF.AD)> read_binary_decoded
{
    "ms_operation_mode": "normal",
    "specific_facilities": {
        "ofm": false
    },
    "len_of_mnc_in_imsi": 2
}
------------------------------------------

Stay tuned for more pySim developments coming up.  Any feedback is
welcome - as is help with writing encoder/decoder methods for all the
files that don't have any yet.

Regards,
	Harald

-- 
- Harald Welte <laforge at gnumonks.org>           http://laforge.gnumonks.org/
============================================================================
"Privacy in residential applications is a desirable marketing option."
                                                  (ETSI EN 300 175-7 Ch. A6)



More information about the OpenBSC mailing list