[Cryptech-Commits] [sw/stm32] branch master updated: Make username a command-line option, default "so" as it used to be.

git at cryptech.is git at cryptech.is
Tue Jul 12 23:09:17 UTC 2016


This is an automated email from the git hooks/post-receive script.

sra at hactrn.net pushed a commit to branch master
in repository sw/stm32.

The following commit(s) were added to refs/heads/master by this push:
       new  5899d64   Make username a command-line option, default "so" as it used to be.
5899d64 is described below

commit 5899d649cd366f953db356041bc6dd8b8a5e1f11
Author: Rob Austein <sra at hactrn.net>
AuthorDate: Tue Jul 12 19:09:31 2016 -0400

    Make username a command-line option, default "so" as it used to be.
---
 projects/hsm/cryptech_upload | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/projects/hsm/cryptech_upload b/projects/hsm/cryptech_upload
index 64b9440..0c3f6fc 100755
--- a/projects/hsm/cryptech_upload
+++ b/projects/hsm/cryptech_upload
@@ -76,6 +76,12 @@ def parse_args():
                         help = "Location of firmware tarball",
                         )
 
+    parser.add_argument("--username",
+                        choices = ("so", "wheel"),
+                        default = "so",
+                        help = "Username to use when logging into the HSM",
+                        )
+
     actions = parser.add_mutually_exclusive_group(required = True)
     actions.add_argument("--fpga",
                          action = "store_true",
@@ -128,15 +134,11 @@ def _execute(dst, cmd):
     _write(dst, "\r")
     prompt = _read(dst)
     if prompt.endswith("Username: "):
-        if sys.version_info[0] > 2:
-            user = input("Username (so, wheel): ")
-        else:
-            user = raw_input("Username (so, wheel): ")
-        _write(dst, user + "\r")
+        _write(dst, args.username + "\r")
         prompt = _read(dst)
         if prompt.endswith("Password: "):
             if not pin:
-                pin = getpass.getpass("PIN: ")
+                pin = getpass.getpass("{} PIN: ".format(args.username))
             _write(dst, pin + "\r")
             prompt = _read(dst)
     if not prompt.endswith(("> ", "# ")):
@@ -237,6 +239,7 @@ If you got here by accident, ^C now, without answering the PIN prompt.
 
 
 def main():
+    global args
     args = parse_args()
 
     if args.bootloader and not args.simon_says_whack_my_bootloader:

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Commits mailing list