Commit Graph

21 Commits

Author SHA1 Message Date
Harald Welte a630a3cd28 cosmetic: Remove extraneous empty lines between spec-section-comment and class
This is an artefact of the recent autopep8 re-formatting.

Change-Id: I8b0e7781719d69e18856ada2f482de2c5396bcc3
2022-02-14 00:51:27 +01:00
Harald Welte 6169c72f82 USIM + ISIM: Specify the services associated with each file
This allows us [in a future patch] to perform consistency checking,
whether files exist for services not activated in EF.{UST,IST} or
vice-versa: Services are activated by files are not present or
deactivated.

Change-Id: I94bd1c3f9e977767553000077dd003423ed6dbd1
2022-02-14 00:51:27 +01:00
Harald Welte c91085e744 cosmetic: Switch to consistent four-spaces indent; run autopep8
We had a mixture of tab and 4space based indenting, which is a bad
idea.  4space is the standard in python, so convert all our code to
that.  The result unfortuantely still shoed even more inconsistencies,
so I've decided to run autopep8 on the entire code base.

Change-Id: I4a4b1b444a2f43fab05fc5d2c8a7dd6ddecb5f07
2022-02-11 13:32:58 +01:00
Harald Welte e8947493e6 Better decode of EF.UST, EF.EST and EF.IST
So far, we only returned an array of service numbers like
[ 2, 4, 5, 9 ] which is not very friendly to the human reader.

In EF.SST we already had more verbose decoding including a description
of each service.  Let's add the same principle to EF.UST, EST and IST

The same output above now looks like this:

{
    "1": {
        "description": "Local Phone Book",
        "activated": false
    },
    "2": {
        "description": "Fixed Dialling Numbers (FDN)",
        "activated": true
    },
    "3": {
        "description": "Extension 2",
        "activated": false
    },
    "4": {
        "description": "Service Dialling Numbers (SDN)",
        "activated": true
    },
    "5": {
        "description": "Extension3",
        "activated": true
    },
    "6": {
        "description": "Barred Dialling Numbers (BDN)",
        "activated": false
    },
    "7": {
        "description": "Extension4",
        "activated": false
    },
    "9": {
        "description": "Incoming Call Information (ICI and ICT)",
        "activated": true
    }
}

Change-Id: I34f64d1043698dc385619b2fdda23cb541675f76
2022-02-10 17:06:30 +01:00
Philipp Maier 5998a3a8b3 profile: decode_select_response can be a static method
The method decode_select_response does not access any property of the
object. This means the method can be static.

Change-Id: Idd7aaebcf1ab0099cd40a88b8938604e84d8a88b
2021-11-19 13:21:32 +01:00
Philipp Maier 57f65eedfc ts_31_10x: add a class for CardApplicationXSIM
In change Id410489841bb9020ddbf74de9114d808b1d5adb6, the RuntimeState
class automatically adds additional files to the CardApplications for
ISIM and USIM. This works only once. The second time an exception will
be thrown because the added files are already in the CardApplication.
Currently there is no way generate new card applications during
initialization because the card applications are just objects that are
created once in ts_31_10x.py. Lets turn them into classes and create the
objects during initialization. This way we get fresh objects when we
re-initialize.

Change-Id: Ibb4f6242e7a92af84a905daa727b1b87016e7819
2021-10-18 14:18:33 +02:00
Harald Welte 14105dce99 implement more files with TLV + construct
This adds encoding/decoding for more files, from 51.011 (SIM)
to 31.102 (USIM) and 31.103 (ISIM)

Change-Id: I6083d2bb0a307f660f09af384803f84e4098a5ed
2021-06-13 22:31:05 +02:00
Philipp Maier 86b09da61d ts_31_103: finish decoder and fix encoder for EF.PCSCF
The encoder/decoder functions in class EF_PCSCF look rather unfinshed
because of problems with dec_addr_tlv(), since those problems are fixed
by a previous patch we can now finish the decoder function and fix the
decoder as well.

Change-Id: I7613b8b71624dc5802aca93163788a2a2d4ca345
Related: OS#4963
2021-05-23 10:05:50 +00:00
Harald Welte fc4833ec20 ts_31_103: Use EF_ARR decoder from TS 102 221
We already used that decoder also in ts_31_102

Change-Id: Iaab9f038544b5914405568b072731d3847c9d017
2021-05-04 13:24:07 +02:00
Harald Welte 278816251d filesystem.py: Introduce place-holder for BER-TLV files
I always assumed BER-TLV files are transparent EF with BER-TLV contents.

