diff --git a/pySim-read.py b/pySim-read.py index 4b3b1be6..3e25c76d 100755 --- a/pySim-read.py +++ b/pySim-read.py @@ -236,5 +236,6 @@ if __name__ == '__main__': else: print("SIM Service Table: Can't read, response code = %s" % (sw,)) + # Done for this card and maybe for everything ? print("Done !\n") diff --git a/pySim/cards.py b/pySim/cards.py index a12b1111..c0462fb4 100644 --- a/pySim/cards.py +++ b/pySim/cards.py @@ -234,6 +234,24 @@ class Card(object): except Exception as e: print("Can't read AIDs from SIM -- %s" % (str(e),)) + # Select ADF.U/ISIM in the Card using its full AID + def select_adf_by_aid(self, adf="usim"): + # Check for valid ADF name + if adf not in ["usim", "isim"]: + return None + + # First (known) halves of the U/ISIM AID + aid_map = {} + aid_map["usim"] = "a0000000871002" + aid_map["isim"] = "a0000000871004" + + for aid in self._aids: + if aid_map[adf] in aid: + (res, sw) = self._scc.select_adf(aid) + return sw + + return None + class _MagicSimBase(Card): """