pySim-shell: Include current logical channel in prompt

Now that pySim-shell can switch between logical channels, let's state
the currently used logical channel in the prompt.

Change-Id: I45781a6fba205eeb4ac7f58d5cb642b7131bdd88
Related: OS#6230
This commit is contained in:
Harald Welte
2023-10-22 10:36:58 +02:00
parent 20650997e8
commit 237ddb5bb3
3 changed files with 36 additions and 36 deletions

View File

@@ -68,7 +68,7 @@ Try ``select`` with tab-completion to get a list of all current selectable items
:: ::
pySIM-shell (MF)> select pySIM-shell (00:MF)> select
.. 2fe2 a0000000871004 EF.ARR MF .. 2fe2 a0000000871004 EF.ARR MF
2f00 3f00 ADF.ISIM EF.DIR 2f00 3f00 ADF.ISIM EF.DIR
2f05 7f10 ADF.USIM EF.ICCID 2f05 7f10 ADF.USIM EF.ICCID
@@ -85,7 +85,7 @@ This will
:: ::
pySIM-shell (MF)> select ADF.USIM pySIM-shell (00:MF)> select ADF.USIM
{ {
"file_descriptor": { "file_descriptor": {
"file_descriptor_byte": { "file_descriptor_byte": {
@@ -103,7 +103,7 @@ This will
"security_attrib_compact": "00", "security_attrib_compact": "00",
"pin_status_template_do": "90017083010183018183010A83010B" "pin_status_template_do": "90017083010183018183010A83010B"
} }
pySIM-shell (MF/ADF.USIM)> pySIM-shell (00:MF/ADF.USIM)>
status status
@@ -116,7 +116,7 @@ Example:
:: ::
pySIM-shell (MF/ADF.ISIM)> status pySIM-shell (00:MF/ADF.ISIM)> status
{ {
"file_descriptor": { "file_descriptor": {
"file_descriptor_byte": { "file_descriptor_byte": {
@@ -261,7 +261,7 @@ dir
Example: Example:
:: ::
pySIM-shell (MF)> dir pySIM-shell (00:MF)> dir
MF MF
3f00 3f00
.. ADF.USIM DF.SYSTEM EF.DIR EF.UMPC .. ADF.USIM DF.SYSTEM EF.DIR EF.UMPC
@@ -295,7 +295,7 @@ a given file really exists on a given card, you have to try to select that file.
Example: Example:
:: ::
pySIM-shell (MF)> tree --help pySIM-shell (00:MF)> tree --help
EF.DIR 2f00 Application Directory EF.DIR 2f00 Application Directory
EF.ICCID 2fe2 ICC Identification EF.ICCID 2fe2 ICC Identification
EF.PL 2f05 Preferred Languages EF.PL 2f05 Preferred Languages
@@ -467,7 +467,7 @@ Th below example demonstrates this by modifying the ofm field within EF.AD:
:: ::
pySIM-shell (MF/ADF.USIM/EF.AD)> read_binary_decoded pySIM-shell (00:MF/ADF.USIM/EF.AD)> read_binary_decoded
{ {
"ms_operation_mode": "normal", "ms_operation_mode": "normal",
"specific_facilities": { "specific_facilities": {
@@ -475,8 +475,8 @@ Th below example demonstrates this by modifying the ofm field within EF.AD:
}, },
"len_of_mnc_in_imsi": 2 "len_of_mnc_in_imsi": 2
} }
pySIM-shell (MF/ADF.USIM/EF.AD)> update_binary_decoded --json-path specific_facilities.ofm false pySIM-shell (00:MF/ADF.USIM/EF.AD)> update_binary_decoded --json-path specific_facilities.ofm false
pySIM-shell (MF/ADF.USIM/EF.AD)> read_binary_decoded pySIM-shell (00:MF/ADF.USIM/EF.AD)> read_binary_decoded
{ {
"ms_operation_mode": "normal", "ms_operation_mode": "normal",
"specific_facilities": { "specific_facilities": {
@@ -731,7 +731,7 @@ it doesn't yet implement fragmentation/reassembly on rule retrieval. YMMV
:: ::
pySIM-shell (MF/ADF.ARA-M)> aram_get_all pySIM-shell (00:MF/ADF.ARA-M)> aram_get_all
[ [
{ {
"ResponseAllRefArDO": [ "ResponseAllRefArDO": [
@@ -783,7 +783,7 @@ aram_store_ref_ar_do
For example, to store an Android UICC carrier privilege rule for the SHA1 hash of the certificate used to sign the CoIMS android app of Supreeth Herle (https://github.com/herlesupreeth/CoIMS_Wiki) you can use the following command: For example, to store an Android UICC carrier privilege rule for the SHA1 hash of the certificate used to sign the CoIMS android app of Supreeth Herle (https://github.com/herlesupreeth/CoIMS_Wiki) you can use the following command:
:: ::
pySIM-shell (MF/ADF.ARA-M)> aram_store_ref_ar_do --aid FFFFFFFFFFFF --device-app-id E46872F28B350B7E1F140DE535C2A8D5804F0BE3 --android-permissions 0000000000000001 --apdu-always pySIM-shell (00:MF/ADF.ARA-M)> aram_store_ref_ar_do --aid FFFFFFFFFFFF --device-app-id E46872F28B350B7E1F140DE535C2A8D5804F0BE3 --android-permissions 0000000000000001 --apdu-always
aram_delete_all aram_delete_all
@@ -845,10 +845,10 @@ Boolean variable that determines if path (e.g. in prompt) is displayed with nume
:: ::
pySIM-shell (MF/EF.ICCID)> set numeric_path True pySIM-shell (00:MF/EF.ICCID)> set numeric_path True
numeric_path - was: False numeric_path - was: False
now: True now: True
pySIM-shell (3f00/2fe2)> set numeric_path False pySIM-shell (00:3f00/2fe2)> set numeric_path False
numeric_path - was: True numeric_path - was: True
now: False now: False
pySIM-shell (MF/EF.ICCID)> help set pySIM-shell (00:MF/EF.ICCID)> help set

View File

@@ -55,13 +55,13 @@ Launch pySIM:
Using PC/SC reader interface Using PC/SC reader interface
Autodetected card type: sysmoISIM-SJA2 Autodetected card type: sysmoISIM-SJA2
Welcome to pySim-shell! Welcome to pySim-shell!
pySIM-shell (MF)> pySIM-shell (00:MF)>
Enter the ADM PIN: Enter the ADM PIN:
:: ::
pySIM-shell (MF)> verify_adm XXXXXXXX pySIM-shell (00:MF)> verify_adm XXXXXXXX
Otherwise, write commands will fail with ``SW Mismatch: Expected 9000 and got 6982.`` Otherwise, write commands will fail with ``SW Mismatch: Expected 9000 and got 6982.``
@@ -70,16 +70,16 @@ Key Provisioning
:: ::
pySIM-shell (MF)> select MF pySIM-shell (00:MF)> select MF
pySIM-shell (MF)> select ADF.USIM pySIM-shell (00:MF)> select ADF.USIM
pySIM-shell (MF/ADF.USIM)> select DF.5GS pySIM-shell (00:MF/ADF.USIM)> select DF.5GS
pySIM-shell (MF/ADF.USIM/DF.5GS)> select EF.SUCI_Calc_Info pySIM-shell (00:MF/ADF.USIM/DF.5GS)> select EF.SUCI_Calc_Info
By default, the file is present but empty: By default, the file is present but empty:
:: ::
pySIM-shell (MF/ADF.USIM/DF.5GS/EF.SUCI_Calc_Info)> read_binary_decoded pySIM-shell (00:MF/ADF.USIM/DF.5GS/EF.SUCI_Calc_Info)> read_binary_decoded
missing Protection Scheme Identifier List data object tag missing Protection Scheme Identifier List data object tag
9000: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -> {} 9000: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff -> {}
@@ -106,7 +106,7 @@ Write the config to file (must be single-line input as for now):
:: ::
pySIM-shell (MF/ADF.USIM/DF.5GS/EF.SUCI_Calc_Info)> update_binary_decoded '{ "prot_scheme_id_list": [ {"priority": 0, "identifier": 2, "key_index": 1}, {"priority": 1, "identifier": 1, "key_index": 2}, {"priority": 2, "identifier": 0, "key_index": 0}], "hnet_pubkey_list": [ {"hnet_pubkey_identifier": 27, "hnet_pubkey": "0272DA71976234CE833A6907425867B82E074D44EF907DFB4B3E21C1C2256EBCD1"}, {"hnet_pubkey_identifier": 30, "hnet_pubkey": "5A8D38864820197C3394B92613B20B91633CBD897119273BF8E4A6F4EEC0A650"}]}' pySIM-shell (00:MF/ADF.USIM/DF.5GS/EF.SUCI_Calc_Info)> update_binary_decoded '{ "prot_scheme_id_list": [ {"priority": 0, "identifier": 2, "key_index": 1}, {"priority": 1, "identifier": 1, "key_index": 2}, {"priority": 2, "identifier": 0, "key_index": 0}], "hnet_pubkey_list": [ {"hnet_pubkey_identifier": 27, "hnet_pubkey": "0272DA71976234CE833A6907425867B82E074D44EF907DFB4B3E21C1C2256EBCD1"}, {"hnet_pubkey_identifier": 30, "hnet_pubkey": "5A8D38864820197C3394B92613B20B91633CBD897119273BF8E4A6F4EEC0A650"}]}'
WARNING: These are TEST KEYS with publicly known/specified private keys, and hence unsafe for live/secure WARNING: These are TEST KEYS with publicly known/specified private keys, and hence unsafe for live/secure
deployments! For use in production networks, you need to generate your own set[s] of keys. deployments! For use in production networks, you need to generate your own set[s] of keys.
@@ -119,11 +119,11 @@ the contents of the file is **invalid** (ffffffff):
:: ::
pySIM-shell (MF)> select MF pySIM-shell (00:MF)> select MF
pySIM-shell (MF)> select ADF.USIM pySIM-shell (00:MF)> select ADF.USIM
pySIM-shell (MF/ADF.USIM)> select DF.5GS pySIM-shell (00:MF/ADF.USIM)> select DF.5GS
pySIM-shell (MF/ADF.USIM/DF.5GS)> select EF.Routing_Indicator pySIM-shell (00:MF/ADF.USIM/DF.5GS)> select EF.Routing_Indicator
pySIM-shell (MF/ADF.USIM/DF.5GS/EF.Routing_Indicator)> read_binary_decoded pySIM-shell (00:MF/ADF.USIM/DF.5GS/EF.Routing_Indicator)> read_binary_decoded
9000: ffffffff -> {'raw': 'ffffffff'} 9000: ffffffff -> {'raw': 'ffffffff'}
The Routing Indicator is a four-byte file but the actual Routing The Routing Indicator is a four-byte file but the actual Routing
@@ -132,7 +132,7 @@ the Routing Indicator to 0x71:
:: ::
pySIM-shell (MF/ADF.USIM/DF.5GS/EF.Routing_Indicator)> update_binary 17ffffff pySIM-shell (00:MF/ADF.USIM/DF.5GS/EF.Routing_Indicator)> update_binary 17ffffff
You can also set the routing indicator to **0x0**, which is *valid* and You can also set the routing indicator to **0x0**, which is *valid* and
means “routing indicator not specified”, leaving it to the modem. means “routing indicator not specified”, leaving it to the modem.
@@ -144,10 +144,10 @@ First, check out the USIM Service Table (UST):
:: ::
pySIM-shell (MF)> select MF pySIM-shell (00:MF)> select MF
pySIM-shell (MF)> select ADF.USIM pySIM-shell (00:MF)> select ADF.USIM
pySIM-shell (MF/ADF.USIM)> select EF.UST pySIM-shell (00:MF/ADF.USIM)> select EF.UST
pySIM-shell (MF/ADF.USIM/EF.UST)> read_binary_decoded pySIM-shell (00:MF/ADF.USIM/EF.UST)> read_binary_decoded
9000: beff9f9de73e0408400170730000002e00000000 -> [2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 25, 27, 28, 29, 33, 34, 35, 38, 39, 42, 43, 44, 45, 46, 51, 60, 71, 73, 85, 86, 87, 89, 90, 93, 94, 95, 122, 123, 124, 126] 9000: beff9f9de73e0408400170730000002e00000000 -> [2, 3, 4, 5, 6, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19, 20, 21, 25, 27, 28, 29, 33, 34, 35, 38, 39, 42, 43, 44, 45, 46, 51, 60, 71, 73, 85, 86, 87, 89, 90, 93, 94, 95, 122, 123, 124, 126]
.. list-table:: From TS31.102 .. list-table:: From TS31.102
@@ -173,9 +173,9 @@ If youd like to enable/disable any UST service:
:: ::
pySIM-shell (MF/ADF.USIM/EF.UST)> ust_service_deactivate 124 pySIM-shell (00:MF/ADF.USIM/EF.UST)> ust_service_deactivate 124
pySIM-shell (MF/ADF.USIM/EF.UST)> ust_service_activate 124 pySIM-shell (00:MF/ADF.USIM/EF.UST)> ust_service_activate 124
pySIM-shell (MF/ADF.USIM/EF.UST)> ust_service_deactivate 125 pySIM-shell (00:MF/ADF.USIM/EF.UST)> ust_service_deactivate 125
In this case, UST Service 124 is already enabled and youre good to go. The In this case, UST Service 124 is already enabled and youre good to go. The
sysmoISIM-SJA2 does not support on-SIM calculation, so service 125 must sysmoISIM-SJA2 does not support on-SIM calculation, so service 125 must

View File

@@ -291,7 +291,7 @@ class PysimApp(Cmd2Compat):
def update_prompt(self): def update_prompt(self):
if self.lchan: if self.lchan:
path_str = self.lchan.selected_file.fully_qualified_path_str(not self.numeric_path) path_str = self.lchan.selected_file.fully_qualified_path_str(not self.numeric_path)
self.prompt = 'pySIM-shell (%s)> ' % (path_str) self.prompt = 'pySIM-shell (%02u:%s)> ' % (self.lchan.lchan_nr, path_str)
else: else:
if self.card: if self.card:
self.prompt = 'pySIM-shell (no card profile)> ' self.prompt = 'pySIM-shell (no card profile)> '