diff options
author | Rob Austein <sra@hactrn.net> | 2016-07-12 19:09:31 -0400 |
---|---|---|
committer | Rob Austein <sra@hactrn.net> | 2016-07-12 19:09:31 -0400 |
commit | 5899d649cd366f953db356041bc6dd8b8a5e1f11 (patch) | |
tree | d97ceb9de32225a6a67261205dbc05bfe3af6bdc /projects/hsm/cryptech_upload | |
parent | d05ae0e167690172533a4fdea603080cb4582f86 (diff) |
Make username a command-line option, default "so" as it used to be.
Diffstat (limited to 'projects/hsm/cryptech_upload')
-rwxr-xr-x | projects/hsm/cryptech_upload | 15 |
1 files 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: |