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


Change subject: cards: Add support for Gialer SIM cards
......................................................................

cards: Add support for Gialer SIM cards

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



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/86/32686/1

diff --git a/pySim/cards.py b/pySim/cards.py
index b48a80c..c3c0e9a 100644
--- a/pySim/cards.py
+++ b/pySim/cards.py
@@ -1657,10 +1657,53 @@
         return


+class GialerSim(SimCard):
+    """
+    Gialer sim cards (www.gialer.com).
+    """
+
+    name = 'gialersim'
+
+    @classmethod
+    def autodetect(kls, scc):
+        return None
+
+    def program(self, p):
+        # Authenticate
+        self._scc.verify_chv(0xc, h2b('3834373936313533'))
+
+        # EF.ICCID
+        self._scc.select_path(['3f00', '2fe2'])
+        self._scc.update_binary('2fe2', enc_iccid(p['iccid']))
+
+        # EF.IMSI
+        self._scc.select_path(['3f00', '7f20', '6f07'])
+        self._scc.update_binary('6f07', enc_imsi(p['imsi']))
+
+        # EF.ACC
+        if p.get('acc') is not None:
+            self._scc.update_binary('6f78', lpad(p['acc'], 4))
+
+        # EF.SMSP
+        if p.get('smsp'):
+            self._scc.select_path(['3f00', '7f10', '6f42'])
+            self._scc.update_record('6f42', 1, lpad(p['smsp'], 80))
+
+        self._scc.select_path(['3f00', '0001'])
+        self._scc.update_binary('0001', p['ki'])
+
+        # EF.HPLMN
+        r = self._scc.select_path(['3f00', '7f20', '6f30'])
+        size = int(r[-1][4:8], 16)
+        hplmn = enc_plmn(p['mcc'], p['mnc'])
+        self._scc.update_binary('6f30', hplmn + 'ff' * (size - 3))
+
+
 # In order for autodetection ...
 _cards_classes = [FakeMagicSim, SuperSim, MagicSim, GrcardSim,
                   SysmoSIMgr1, SysmoSIMgr2, SysmoUSIMgr1, SysmoUSIMSJS1,
-                  FairwavesSIM, OpenCellsSim, WavemobileSim, SysmoISIMSJA2]
+                  FairwavesSIM, OpenCellsSim, WavemobileSim, SysmoISIMSJA2,
+                  GialerSim]


 def card_detect(ctype, scc):

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

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: Icd2021aec630ac018f66ab565e03112047389e17
Gerrit-Change-Number: 32686
Gerrit-PatchSet: 1
Gerrit-Owner: matanp <[email protected]>
Gerrit-MessageType: newchange

Reply via email to