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/.

herlesupreeth gerrit-no-reply at lists.osmocom.org
Mon Jan 20 12:17:58 UTC 2020


herlesupreeth has uploaded this change for review. ( 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
1 file changed, 34 insertions(+), 24 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/40/16940/1

diff --git a/pySim-read.py b/pySim-read.py
old mode 100755
new mode 100644
index 17fce61..2838973
--- 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,43 +121,53 @@
 	else:
 		print("SMSP: Can't read, response code = %s" % (sw,))
 
+	# EF.SPN
+	try:
+		(res, sw) = scc.read_binary(EF['SPN'])
+		if sw == '9000':
+			print("SPN, hplmn_disp, oplmn_disp: %s" % (dec_spn(res),))
+		else:
+			print("SPN: Can't read, response code = %s" % (sw,))
+	except Exception as e:
+		print "SPN: Can't read file -- " + str(e)
+
 	# EF.PLMNsel
 	try:
-	        (res, sw) = scc.read_binary(EF['PLMNsel'])
-	        if sw == '9000':
-		        print("PLMNsel: %s" % (res))
-	        else:
-		        print("PLMNsel: Can't read, response code = %s" % (sw,))
+		(res, sw) = scc.read_binary(EF['PLMNsel'])
+		if sw == '9000':
+			print("PLMNsel: %s" % (res))
+		else:
+			print("PLMNsel: Can't read, response code = %s" % (sw,))
 	except Exception as e:
 		print "HPLMNAcT: Can't read file -- " + str(e)
 
 	# EF.PLMNwAcT
-        try:
-	        (res, sw) = scc.read_binary(EF['PLMNwAcT'])
-	        if sw == '9000':
-		        print("PLMNwAcT:\n%s" % (format_xplmn_w_act(res)))
-	        else:
-		        print("PLMNwAcT: Can't read, response code = %s" % (sw,))
+	try:
+		(res, sw) = scc.read_binary(EF['PLMNwAcT'])
+		if sw == '9000':
+			print("PLMNwAcT:\n%s" % (format_xplmn_w_act(res)))
+		else:
+			print("PLMNwAcT: Can't read, response code = %s" % (sw,))
 	except Exception as e:
 		print "PLMNwAcT: Can't read file -- " + str(e)
 
 	# EF.OPLMNwAcT
-        try:
-	        (res, sw) = scc.read_binary(EF['OPLMNwAcT'])
-	        if sw == '9000':
-		        print("OPLMNwAcT:\n%s" % (format_xplmn_w_act(res)))
-	        else:
-		        print("OPLMNwAcT: Can't read, response code = %s" % (sw,))
+	try:
+		(res, sw) = scc.read_binary(EF['OPLMNwAcT'])
+		if sw == '9000':
+			print("OPLMNwAcT:\n%s" % (format_xplmn_w_act(res)))
+		else:
+			print("OPLMNwAcT: Can't read, response code = %s" % (sw,))
 	except Exception as e:
 		print "OPLMNwAcT: Can't read file -- " + str(e)
 
 	# EF.HPLMNAcT
-        try:
-	        (res, sw) = scc.read_binary(EF['HPLMNAcT'])
-	        if sw == '9000':
-		        print("HPLMNAcT:\n%s" % (format_xplmn_w_act(res)))
-	        else:
-		        print("HPLMNAcT: Can't read, response code = %s" % (sw,))
+	try:
+		(res, sw) = scc.read_binary(EF['HPLMNAcT'])
+		if sw == '9000':
+			print("HPLMNAcT:\n%s" % (format_xplmn_w_act(res)))
+		else:
+			print("HPLMNAcT: Can't read, response code = %s" % (sw,))
 	except Exception as e:
 		print "HPLMNAcT: Can't read file -- " + str(e)
 

-- 
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: 1
Gerrit-Owner: herlesupreeth <herlesupreeth at gmail.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200120/2d85d2e3/attachment.htm>


More information about the gerrit-log mailing list