Change in pysim[master]: Further additions to reading USIM service table and fixed reading of ...

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:18:00 UTC 2020


herlesupreeth has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/16947 )


Change subject: Further additions to reading USIM service table and fixed reading of MSISDN parameter
......................................................................

Further additions to reading USIM service table and fixed reading of MSISDN parameter

Change-Id: Ie914ae83d787e3f1a90f9f305bffd45053b8c863
---
M pySim-read.py
1 file changed, 24 insertions(+), 10 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/47/16947/1

diff --git a/pySim-read.py b/pySim-read.py
index fa6ccd6..e9497d5 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -117,12 +117,20 @@
 	# EF.SST
 	(res, sw) = scc.read_binary(EF['SST'])
 	if sw == '9000':
-		# print("USIM Service Table: %s" % res)
-		if len(res) >= 23:
-			swapped = swap_nibbles(res)
-			byte12 = int(swapped[22:24], 16)
-			service95_support = (byte12&0x40 == 0x40)
-			print("Service n95 - Support of UICC access to IMS: %s" % service95_support)
+		swapped = swap_nibbles(res)
+		print("USIM Service Table: %s" % swapped)
+		if len(res) >= 24:
+			byte12 = int(swapped[(12*2) - 2:(12*2)], 16)
+			service96 = (byte12&0x80 == 0x80)
+			print("Service 96 - Non-Access Stratum configuration by USIM: %s" % service96)
+			service95 = (byte12&0x40 == 0x40)
+			print("Service 95 - Support of UICC access to IMS: %s" % service95)
+			service93 = (byte12&0x10 == 0x10)
+			print("Service 93 - Communication Control for IMS by USIM: %s" % service93)
+		if len(res) >= 6:
+			byte3 = int(swapped[(3*2) - 2:(3*2)], 16)
+			service21 = (byte3&0x10 == 0x10)
+			print("Service 21 - MSISDN: %s" % service21)
 	else:
 		print("USIM Service Table: Can't read, response code = %s" % (sw,))
 
@@ -195,10 +203,16 @@
 	#	print(scc.record_size(['3f00', '7f10', '6f40']))
 		(res, sw) = scc.read_record(['3f00', '7f10', '6f40'], 1)
 		if sw == '9000':
-			if res[1] != 'f':
-				print("MSISDN: %s" % (res,))
-			else:
-				print("MSISDN: Not available")
+			x_bytes = (len(res)/2) - 14
+			bcd_len = res[(x_bytes * 2):(x_bytes * 2) + 2]
+			ton_npi = res[(x_bytes * 2) + 2:(x_bytes * 2) + 4]
+			dial_num = res[(x_bytes * 2) + 4:(x_bytes * 2) + 24]
+			# Refer 3GPP TS 24.008 Called party BCD number information element
+			print("MSISDN: %s" % (swap_nibbles(dial_num).rstrip('f')))
+			# if res[1] != 'f':
+			# 	print("MSISDN: %s" % (res,))
+			# else:
+			# 	print("MSISDN: Not available")
 		else:
 			print("MSISDN: Can't read, response code = %s" % (sw,))
 	except Exception as e:

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Ie914ae83d787e3f1a90f9f305bffd45053b8c863
Gerrit-Change-Number: 16947
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/fb593d34/attachment.htm>


More information about the gerrit-log mailing list