Change in pysim[master]: wip-wmsim-support

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

dexter gerrit-no-reply at lists.osmocom.org
Wed Jul 4 09:10:14 UTC 2018


dexter has uploaded this change for review. ( https://gerrit.osmocom.org/9883


Change subject: wip-wmsim-support
......................................................................

wip-wmsim-support

Change-Id: I559ac47210a25f7a2010843d9329905f219fe295
---
M pySim/cards.py
1 file changed, 61 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/83/9883/1

diff --git a/pySim/cards.py b/pySim/cards.py
index 0c9c2b8..262ffc7 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -736,11 +736,71 @@
 		# write EF.IMSI
 		data, sw = self._scc.update_binary('6f07', enc_imsi(p['imsi']))
 
+class WavemobileSim(Card):
+	"""
+	WavemobileSim
+
+	"""
+
+	name = 'Wavemobile SIM'
+
+	def __init__(self, ssc):
+		super(WavemobileSim, self).__init__(ssc)
+		self._adm_chv_num = 0x0A
+		self._scc.cla_byte = "00"
+		self._scc.sel_ctrl = "0004" #request an FCP
+
+	@classmethod
+	def autodetect(kls, scc):
+		try:
+			# Look for ATR
+			if scc.get_atr() == toBytes("3B 9F 95 80 1F C7 80 31 E0 73 F6 21 13 67 4D 45 16 00 43 01 00 8F"):
+				return kls(scc)
+		except:
+			return None
+		return None
+
+	def program(self, p):
+		if not p['pin_adm']:
+			raise ValueError("Please provide a PIN-ADM as there is no default one")
+		sw = self.verify_adm(h2b(p['pin_adm']))
+		if sw != '9000':
+			raise RuntimeError('Failed to authenticate with ADM key %s'%(p['pin_adm'],))
+
+		if p.get('smsp') is not None:
+			sw = self.update_smsp(p['smsp'])
+			if sw != '9000':
+				print("Programming SMSP failed with code %s"%sw)
+
+		if p.get('imsi') is not None:
+			sw = self.update_imsi(p['imsi'])
+			if sw != '9000':
+				print("Programming IMSI failed with code %s"%sw)
+
+		print "========================== NOW READ RECORD ON EF SMSP =========================="
+		print self._scc.read_record(EF['SMSP'], 1);
+		print "========================== NOW READ BINARY ON EF IMSI =========================="
+		print self._scc.read_binary(EF['IMSI']);
+
+                r = self._scc.select_file(['3F00'])
+                r = self._scc.select_file(['7f20'])                                
+		print self._scc.read_binary(['6f07']);
+
+
+#              r = self._scc.select_file(['ADF0'])
+
+
+                print "No program yet!"
+                return None
+
+	def erase(self):
+		return
+
 
 # In order for autodetection ...
 _cards_classes = [ FakeMagicSim, SuperSim, MagicSim, GrcardSim,
 		   SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1,
-		   FairwavesSIM, OpenCellsSim ]
+		   FairwavesSIM, OpenCellsSim, WavemobileSim ]
 
 def card_autodetect(scc):
 	for kls in _cards_classes:

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I559ac47210a25f7a2010843d9329905f219fe295
Gerrit-Change-Number: 9883
Gerrit-PatchSet: 1
Gerrit-Owner: dexter <pmaier at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180704/872758b9/attachment.htm>


More information about the gerrit-log mailing list