Commit Graph

21 Commits

Author SHA1 Message Date
Philipp Maier 8dd52e04ac sja2: Add support for new simcard model
Adding support for the new SJA2 simcard type requires comprensive
refactoring of sysmo-usim-tool. We resolve the commonalities of
both simcard models in a class based approach so that code duplication
is reduced to a minium.

- Refactor sysmo-usim-tool into a class based model
- Add support for SJA2 simcard models
- Add tests for SJA2 simcard models

Change-Id: I0feab71bdaab079b35737bb4e0e2a417c4a1f96b
Related: SYS#4466
2020-01-06 11:09:21 +01:00
Philipp Maier 9fa8e47b4c sysmo-usimsjs1.py: refactor functions into class
The module sysmo-usimsjs1.py contains a lot of functions that could also
be methods of a class. Lets refactor those functions into class. This is
also an intermediate step towords support for different card models in
the future.

Related: SYS#4466
Change-Id: I2230f50b9d3c85a0d23b29ba5ed0af2471d22e8c
2019-11-11 11:32:21 +01:00
Philipp Maier 83760e2c22 Support programming of the MNC length value (EF.AD)
The file EF.AD contains the length of the MNC, this allows to phone to
distinguish where MCC/MNC end and where the MSIN number of the IMSI
begins. All cards are shipped with an MNC length of 2, which is fine for
the most situations, but when a MNC with 3 digits is needed the MNC
length value has to be updated. Otherwise the phone will recognize the
third digit of the MNC as part of the MSIN.

Related: OS#3850
2019-03-21 17:05:42 +01:00
Philipp Maier 4cab3bb127 sysmo-usim-tool.sjs1: Add capability to write IMSI
We unconditionally display the IMSI but we still lack support for
writing it. Lets support writing the IMSI as well in order to be more
complete.

- Add support for writing the IMSI

Change-Id: I1b3d1e1aae953663c13e78217de2a8ec3282b969
Related: OS#3376
2018-08-08 12:28:12 +02:00
Philipp Maier 5144c904e6 sysmo-usim-tool.sjs1: Add option -I --set-iccid to help
The helptext lacks the option -I

Change-Id: I25958cedb7d084aedf68f1a56e473098f88ac754
Related: OS#3376
2018-08-08 12:23:45 +02:00
Philipp Maier ed0c9ab4dc ICC: recognize card by its ATR
When working in an environment with multiple card terminals, then it
might be helpful to make sure that only the intended target simcard
(sysmo-usim-sjs1) is accessed.

- Add atr parameter to the ICC, SIM and USIM classes. When no atr
  is given, then ICC will pick any card as it was before

- Make sure to pass the ATR when the sim object is created

Change-Id: I874aae92d29a7e1051e4cebefd85592c5fb78a2e
Related: OS#3376
2018-07-04 15:10:23 +02:00
Philipp Maier be9db88384 usage: correct misleading usage description
When using the -T option the user has to supply two authentication
alogorithms. One for 2G and one for 3G. The authentication algorithms
used to be symbolized by integer numbeers. This was later changed so
that the user could use the clear names of the algorithms. Unfortunately
the usage text was not changed.

- Update usage description

Change-Id: I6a47e4fc24f4b3f0664050032cc15d81703f30c5
2018-07-04 13:38:48 +02:00
Philipp Maier 75aa246987 remove unused uption -v --verbose
The verbose mode (APDU-Trace) is no longer implemented, so lets
remove the option as well.

Change-Id: Ic47864da886a3ab39384b0553fc326b8f3b4db96
2018-07-04 12:15:02 +02:00
Neels Hofmeyr 8a50c51e2d sysmo-usim-tool.sjs1.py: add '-T list' to show available algos 2017-12-14 05:25:28 +01:00
Harald Welte d7b90f8db7 implement resetting of SQN parameters 2017-08-17 14:38:10 +02:00
Harald Welte 3d7b74b3af Print/Parse string representation of Algorithm Identifiers
We don't want to force the user to always open the manual every time
he uses the tool.
2017-08-16 22:38:38 +02:00
Harald Welte 72cf09e620 Add support for reading misc. MILENAGE parameters
We now can read
* IDX, MAX_DELTA and AGE_LIMIT parameters
* whether or not SQN, age and max delta are enforced
* SEQ array
* Authentication Counter
2017-08-16 21:14:44 +02:00
Harald Welte dc45c05b15 Migration to python 'card' from Benoit Michau
There are quite complete python utilities already out there as part
of Benoit Micuhau's 'card' python library. They support plenty of
SIM, UICC and USIM related bits.  Let's use them rather than re-
inventing the wheel here.
2017-08-16 21:14:44 +02:00
Harald Welte 5666cd6818 Unconditionally print ICCID and IMSI
This can help a lot in identifying the cards and in giving context in
case a user copy+pastes the output.  Let's always read those values.
2017-08-16 21:14:44 +02:00
Harald Welte 78b18df47c remove unused 'adm1' argument from many functions
The main program performs ADM1 authentication before using any
of the sysmo_usim_{read,write}* functions, so passing adm1 as
argument to them is just an unused argument that we can remove
2017-08-16 10:04:39 +02:00
Philipp Maier 55bb02bc62 Add ICCID reading/programming feature
sysmo-usim-tool still can't read or program the ICCID. This patch
adds enables reading and writing EF.ICCID
2017-03-21 00:30:34 +01:00
Philipp Maier 14aaab262e auth: prevent unintential card lock down
If the user submints a wrong ADM1 key with the commandline, the
authentication will fail. However, by the output of the program
it mey not be clear to the user that the reason for the failure
was a wrong ADM1 key. The user might try the same command with
the same parameters a few time and lock down the card.

This commit fixes that by failing gracefully with a very clear
error message. Furthermore, if a decreased authentication counter
is detected, no further authentication attempts will be made
until the user supplies the option -f (--force).
2017-03-17 16:43:35 +01:00
Neels Hofmeyr 4d144983c3 cosmetic: typo and slash to clarify OP or OPC 2017-03-05 01:01:03 +01:00
Neels Hofmeyr 8b8ccfcba4 add cmds to read/write KI 2017-03-05 01:00:13 +01:00
Philipp Maier 2c11efcdf6 cosmetic: Fixing typo in log output 2017-02-23 15:33:34 +01:00
Philipp Maier 4f2e60436b sysmo-usim-tool: Add a tool for sysmosom specific tasks
This commit adds a tool that is intended to be used with sysmo-usim
only if some of the highly propritary parameters, which the regular
pysim can not handle, need to be configured.
2017-02-23 14:47:38 +01:00