laforge has uploaded this change for review.
pySim-shell: introduce 'apdu' command for sending raw APDU to card
This can be useful when playing around with cards, for example
sending commands for which pySim-shell doesn't yet have proper support.
Change-Id: Ib504431d26ed2b6f71f77a143ff0a7fb4f5ea02e
---
M pySim-shell.py
1 file changed, 11 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/65/27165/1
diff --git a/pySim-shell.py b/pySim-shell.py
index 875dd64..8a559cb 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -673,6 +673,17 @@
else:
raise ValueError("error: cannot authenticate, no adm-pin!")
+ apdu_cmd_parser = argparse.ArgumentParser()
+ apdu_cmd_parser.add_argument('APDU', type=str, help='APDU as hex string')
+
+ @cmd2.with_argparser(apdu_cmd_parser)
+ def do_apdu(self, opts):
+ """Send a raw APDU to the card, and print SW + Response.
+ DANGEROUS: pySim-shell will not know any card state changes, and
+ not continue to work as expected if you e.g. select a different file."""
+ data, sw = self._cmd.card._scc._tp.send_apdu(opts.APDU)
+ self._cmd.poutput("SW: %s %s, RESP: %s" % (sw, self._cmd.rs.interpret_sw(sw), data))
+
@with_default_category('ISO7816 Commands')
class Iso7816Commands(CommandSet):
To view, visit change 27165. To unsubscribe, or for help writing mail filters, visit settings.