Added feature to read Service Provider Name (SPN) from the SIM card

Change-Id: I8dc599a76c260ec2823ba5c9b22375b04a50daa8
This commit is contained in:
Supreeth Herle
2019-06-08 07:49:08 +02:00
parent 0ad5bcfbc1
commit f829945117
7 changed files with 30 additions and 1 deletions

13
pySim-read.py Executable file → Normal file
View File

@@ -37,7 +37,7 @@ except ImportError:
import simplejson as json
from pySim.commands import SimCardCommands
from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, format_xplmn_w_act
from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, format_xplmn_w_act, dec_spn
def parse_options():
@@ -121,6 +121,17 @@ if __name__ == '__main__':
else:
print("SMSP: Can't read, response code = %s" % (sw,))
# EF.SPN
try:
(res, sw) = scc.read_binary(EF['SPN'])
if sw == '9000':
spn_res = dec_spn(res)
print("SPN: %s\nDisplay HPLMN: %s\nDisplay OPLMN: %s" % (spn_res[0], spn_res[1], spn_res[2],))
else:
print("SPN: Can't read, response code = %s" % (sw,))
except Exception as e:
print("SPN: Can't read file -- %s" % (str(e),))
# EF.PLMNsel
try:
(res, sw) = scc.read_binary(EF['PLMNsel'])