From 0dc8f6921707d1d59cbfe2c5841ff479632c5edc Mon Sep 17 00:00:00 2001 From: Sebastian Viviani Date: Fri, 29 May 2020 00:14:55 +0100 Subject: ts_31_102.py: add EF_ADF_map the EF files in the USIM ADF are different to the ones int the GSM dir so added the dictionary to avoid conflicts and hardcoded values the 'DIR' one was added in ts_51_011.py, not sure if it should be there as it's not in that standard, but did it for simplicity Change-Id: I458380bf46b2986662ecdede2551c22cd9be92ba --- pySim-read.py | 4 +- pySim/cards.py | 4 +- pySim/ts_31_102.py | 106 ++++++++++++++++++++++++++++++++++++++++++++++++++++- pySim/ts_51_011.py | 2 + 4 files changed, 111 insertions(+), 5 deletions(-) diff --git a/pySim-read.py b/pySim-read.py index e49a907..b23e6ee 100755 --- a/pySim-read.py +++ b/pySim-read.py @@ -29,7 +29,7 @@ import random import re import sys from pySim.ts_51_011 import EF, DF, EF_SST_map -from pySim.ts_31_102 import EF_UST_map +from pySim.ts_31_102 import EF_UST_map, EF_USIM_ADF_map from pySim.ts_31_103 import EF_IST_map from pySim.commands import SimCardCommands @@ -242,7 +242,7 @@ if __name__ == '__main__': # EF.UST - File Id in ADF USIM : 6f38 if '9000' == card.select_adf_by_aid(): # EF.UST - (res, sw) = card.read_binary('6f38') + (res, sw) = card.read_binary(EF_USIM_ADF_map['UST']) if sw == '9000': print("USIM Service Table: %s" % res) # Print those which are available diff --git a/pySim/cards.py b/pySim/cards.py index c7b34eb..808fde1 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -225,9 +225,9 @@ class Card(object): try: # Find out how many records the EF.DIR has # and store all the AIDs in the UICC - rec_cnt = self._scc.record_count(['3f00', '2f00']) + rec_cnt = self._scc.record_count(EF['DIR']) for i in range(0, rec_cnt): - rec = self._scc.read_record(['3f00', '2f00'], i + 1) + rec = self._scc.read_record(EF['DIR'], i + 1) if (rec[0][0:2], rec[0][4:6]) == ('61', '4f') and len(rec[0]) > 12 \ and rec[0][8:8 + int(rec[0][6:8], 16) * 2] not in self._aids: self._aids.append(rec[0][8:8 + int(rec[0][6:8], 16) * 2]) diff --git a/pySim/ts_31_102.py b/pySim/ts_31_102.py index 9f5abe9..473e595 100644 --- a/pySim/ts_31_102.py +++ b/pySim/ts_31_102.py @@ -135,4 +135,108 @@ EF_UST_map = { 109: 'MCPTT', 110: 'ePDG configuration Information for Emergency Service support', 111: 'ePDG configuration Information for Emergency Service configured', -} \ No newline at end of file +} + +EF_USIM_ADF_map = { + 'LI': '6F05', + 'ARR': '6F06', + 'IMSI': '6F07', + 'Keys': '6F08', + 'KeysPS': '6F09', + 'DCK': '6F2C', + 'HPPLMN': '6F31', + 'CNL': '6F32', + 'ACMmax': '6F37', + 'UST': '6F38', + 'ACM': '6F39', + 'FDN': '6F3B', + 'SMS': '6F3C', + 'GID1': '6F3E', + 'GID2': '6F3F', + 'MSISDN': '6F40', + 'PUCT': '6F41', + 'SMSP': '6F42', + 'SMSS': '6F42', + 'CBMI': '6F45', + 'SPN': '6F46', + 'SMSR': '6F47', + 'CBMID': '6F48', + 'SDN': '6F49', + 'EXT2': '6F4B', + 'EXT3': '6F4C', + 'BDN': '6F4D', + 'EXT5': '6F4E', + 'CCP2': '6F4F', + 'CBMIR': '6F50', + 'EXT4': '6F55', + 'EST': '6F56', + 'ACL': '6F57', + 'CMI': '6F58', + 'START-HFN': '6F5B', + 'THRESHOLD': '6F5C', + 'PLMNwAcT': '6F60', + 'OPLMNwAcT': '6F61', + 'HPLMNwAcT': '6F62', + 'PSLOCI': '6F73', + 'ACC': '6F78', + 'FPLMN': '6F7B', + 'LOCI': '6F7E', + 'ICI': '6F80', + 'OCI': '6F81', + 'ICT': '6F82', + 'OCT': '6F83', + 'AD': '6FAD', + 'VGCS': '6FB1', + 'VGCSS': '6FB2', + 'VBS': '6FB3', + 'VBSS': '6FB4', + 'eMLPP': '6FB5', + 'AAeM': '6FB6', + 'ECC': '6FB7', + 'Hiddenkey': '6FC3', + 'NETPAR': '6FC4', + 'PNN': '6FC5', + 'OPL': '6FC6', + 'MBDN': '6FC7', + 'EXT6': '6FC8', + 'MBI': '6FC9', + 'MWIS': '6FCA', + 'CFIS': '6FCB', + 'EXT7': '6FCC', + 'SPDI': '6FCD', + 'MMSN': '6FCE', + 'EXT8': '6FCF', + 'MMSICP': '6FD0', + 'MMSUP': '6FD1', + 'MMSUCP': '6FD2', + 'NIA': '6FD3', + 'VGCSCA': '6FD4', + 'VBSCA': '6FD5', + 'GBAP': '6FD6', + 'MSK': '6FD7', + 'MUK': '6FD8', + 'EHPLMN': '6FD9', + 'GBANL': '6FDA', + 'EHPLMNPI': '6FDB', + 'LRPLMNSI': '6FDC', + 'NAFKCA': '6FDD', + 'SPNI': '6FDE', + 'PNNI': '6FDF', + 'NCP-IP': '6FE2', + 'EPSLOCI': '6FE3', + 'EPSNSC': '6FE4', + 'UFC': '6FE6', + 'UICCIARI': '6FE7', + 'NASCONFIG': '6FE8', + 'PWC': '6FEC', + 'FDNURI': '6FED', + 'BDNURI': '6FEE', + 'SDNURI': '6FEF', + 'IWL': '6FF0', + 'IPS': '6FF1', + 'IPD': '6FF2', + 'ePDGId': '6FF3', + 'ePDGSelection': '6FF4', + 'ePDGIdEm': '6FF5', + 'ePDGSelectionEm': '6FF6', +} diff --git a/pySim/ts_51_011.py b/pySim/ts_51_011.py index 1cec91f..37d2bc8 100644 --- a/pySim/ts_51_011.py +++ b/pySim/ts_51_011.py @@ -48,6 +48,7 @@ EF_num = { # MF 'ICCID': '2FE2', 'ELP': '2F05', +'DIR': '2F00', # DF_TELECOM 'ADN': '6F3A', @@ -164,6 +165,7 @@ DF = { EF = { 'ICCID': [MF_num, EF_num['ICCID']], 'ELP': [MF_num, EF_num['ELP']], +'DIR': [MF_num, EF_num['DIR']], 'ADN': DF['TELECOM']+[EF_num['ADN']], 'FDN': DF['TELECOM']+[EF_num['FDN']], -- cgit v1.2.3