From e26331ef72f353f758e0efd7c79afc8d35799c97 Mon Sep 17 00:00:00 2001 From: Supreeth Herle Date: Fri, 20 Mar 2020 18:50:39 +0100 Subject: Add ability to parse SIM Service Table (EF.SST) As per TS.51.011, This EF indicates which services in the SIM are allocated, and whether, if allocated, the service is activated .If a service is not indicated as available in the SIM, the ME shall not select this service. Change-Id: Id28a35727adbaaa9df19b1adc621a0c51ad0e51b --- pySim-read.py | 16 +++++++++++++- pySim/cards.py | 10 ++++++++- pysim-testdata/Fairwaves-SIM.ok | 42 ++++++++++++++++++++++++++++++++++++ pysim-testdata/Wavemobile-SIM.ok | 40 ++++++++++++++++++++++++++++++++++ pysim-testdata/fakemagicsim.ok | 35 ++++++++++++++++++++++++++++++ pysim-testdata/sysmoISIM-SJA2.ok | 44 ++++++++++++++++++++++++++++++++++++++ pysim-testdata/sysmoUSIM-SJS1.ok | 46 ++++++++++++++++++++++++++++++++++++++++ pysim-testdata/sysmosim-gr1.ok | 33 ++++++++++++++++++++++++++++ 8 files changed, 264 insertions(+), 2 deletions(-) diff --git a/pySim-read.py b/pySim-read.py index 98a2e81..31a3374 100755 --- a/pySim-read.py +++ b/pySim-read.py @@ -28,7 +28,7 @@ import os import random import re import sys -from pySim.ts_51_011 import EF, DF +from pySim.ts_51_011 import EF, DF, EF_SST_map from pySim.commands import SimCardCommands from pySim.cards import card_detect, Card @@ -219,5 +219,19 @@ if __name__ == '__main__': else: print("AD: Can't read, response code = %s" % (sw,)) + # EF.SST + (res, sw) = card.read_sst() + if sw == '9000': + # (st_hex, avail_src_list) = res + # st_hex - Service Table in hex format + # avail_src_list - List of services available + print("SIM Service Table: %s" % res[0]) + # Print those which are available + for s in res[1]: + if s in EF_SST_map: + print('\tService %d - %s: %s' % (s, EF_SST_map[s], s in res[1])) + else: + print("SIM Service Table: Can't read, response code = %s" % (sw,)) + # Done for this card and maybe for everything ? print("Done !\n") diff --git a/pySim/cards.py b/pySim/cards.py index d27092d..a12b111 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -188,7 +188,15 @@ class Card(object): else: return (None, sw) - # Read the (full) AID for either ISIM or USIM application + # Read SIM Service table + def read_sst(self): + (res, sw) = self._scc.read_binary(EF['SST']) + if sw == '9000': + return ((res, parse_st(res)), sw) + else: + return (None, sw) + + # Read the (full) AID for either ISIM or USIM or ISIM application def read_aid(self, isim = False): # First (known) halves of the AID diff --git a/pysim-testdata/Fairwaves-SIM.ok b/pysim-testdata/Fairwaves-SIM.ok index ffe9c42..1dbaab6 100644 --- a/pysim-testdata/Fairwaves-SIM.ok +++ b/pysim-testdata/Fairwaves-SIM.ok @@ -43,5 +43,47 @@ HPLMNAcT: ACC: 0008 MSISDN: Not available AD: 00000002 +SIM Service Table: ff3cc3ff030fff0f000fff03f0c0 + Service 1 - CHV1 disable function: True + Service 2 - Abbreviated Dialling Numbers (ADN): True + Service 3 - Fixed Dialling Numbers (FDN): True + Service 4 - Short Message Storage (SMS): True + Service 5 - Advice of Charge (AoC): True + Service 6 - Capability Configuration Parameters (CCP): True + Service 7 - PLMN selector: True + Service 8 - RFU: True + Service 11 - Extension2: True + Service 12 - SMS Parameters: True + Service 13 - Last Number Dialled (LND): True + Service 14 - Cell Broadcast Message Identifier: True + Service 17 - Service Provider Name: True + Service 18 - Service Dialling Numbers (SDN): True + Service 23 - enhanced Multi-Level Precedence and Pre-emption Service: True + Service 24 - Automatic Answer for eMLPP: True + Service 25 - Data download via SMS-CB: True + Service 26 - Data download via SMS-PP: True + Service 27 - Menu selection: True + Service 28 - Call control: True + Service 29 - Proactive SIM: True + Service 30 - Cell Broadcast Message Identifier Ranges: True + Service 31 - Barred Dialling Numbers (BDN): True + Service 32 - Extension4: True + Service 33 - De-personalization Control Keys: True + Service 34 - Co-operative Network List: True + Service 41 - USSD string data object supported in Call Control: True + Service 42 - RUN AT COMMAND command: True + Service 43 - User controlled PLMN Selector with Access Technology: True + Service 44 - Operator controlled PLMN Selector with Access Technology: True + Service 49 - MExE: True + Service 50 - Reserved and shall be ignored: True + Service 51 - PLMN Network Name: True + Service 52 - Operator PLMN List: True + Service 53 - Mailbox Dialling Numbers: True + Service 54 - Message Waiting Indication Status: True + Service 55 - Call Forwarding Indication Status: True + Service 56 - Service Provider Display Information: True + Service 57 - Multimedia Messaging Service (MMS): True + Service 58 - Extension 8: True + Service 59 - MMS User Connectivity Parameters: True Done ! diff --git a/pysim-testdata/Wavemobile-SIM.ok b/pysim-testdata/Wavemobile-SIM.ok index 03191b3..e72599f 100644 --- a/pysim-testdata/Wavemobile-SIM.ok +++ b/pysim-testdata/Wavemobile-SIM.ok @@ -50,5 +50,45 @@ HPLMNAcT: Can't read file -- SW match failed! Expected 9000 and got 6a82. ACC: abce MSISDN: Not available AD: 00ffff02 +SIM Service Table: ff33ff0f3c00ff0f000cf0c0f0030000 + Service 1 - CHV1 disable function: True + Service 2 - Abbreviated Dialling Numbers (ADN): True + Service 3 - Fixed Dialling Numbers (FDN): True + Service 4 - Short Message Storage (SMS): True + Service 5 - Advice of Charge (AoC): True + Service 6 - Capability Configuration Parameters (CCP): True + Service 7 - PLMN selector: True + Service 8 - RFU: True + Service 9 - MSISDN: True + Service 10 - Extension1: True + Service 13 - Last Number Dialled (LND): True + Service 14 - Cell Broadcast Message Identifier: True + Service 17 - Service Provider Name: True + Service 18 - Service Dialling Numbers (SDN): True + Service 19 - Extension3: True + Service 20 - RFU: True + Service 21 - VGCS Group Identifier List (EFVGCS and EFVGCSS): True + Service 22 - VBS Group Identifier List (EFVBS and EFVBSS): True + Service 23 - enhanced Multi-Level Precedence and Pre-emption Service: True + Service 24 - Automatic Answer for eMLPP: True + Service 25 - Data download via SMS-CB: True + Service 26 - Data download via SMS-PP: True + Service 27 - Menu selection: True + Service 28 - Call control: True + Service 35 - Short Message Status Reports: True + Service 36 - Network's indication of alerting in the MS: True + Service 37 - Mobile Originated Short Message control by SIM: True + Service 38 - GPRS: True + Service 49 - MExE: True + Service 50 - Reserved and shall be ignored: True + Service 51 - PLMN Network Name: True + Service 52 - Operator PLMN List: True + Service 53 - Mailbox Dialling Numbers: True + Service 54 - Message Waiting Indication Status: True + Service 55 - Call Forwarding Indication Status: True + Service 56 - Service Provider Display Information: True + Service 57 - Multimedia Messaging Service (MMS): True + Service 58 - Extension 8: True + Service 59 - MMS User Connectivity Parameters: True Done ! diff --git a/pysim-testdata/fakemagicsim.ok b/pysim-testdata/fakemagicsim.ok index 4ee5c7f..fc5bcdf 100644 --- a/pysim-testdata/fakemagicsim.ok +++ b/pysim-testdata/fakemagicsim.ok @@ -16,5 +16,40 @@ HPLMNAcT: Can't read file -- SW match failed! Expected 9000 and got 9404. ACC: ffff MSISDN: Not available AD: 000000 +SIM Service Table: ff3fff0f0300f003000c + Service 1 - CHV1 disable function: True + Service 2 - Abbreviated Dialling Numbers (ADN): True + Service 3 - Fixed Dialling Numbers (FDN): True + Service 4 - Short Message Storage (SMS): True + Service 5 - Advice of Charge (AoC): True + Service 6 - Capability Configuration Parameters (CCP): True + Service 7 - PLMN selector: True + Service 8 - RFU: True + Service 9 - MSISDN: True + Service 10 - Extension1: True + Service 11 - Extension2: True + Service 12 - SMS Parameters: True + Service 13 - Last Number Dialled (LND): True + Service 14 - Cell Broadcast Message Identifier: True + Service 17 - Service Provider Name: True + Service 18 - Service Dialling Numbers (SDN): True + Service 19 - Extension3: True + Service 20 - RFU: True + Service 21 - VGCS Group Identifier List (EFVGCS and EFVGCSS): True + Service 22 - VBS Group Identifier List (EFVBS and EFVBSS): True + Service 23 - enhanced Multi-Level Precedence and Pre-emption Service: True + Service 24 - Automatic Answer for eMLPP: True + Service 25 - Data download via SMS-CB: True + Service 26 - Data download via SMS-PP: True + Service 27 - Menu selection: True + Service 28 - Call control: True + Service 33 - De-personalization Control Keys: True + Service 34 - Co-operative Network List: True + Service 53 - Mailbox Dialling Numbers: True + Service 54 - Message Waiting Indication Status: True + Service 55 - Call Forwarding Indication Status: True + Service 56 - Service Provider Display Information: True + Service 57 - Multimedia Messaging Service (MMS): True + Service 58 - Extension 8: True Done ! diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok index 0ccb8e9..205cddf 100644 --- a/pysim-testdata/sysmoISIM-SJA2.ok +++ b/pysim-testdata/sysmoISIM-SJA2.ok @@ -55,5 +55,49 @@ HPLMNAcT: ACC: 0001 MSISDN (NPI=1 ToN=1): +1234 AD: 00000002 +SIM Service Table: ff33ffff3f003f0f300cf0c3f00000 + Service 1 - CHV1 disable function: True + Service 2 - Abbreviated Dialling Numbers (ADN): True + Service 3 - Fixed Dialling Numbers (FDN): True + Service 4 - Short Message Storage (SMS): True + Service 5 - Advice of Charge (AoC): True + Service 6 - Capability Configuration Parameters (CCP): True + Service 7 - PLMN selector: True + Service 8 - RFU: True + Service 9 - MSISDN: True + Service 10 - Extension1: True + Service 13 - Last Number Dialled (LND): True + Service 14 - Cell Broadcast Message Identifier: True + Service 17 - Service Provider Name: True + Service 18 - Service Dialling Numbers (SDN): True + Service 19 - Extension3: True + Service 20 - RFU: True + Service 21 - VGCS Group Identifier List (EFVGCS and EFVGCSS): True + Service 22 - VBS Group Identifier List (EFVBS and EFVBSS): True + Service 23 - enhanced Multi-Level Precedence and Pre-emption Service: True + Service 24 - Automatic Answer for eMLPP: True + Service 25 - Data download via SMS-CB: True + Service 26 - Data download via SMS-PP: True + Service 27 - Menu selection: True + Service 28 - Call control: True + Service 29 - Proactive SIM: True + Service 30 - Cell Broadcast Message Identifier Ranges: True + Service 31 - Barred Dialling Numbers (BDN): True + Service 32 - Extension4: True + Service 33 - De-personalization Control Keys: True + Service 34 - Co-operative Network List: True + Service 35 - Short Message Status Reports: True + Service 36 - Network's indication of alerting in the MS: True + Service 37 - Mobile Originated Short Message control by SIM: True + Service 38 - GPRS: True + Service 49 - MExE: True + Service 50 - Reserved and shall be ignored: True + Service 51 - PLMN Network Name: True + Service 52 - Operator PLMN List: True + Service 53 - Mailbox Dialling Numbers: True + Service 54 - Message Waiting Indication Status: True + Service 57 - Multimedia Messaging Service (MMS): True + Service 58 - Extension 8: True + Service 59 - MMS User Connectivity Parameters: True Done ! diff --git a/pysim-testdata/sysmoUSIM-SJS1.ok b/pysim-testdata/sysmoUSIM-SJS1.ok index 0299e3f..89123a0 100644 --- a/pysim-testdata/sysmoUSIM-SJS1.ok +++ b/pysim-testdata/sysmoUSIM-SJS1.ok @@ -55,5 +55,51 @@ HPLMNAcT: ACC: 0008 MSISDN (NPI=1 ToN=1): +77776336143 AD: 00000002 +SIM Service Table: ff3fffff3f003f1ff00c00c0f00000 + Service 1 - CHV1 disable function: True + Service 2 - Abbreviated Dialling Numbers (ADN): True + Service 3 - Fixed Dialling Numbers (FDN): True + Service 4 - Short Message Storage (SMS): True + Service 5 - Advice of Charge (AoC): True + Service 6 - Capability Configuration Parameters (CCP): True + Service 7 - PLMN selector: True + Service 8 - RFU: True + Service 9 - MSISDN: True + Service 10 - Extension1: True + Service 11 - Extension2: True + Service 12 - SMS Parameters: True + Service 13 - Last Number Dialled (LND): True + Service 14 - Cell Broadcast Message Identifier: True + Service 17 - Service Provider Name: True + Service 18 - Service Dialling Numbers (SDN): True + Service 19 - Extension3: True + Service 20 - RFU: True + Service 21 - VGCS Group Identifier List (EFVGCS and EFVGCSS): True + Service 22 - VBS Group Identifier List (EFVBS and EFVBSS): True + Service 23 - enhanced Multi-Level Precedence and Pre-emption Service: True + Service 24 - Automatic Answer for eMLPP: True + Service 25 - Data download via SMS-CB: True + Service 26 - Data download via SMS-PP: True + Service 27 - Menu selection: True + Service 28 - Call control: True + Service 29 - Proactive SIM: True + Service 30 - Cell Broadcast Message Identifier Ranges: True + Service 31 - Barred Dialling Numbers (BDN): True + Service 32 - Extension4: True + Service 33 - De-personalization Control Keys: True + Service 34 - Co-operative Network List: True + Service 35 - Short Message Status Reports: True + Service 36 - Network's indication of alerting in the MS: True + Service 37 - Mobile Originated Short Message control by SIM: True + Service 38 - GPRS: True + Service 49 - MExE: True + Service 50 - Reserved and shall be ignored: True + Service 51 - PLMN Network Name: True + Service 52 - Operator PLMN List: True + Service 53 - Mailbox Dialling Numbers: True + Service 54 - Message Waiting Indication Status: True + Service 57 - Multimedia Messaging Service (MMS): True + Service 58 - Extension 8: True + Service 59 - MMS User Connectivity Parameters: True Done ! diff --git a/pysim-testdata/sysmosim-gr1.ok b/pysim-testdata/sysmosim-gr1.ok index 04e4965..b231f00 100644 --- a/pysim-testdata/sysmosim-gr1.ok +++ b/pysim-testdata/sysmosim-gr1.ok @@ -16,5 +16,38 @@ HPLMNAcT: Can't read file -- SW match failed! Expected 9000 and got 9404. ACC: 0008 MSISDN: Not available AD: 000000 +SIM Service Table: ff3fff0f0f0000030000 + Service 1 - CHV1 disable function: True + Service 2 - Abbreviated Dialling Numbers (ADN): True + Service 3 - Fixed Dialling Numbers (FDN): True + Service 4 - Short Message Storage (SMS): True + Service 5 - Advice of Charge (AoC): True + Service 6 - Capability Configuration Parameters (CCP): True + Service 7 - PLMN selector: True + Service 8 - RFU: True + Service 9 - MSISDN: True + Service 10 - Extension1: True + Service 11 - Extension2: True + Service 12 - SMS Parameters: True + Service 13 - Last Number Dialled (LND): True + Service 14 - Cell Broadcast Message Identifier: True + Service 17 - Service Provider Name: True + Service 18 - Service Dialling Numbers (SDN): True + Service 19 - Extension3: True + Service 20 - RFU: True + Service 21 - VGCS Group Identifier List (EFVGCS and EFVGCSS): True + Service 22 - VBS Group Identifier List (EFVBS and EFVBSS): True + Service 23 - enhanced Multi-Level Precedence and Pre-emption Service: True + Service 24 - Automatic Answer for eMLPP: True + Service 25 - Data download via SMS-CB: True + Service 26 - Data download via SMS-PP: True + Service 27 - Menu selection: True + Service 28 - Call control: True + Service 33 - De-personalization Control Keys: True + Service 34 - Co-operative Network List: True + Service 35 - Short Message Status Reports: True + Service 36 - Network's indication of alerting in the MS: True + Service 57 - Multimedia Messaging Service (MMS): True + Service 58 - Extension 8: True Done ! -- cgit v1.2.3