pySim-read: Read SPN and use new EF constants to address other files.

Change-Id: I3207edaa9670d1c76b1ba2142f1042794055e94c
This commit is contained in:
Alexander Chemeris
2018-01-26 15:57:19 +09:00
parent 4d5c0293a2
commit 575f64e38a

View File

@@ -37,7 +37,7 @@ except ImportError:
from pySim.commands import SimCardCommands from pySim.commands import SimCardCommands
from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid
from pySim.ts_51_011 import EF, DF
def parse_options(): def parse_options():
@@ -107,13 +107,20 @@ if __name__ == '__main__':
else: else:
print("SMSP: Can't read, response code = %s" % (sw,)) print("SMSP: Can't read, response code = %s" % (sw,))
# EF.SPN
(res, sw) = scc.read_binary(EF['SPN'])
if sw == '9000':
print("SPN: %s" % (res,))
else:
print("SPN: Can't read, response code = %s" % (sw,))
# EF.HPLMN # EF.HPLMN
# (res, sw) = scc.read_binary(['3f00', '7f20', '6f30']) (res, sw) = scc.read_binary(EF['PLMNsel'])
# if sw == '9000': if sw == '9000':
# print("HPLMN: %s" % (res)) print("HPLMN: %s" % (res))
# print("HPLMN: %s" % (dec_hplmn(res),)) # print("HPLMN: %s" % (dec_hplmn(res),))
# else: else:
# print("HPLMN: Can't read, response code = %s" % (sw,)) print("HPLMN: Can't read, response code = %s" % (sw,))
# FIXME # FIXME
# EF.ACC # EF.ACC
@@ -125,13 +132,13 @@ if __name__ == '__main__':
# EF.MSISDN # EF.MSISDN
try: try:
# print(scc.record_size(['3f00', '7f10', '6f40'])) # print(scc.record_size(EF['MSISDN']))
(res, sw) = scc.read_record(['3f00', '7f10', '6f40'], 1) (res, sw) = scc.read_record(EF['MSISDN'], 1)
if sw == '9000': if sw == '9000':
if res[1] != 'f': if res[1] != 'f':
print("MSISDN: %s" % (res,)) print("MSISDN: %s" % (res,))
else: else:
print("MSISDN: Not available") print("MSISDN: %s (Not available)" % (res,))
else: else:
print("MSISDN: Can't read, response code = %s" % (sw,)) print("MSISDN: Can't read, response code = %s" % (sw,))
except: except: