Add count for tool/gnuk_get_random.py.
authorNIIBE Yutaka <gniibe@fsij.org>
Sun, 24 Feb 2019 06:12:12 +0000 (15:12 +0900)
committerNIIBE Yutaka <gniibe@fsij.org>
Sun, 24 Feb 2019 06:12:12 +0000 (15:12 +0900)
tool/gnuk_get_random.py

index ac50818..c140ee4 100755 (executable)
@@ -5,11 +5,17 @@ from binascii import hexlify
 import sys
 
 if __name__ == '__main__':
+    count = 0
     gnuk = get_gnuk_device()
     gnuk.cmd_select_openpgp()
     looping = (len(sys.argv) > 1)
     while True:
-        challenge = gnuk.cmd_get_challenge().tostring()
+        try:
+            challenge = gnuk.cmd_get_challenge().tostring()
+        except Exception as e:
+            print(count)
+            raise e
         print(hexlify(challenge))
+        count = count + 1
         if not looping:
             break