From 7b9e24482d5615b0ae87c77fd90989314f4acbe7 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 22 Mar 2023 15:19:54 +0100 Subject: [PATCH] pySim-shell: add cardinfo command It may sometimes be helpful to get a bit of general information about the card. To sort out problems it sometimes helps to get an idea what card type and ICCID pySim-shell has in memory. Change-Id: If31ed17102dc0108e27a5eb0344aabaaf19b19f9 --- pySim-shell.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pySim-shell.py b/pySim-shell.py index ef6a2b1b..d09b45a1 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -731,6 +731,17 @@ class PySimCommands(CommandSet): else: raise ValueError("error: cannot authenticate, no adm-pin!") + def do_cardinfo(self, opts): + """Display information about the currently inserted card""" + self._cmd.poutput("Card info:") + self._cmd.poutput(" Name: %s" % self._cmd.card.name) + self._cmd.poutput(" ATR: %s" % b2h(self._cmd.card._scc.get_atr())) + self._cmd.poutput(" ICCID: %s" % self._cmd.iccid) + self._cmd.poutput(" Class-Byte: %s" % self._cmd.card._scc.cla_byte) + self._cmd.poutput(" Select-Ctrl: %s" % self._cmd.card._scc.sel_ctrl) + self._cmd.poutput(" AIDs:") + for a in self._cmd.rs.mf.applications: + self._cmd.poutput(" %s" % a) @with_default_category('ISO7816 Commands') class Iso7816Commands(CommandSet):