However, this is wrong. ETS TS 102 221 Section 8.2.2.4 specifies them.

TS 102 221 Section 11.3 describes the specific RETRIEVE DATA, SET DATA
commands, which are not yet implemented in pySim.

Change-Id: Ie4701d9f72b05c8a5810e287e55a20f6ea86a574
2021-04-24 11:43:04 +02:00
Harald Welte 71290077b9 ts_31_102, ts_31_103: Add EF.FromPreferred
Change-Id: I7dc989a4ab198f3eaa45ba7060c8087354a544bb
2021-04-24 11:43:04 +02:00
Harald Welte 16ec96a0c9 ts_31_103: Add Rel 16.6 enhancements (MuDMiDConfigData)
Change-Id: I54046375f180017373ab8e06e60ac5a542da706a
2021-04-24 11:43:04 +02:00
Harald Welte 35dfe826c0 ts_31_103: Use EF_SMS, EF_SMSS, EF_SMSR, EF_SMSP from ts_51_011
Change-Id: I688cfddcf5845316f71a9641d4426a20f58c1fba
2021-04-24 11:43:04 +02:00
Harald Welte c9cdce3e02 fix various typos all over the code
Change-Id: Ic8392a951bf94f67b51e35bed95d0e856f7a9250
2021-04-11 12:20:29 +02:00
Harald Welte 15fae98d2e pySim-shell: Authenticate (3g) support
This adds support for AUTHENTICATE to the USIM and ISIM application,
based on the newly-introduced 'construct' encoder/decoder support.

Change-Id: Id5697463e29c3dceff98bcf80f5400f7f2bcaa6c
2021-04-11 12:20:29 +02:00
Harald Welte 89e5954773 fix various file definitions
As we can notice during 'export': Some files had been defined
as LinFixed but are Transparent - and vice versa.  Let's fix those
an bring our definitions in sync with the specs.

Change-Id: I365ece7b82a1c79b3af87a79ff964d7989362789
2021-04-02 22:05:28 +02:00
Harald Welte b2edd14475 Add a new pySim-shell program
pySim-prog was nice when there were only 5 parameters on a SIM that we
could program, and where the use case was pretty limited.  Today, we
have SIM/USIM/ISIM cards with hundreds of files and even more parameters
to program.  We cannot add a command line argument for each file to
pySim-prog.

Instead, this introduces an interactive command-line shell / REPL,
in which one can navigate the file system of the card, read and update
files both in raw format and in decoded/parsed format.

The idea is primarily inspired by Henryk Ploatz' venerable
cyberflex-shell, but implemented on a more modern basis using
the cmd2 python module.

See https://lists.osmocom.org/pipermail/simtrace/2021-January/000860.html
and https://lists.osmocom.org/pipermail/simtrace/2021-February/000864.html
for some related background.

Most code by Harald Welte. Some bug fixes by Philipp Maier
have been squashed.

Change-Id: Iad117596e922223bdc1e5b956f84844b7c577e02
Related: OS#4963
2021-03-03 08:43:38 +01:00
Vadim Yanitskiy 6d5e0c9272 Remove Python shebang from files where it's not needed
Change-Id: I1d08544c37f50416acf8dc30139c572c029790d0
2021-03-01 17:33:46 +01:00
Supreeth Herle 28484d03e3 Update ISIM IST table as per the 3GPP TS 31.103 specification V15.6.0
Change-Id: I8f6a96721beb9621ac453715cf2d0303989cfe85
2021-01-05 11:46:41 +01:00
herlesupreeth 75c14c0cbd ts_31_103.py: Add ADF map for files at ISIM ADF
EF_ISIM_ADF_map introduced in this commit maps EF file names in ISIM ADF
to its repective Identifier and serves as a lookup table

Change-Id: I95c8691d9112541c2c0e01857b19681c00f322f2
2021-01-05 10:06:19 +01:00
Supreeth Herle 8b72c27270 Define mapping between ISIM Service Number and its description
This commit introduces a lookup table which maps ISIM Service Number to its description.
The mapping is defined in 3GPP TS 31.103 version 14.2.0 Release 14, 4.2.7 EF.IST (ISIM Service Table)

Change-Id: Iad51d0804259df47729308b461062f794b135e66
2020-04-27 12:29:00 +02:00