Jan-15-2022, 08:15 AM
Hi,
I am doing an assignment in a Python exercise book. I have to create a password manager program that can be used with a command line argument that is the account's name like 'email' or 'blog'. That account's password will be copied to the clipboard so that the user can paste it into a password field. My question is: How do i use this program? What do i have to type in the IDLE shell to show for example the password for 'email'? This is the program i wrote by following the stteps in the book. Any input is much appreciated!
I am doing an assignment in a Python exercise book. I have to create a password manager program that can be used with a command line argument that is the account's name like 'email' or 'blog'. That account's password will be copied to the clipboard so that the user can paste it into a password field. My question is: How do i use this program? What do i have to type in the IDLE shell to show for example the password for 'email'? This is the program i wrote by following the stteps in the book. Any input is much appreciated!
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
#! # pw.py - An insecure password locker program. PASSWORDS = { 'email' : 'F97398uifhilh92' , 'blog' : 'kuhge987De87D' , 'luggage' : '12345' } import sys if len (sys.argv)< 2 : print ( 'Usage: python pw.py [account] - copy account password' ) sys.exit() account = sys.argv[ 1 ] # first command line arg is the account name if account in PASSWORDS: pyperclip.copy(PASSWORDS[account]) print ( 'Password for ' + account + ' copied to clipboard.' ) else : print ( 'There is no account named ' + account) |