From e7de5761bdabb99eb52b8f9be59d4b72cca26a82 Mon Sep 17 00:00:00 2001 From: Randall Winkhart Date: Tue, 20 Jun 2023 14:45:17 -0400 Subject: [PATCH] Hide input when creating or editing a password Former-commit-id: b7224d0533bdb5c82d31d6854fe03c04b3efa6c1 Former-commit-id: 6af841f88fc4ae05c9bfec463b947d82bb5968d6 --- lib/sshyp.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/sshyp.py b/lib/sshyp.py index 55c1138..fe6975c 100755 --- a/lib/sshyp.py +++ b/lib/sshyp.py @@ -408,8 +408,9 @@ def add_entry(): _password, _username, _url, _note = '', '', '', edit_note([]) else: # password entry + from getpass import getpass _username = str(input('\nusername: ')) - _password = str(input('\npassword: ')) + _password = str(getpass(prompt='\npassword: ')) _url = str(input('\nurl: ')) if input('\nadd a note to this entry? (y/N) ').lower() == 'y': _note = edit_note([]) @@ -474,7 +475,8 @@ def edit(): if arguments[2] in ('username', '-u'): _detail, _edit_line = str(input('\nusername: ')), 1 elif arguments[2] in ('password', '-p'): - _detail, _edit_line = str(input('\npassword: ')), 0 + from getpass import getpass + _detail, _edit_line = str(getpass(prompt='\npassword: ')), 0 elif arguments[2] in ('url', '-l'): _detail, _edit_line = str(input('\nurl: ')), 2 if arguments[2] in ('note', '-n'):