There's a boring vacation ahead. Time to start the project.
Here: repository link
#Intro
This is a mini-mini project. The functions are shown below.
- Require a key to log in
- Add password item
- App/site name
- Account/email address
- Password
- Adding time (auto-generate)
- Encrypt the password
- Store password item
- Search for password(s)
- By app/site name
- By account/email address
- Update/delete password item
- Take password item ID as the parameter
- Display the password item before confirming deletion.
- Change log in key
- (2022.1) Generate password. First take a number as password length, and then generate a password with letters, numbers, and symbols.
- Use curses module to display
#Functions
#Log in key
It's easy.
A key is demanded on the first launch. Double check, then hash it and store it in the database. Every time after that, simply input the key and verify to the main interface.
There should be nothing popping on the screen when inputting the log in key.
With
getpass
module:1
2import getpass
pwd = getpass.getpass("[PASSWROD]: ") # hide inputWith
curses.noecho()
#Python Curses Module
Here's the official documentation. Simple as that.
#Encryption, Adding, Deleting, Updating and Searching
Due to the non-reversibility of hashing, another encryption method is needed. Here I shift the ascii code of the character. The offset value is the seconds value of the adding time plus 15. For decryption, shift the ascii backwards, of course.
1 | # offset functions。 only one is enough actually, with changing offset value |
I didn't hide the input when adding password. Some passwords might be complicated. Input them multiple times could be a pain in the **.
When adding password, the box searches for duplicated password items in the database. If there's a password item with the same site/app name and account/email address, the box offers a chance to update password item rather than adding a duplication.
It was hard to use Regx in sqlite3. There's a good solution in StackOverflow which I found suitable for the box.
1 | reg = re.compile(expr, re.I) |
What's left are just database operations.
1 | import sqlite3 |
#To Do
Some are mentioned above. Here're something else.
-
GUIUsed curses instead. -
Use Regx when searchingDOne -
Offer a chance when adding a duplication -
Interface optimizing