Added feature to read Service Provider Name (SPN) from the SIM card
Change-Id: I8dc599a76c260ec2823ba5c9b22375b04a50daa8
diff --git a/pySim-read.py b/pySim-read.py
old mode 100755
new mode 100644
index 4bfa900..662ee54
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -37,7 +37,7 @@
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 @@
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'])