Change in pysim[master]: Added feature to read Service Provider Name (SPN) from the SIM card

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Tue Jan 21 12:54:58 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/pysim/+/16940 )

Change subject: Added feature to read Service Provider Name (SPN) from the SIM card
......................................................................

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

Change-Id: I8dc599a76c260ec2823ba5c9b22375b04a50daa8
---
M pySim-read.py
M pysim-testdata/Fairwaves-SIM.ok
M pysim-testdata/Wavemobile-SIM.ok
M pysim-testdata/fakemagicsim.ok
M pysim-testdata/sysmoISIM-SJA2.ok
M pysim-testdata/sysmoUSIM-SJS1.ok
M pysim-testdata/sysmosim-gr1.ok
7 files changed, 30 insertions(+), 1 deletion(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



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'])
diff --git a/pysim-testdata/Fairwaves-SIM.ok b/pysim-testdata/Fairwaves-SIM.ok
index 6150469..94df376 100644
--- a/pysim-testdata/Fairwaves-SIM.ok
+++ b/pysim-testdata/Fairwaves-SIM.ok
@@ -3,6 +3,9 @@
 ICCID: 8988219000000117833
 IMSI: 001010000000111
 SMSP: e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000ffffffffffffffffffffffffffff
+SPN: Fairwaves
+Display HPLMN: False
+Display OPLMN: False
 PLMNsel: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
 PLMNwAcT:
 	ffffff0000 # unused
diff --git a/pysim-testdata/Wavemobile-SIM.ok b/pysim-testdata/Wavemobile-SIM.ok
index b0ea8be..8b14a30 100644
--- a/pysim-testdata/Wavemobile-SIM.ok
+++ b/pysim-testdata/Wavemobile-SIM.ok
@@ -3,6 +3,9 @@
 ICCID: 89445310150011013678
 IMSI: 001010000000102
 SMSP: e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000ffffffffffffffffffffffffffff
+SPN: wavemobile
+Display HPLMN: False
+Display OPLMN: False
 PLMNsel: fff11fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
 PLMNwAcT:
 	fff11fffff # MCC: 1651 MNC: 151 AcT: UTRAN, E-UTRAN, GSM, GSM COMPACT, cdma2000 HRPD, cdma2000 1xRTT
diff --git a/pysim-testdata/fakemagicsim.ok b/pysim-testdata/fakemagicsim.ok
index d9bff94..8d4583d 100644
--- a/pysim-testdata/fakemagicsim.ok
+++ b/pysim-testdata/fakemagicsim.ok
@@ -3,6 +3,9 @@
 ICCID: 1122334455667788990
 IMSI: 001010000000102
 SMSP: ffffffffffffffffffffffffe1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
+SPN: Magic
+Display HPLMN: True
+Display OPLMN: False
 PLMNsel: fff11fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
 PLMNwAcT: Can't read file -- SW match failed! Expected 9000 and got 9404.
 OPLMNwAcT: Can't read file -- SW match failed! Expected 9000 and got 9404.
diff --git a/pysim-testdata/sysmoISIM-SJA2.ok b/pysim-testdata/sysmoISIM-SJA2.ok
index fb191e0..7346134 100644
--- a/pysim-testdata/sysmoISIM-SJA2.ok
+++ b/pysim-testdata/sysmoISIM-SJA2.ok
@@ -3,6 +3,9 @@
 ICCID: 8988211900000000004
 IMSI: 001010000000102
 SMSP: ffffffffffffffffffffffffffffffffffffffffffffffffe1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
+SPN: 
+Display HPLMN: False
+Display OPLMN: False
 PLMNsel: fff11fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
 PLMNwAcT:
 	fff11fffff # MCC: 1651 MNC: 151 AcT: UTRAN, E-UTRAN, GSM, GSM COMPACT, cdma2000 HRPD, cdma2000 1xRTT
diff --git a/pysim-testdata/sysmoUSIM-SJS1.ok b/pysim-testdata/sysmoUSIM-SJS1.ok
index b6a5391..5ad34e4 100644
--- a/pysim-testdata/sysmoUSIM-SJS1.ok
+++ b/pysim-testdata/sysmoUSIM-SJS1.ok
@@ -3,6 +3,9 @@
 ICCID: 1122334455667788990
 IMSI: 001010000000102
 SMSP: ffffffffffffffffffffffffffffffffffffffffffffffffe1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
+SPN: 
+Display HPLMN: False
+Display OPLMN: False
 PLMNsel: fff11fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
 PLMNwAcT:
 	fff11fffff # MCC: 1651 MNC: 151 AcT: UTRAN, E-UTRAN, GSM, GSM COMPACT, cdma2000 HRPD, cdma2000 1xRTT
diff --git a/pysim-testdata/sysmosim-gr1.ok b/pysim-testdata/sysmosim-gr1.ok
index d4c3dd9..b306f4d 100644
--- a/pysim-testdata/sysmosim-gr1.ok
+++ b/pysim-testdata/sysmosim-gr1.ok
@@ -3,6 +3,9 @@
 ICCID: 1122334455667788990
 IMSI: 001010000000102
 SMSP: ffffffffffffffffffffffffe1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
+SPN: 
+Display HPLMN: False
+Display OPLMN: False
 PLMNsel: fff11fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
 PLMNwAcT: Can't read file -- SW match failed! Expected 9000 and got 9404.
 OPLMNwAcT: Can't read file -- SW match failed! Expected 9000 and got 9404.

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/16940
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I8dc599a76c260ec2823ba5c9b22375b04a50daa8
Gerrit-Change-Number: 16940
Gerrit-PatchSet: 7
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Assignee: dexter <pmaier at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-CC: dexter <pmaier at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200121/7ea53008/attachment.htm>


More information about the gerrit-log mailing list