path: root/pySim-read.py
diff options
authorSupreeth Herle <herlesupreeth@gmail.com>2020-03-18 11:38:00 +0100
committerSupreeth Herle <herlesupreeth@gmail.com>2020-03-22 10:17:03 +0100
commit4c306ab200891837e2a7b729d88495ec78f20540 (patch)
treef130f168ddf54e9c41483028320b5fd7909cef3f /pySim-read.py
parente4e98316a8bfabc9b1ce6952c1721d5c093cc9c1 (diff)
pySim-read.py: Added a common card detection function for both pySim-prog.py and pySim-read.py
This function is used to detect the card type and return Card class/Card subclasses object if its a know card or else None. Also, an initial step towards refactoring of code. Change-Id: I71f57c6403dc933bd9d54f90df3d3fe105b4f66f
Diffstat (limited to 'pySim-read.py')
1 files changed, 4 insertions, 0 deletions
diff --git a/pySim-read.py b/pySim-read.py
index 55b43d7..bad2047 100755
--- a/pySim-read.py
+++ b/pySim-read.py
@@ -31,6 +31,7 @@ import sys
from pySim.ts_51_011 import EF, DF
from pySim.commands import SimCardCommands
+from pySim.cards import card_detect, Card
from pySim.utils import h2b, swap_nibbles, rpad, dec_imsi, dec_iccid, dec_msisdn, format_xplmn_w_act, dec_spn
@@ -94,6 +95,9 @@ if __name__ == '__main__':
# Program the card
print("Reading ...")
+ # Initialize Card object by auto detecting the card
+ card = card_detect("auto", scc) or Card(scc)
(res, sw) = scc.read_binary(EF['ICCID'])
if sw == '9000':