From 228c98e4c6974f881039534d4178cb1e0a468be1 Mon Sep 17 00:00:00 2001 From: Philipp Maier Date: Wed, 10 Mar 2021 20:14:06 +0100 Subject: [PATCH] pySim-shell: use -a / -A commandline option to authenticate pySim-shell defines, just like the other pySim programs commandline arguments that take an ADM pin to authenticate at the card as admin. The arguments are defined, but not used. Add the missing authentication part. Change-Id: I6bed14eb8f4124e28d593cf0816dbe58e7271322 Related: OS#4963 --- pySim-shell.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pySim-shell.py b/pySim-shell.py index e596d11a..41febd63 100755 --- a/pySim-shell.py +++ b/pySim-shell.py @@ -339,4 +339,14 @@ if __name__ == '__main__': app = PysimApp(card, rs, opts.script) rs.select('MF', app) + + # If the user supplies an ADM PIN at via commandline args authenticate + # immediatley so that the user does not have to use the shell commands + pin_adm = sanitize_pin_adm(opts.pin_adm, opts.pin_adm_hex) + if pin_adm: + try: + card.verify_adm(h2b(pin_adm)) + except Exception as e: + print(e) + app.cmdloop()