laforge has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/pysim/+/37684?usp=email )


Change subject: pySim-shell: Support hexadecimal ADM pin in 'verify_adm'
......................................................................

pySim-shell: Support hexadecimal ADM pin in 'verify_adm'

Change-Id: I4191ed79ebe7869d8411d280a32ac2d4bbc210e3
Closes: OS#6480
---
M pySim-shell.py
1 file changed, 20 insertions(+), 2 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/84/37684/1

diff --git a/pySim-shell.py b/pySim-shell.py
index 6673963..e9fc637 100755
--- a/pySim-shell.py
+++ b/pySim-shell.py
@@ -826,6 +826,8 @@
     verify_adm_parser = argparse.ArgumentParser()
     verify_adm_parser.add_argument('ADM1', nargs='?', 
type=is_hexstr_or_decimal,
                                    help='ADM1 pin value. If none given, CSV 
file will be queried')
+    verify_adm_parser.add_argument('--pin-is-hex', action='store_true',
+                                   help='ADM1 pin value is specified as 
hex-string (not decimal)')

     @cmd2.with_argparser(verify_adm_parser)
     def do_verify_adm(self, opts):
@@ -834,12 +836,18 @@
         """
         if opts.ADM1:
             # use specified ADM-PIN
-            pin_adm = sanitize_pin_adm(opts.ADM1)
+            if opts.pin_is_hex:
+                pin_adm = sanitize_pin_adm(None, opts.ADM1)
+            else:
+                pin_adm = sanitize_pin_adm(opts.ADM1)
         else:
             iccid = self._cmd.rs.identity['ICCID']
             # try to find an ADM-PIN if none is specified
             result = card_key_provider_get_field('ADM1', key='ICCID', 
value=iccid)
-            pin_adm = sanitize_pin_adm(result)
+            if opts.pin_is_hex:
+                pin_adm = sanitize_pin_adm(None, result)
+            else:
+                pin_adm = sanitize_pin_adm(result)
             if pin_adm:
                 self._cmd.poutput("found ADM-PIN '%s' for ICCID '%s'" % 
(result, iccid))
             else:

--
To view, visit https://gerrit.osmocom.org/c/pysim/+/37684?usp=email
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I4191ed79ebe7869d8411d280a32ac2d4bbc210e3
Gerrit-Change-Number: 37684
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <[email protected]>
Gerrit-MessageType: newchange

Reply via email to