Skip to content

Commit 9087031

Browse files
committed
Initial Commit
0 parents  commit 9087031

File tree

10 files changed

+596
-0
lines changed

10 files changed

+596
-0
lines changed

.gitignore

+170
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
*.egg-info/
24+
.installed.cfg
25+
*.egg
26+
27+
# PyInstaller
28+
# Usually these are written by a python script from a template
29+
# before PyInstaller builds the binary
30+
*.manifest
31+
*.spec
32+
33+
# Installer logs
34+
pip-log.txt
35+
pip-delete-this-directory.txt
36+
37+
# Virtual environments
38+
venv/
39+
ENV/
40+
env/
41+
.venv/
42+
.ENV/
43+
env.bak/
44+
venv.bak/
45+
46+
# Spyder project settings
47+
.spyderproject
48+
.spyproject
49+
50+
# Unit test / coverage reports
51+
htmlcov/
52+
.tox/
53+
.nox/
54+
.coverage
55+
.coverage.*
56+
.cache
57+
nosetests.xml
58+
coverage.xml
59+
*.cover
60+
*.py,cover
61+
.hypothesis/
62+
.pytest_cache/
63+
pytestdebug.log
64+
65+
# Jupyter Notebook checkpoints
66+
.ipynb_checkpoints
67+
68+
# pyenv
69+
# Ignore Python version management
70+
.python-version
71+
72+
# mypy
73+
.mypy_cache/
74+
.dmypy.json
75+
dmypy.json
76+
77+
# Pyre type checker
78+
.pyre/
79+
80+
# Cython debug symbols
81+
cython_debug/
82+
83+
# VSCode
84+
.vscode/
85+
*.code-workspace
86+
87+
# Sublime Text
88+
*.sublime-project
89+
*.sublime-workspace
90+
91+
# JetBrains IDEs (PyCharm, IntelliJ, etc.)
92+
.idea/
93+
*.iml
94+
95+
# macOS specific files
96+
.DS_Store
97+
.AppleDouble
98+
.LSOverride
99+
100+
# Windows specific files
101+
Thumbs.db
102+
ehthumbs.db
103+
Desktop.ini
104+
$RECYCLE.BIN/
105+
106+
# Visual Studio Code specific
107+
.vscode/settings.json
108+
.vscode/tasks.json
109+
.vscode/launch.json
110+
.vscode/extensions.json
111+
.vscode/*.code-workspace
112+
113+
# virtualenv
114+
pipfile.lock
115+
*.env
116+
117+
# Django stuff:
118+
*.log
119+
local_settings.py
120+
db.sqlite3
121+
db.sqlite3-journal
122+
123+
# Flask stuff:
124+
instance/
125+
.webassets-cache
126+
127+
# Scrapy stuff:
128+
.scrapy
129+
130+
# Sphinx documentation
131+
docs/_build/
132+
133+
# PyInstaller
134+
# Usually these files are written by a Python script from a template
135+
# before PyInstaller builds the binary
136+
*.manifest
137+
*.spec
138+
139+
# Test coverage results
140+
.coverage
141+
.cache
142+
nosetests.xml
143+
coverage.xml
144+
*.cover
145+
*.py,cover
146+
147+
# Travis CI files
148+
.travis.yml
149+
150+
# Celery beat schedule file
151+
celerybeat-schedule
152+
153+
# Environments
154+
.env
155+
*.env
156+
*.venv
157+
158+
# Logs
159+
*.log
160+
161+
# Temporary files
162+
tmp/
163+
*.temp
164+
165+
# Anaconda
166+
.env/
167+
.conda/
168+
169+
# Personal
170+
NOTES.md

Makefile

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Makefile to run git add, commit, and push
2+
3+
# Define a default target
4+
.PHONY: push
5+
6+
# Run the git_push.sh script with a commit message argument
7+
push:
8+
@if [ -z "$(msg)" ]; then \
9+
echo "Error: Please provide a commit message using 'make push msg=\"Your message\"'"; \
10+
exit 1; \
11+
fi
12+
./git-push.sh "$(msg)"

README.md

+175
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,175 @@
1+
# Python Password Manager
2+
3+
Welcome to the **Python Password Manager** — your personal vault for securely managing passwords, powered by the robust combination of **Python** and **MariaDB**. Whether you're tired of forgetting passwords or juggling dozens of them, this tool simplifies your digital life with cutting-edge security built right in.
4+
5+
At its core, the password manager leverages **PBKDF2** (Password-Based Key Derivation Function 2) to transform your **MASTER PASSWORD** and a **DEVICE SECRET** (a unique code tied to your device) into a powerful 256-bit encryption key. This key acts as the ultimate lock-and-key system, ensuring that your passwords are safely encrypted using **AES-256**, one of the most trusted encryption standards today.
6+
7+
With this password manager, your sensitive information is locked away in a local database that only you can access — no cloud storage, no third-party access — just **you and your securely encrypted data**.
8+
9+
Plus, with a command-line interface that’s easy to use and lightning-fast, managing your passwords is not only secure but also fun and efficient. Take control of your digital security while exploring the exciting world of encryption and databases!
10+
11+
---
12+
13+
## Features
14+
- Strong AES-256 encryption for password security.
15+
- User-friendly command-line interface for adding, retrieving, and generating passwords.
16+
- Secure storage of credentials in a local MariaDB database.
17+
- Copy passwords directly to the clipboard using [Pyperclip](https://pypi.org/project/pyperclip/).
18+
19+
---
20+
21+
## Table of Contents
22+
- [Installation](#installation)
23+
- [Linux](#linux)
24+
- [Windows](#windows)
25+
- [Configuration](#configuration)
26+
- [Usage](#usage)
27+
- [Adding Entries](#adding-entries)
28+
- [Retrieving Entries](#retrieving-entries)
29+
- [Generating Passwords](#generating-passwords)
30+
31+
---
32+
33+
## Installation
34+
35+
### Requirements:
36+
- **Python 3.x**
37+
- **MariaDB**
38+
- [Pyperclip](https://pypi.org/project/pyperclip/) (for clipboard functionality)
39+
40+
### Linux
41+
42+
1. **Install Python Requirements:**
43+
```bash
44+
sudo apt install python3-pip
45+
pip install -r requirements.txt
46+
```
47+
48+
2. **Install MariaDB:**
49+
```bash
50+
sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
51+
sudo add-apt-repository 'deb http://ftp.osuosl.org/pub/mariadb/repo/5.5/ubuntuprecise main'
52+
sudo apt-get update
53+
sudo apt-get install mariadb-server
54+
```
55+
56+
3. **Create MariaDB User:**
57+
- Login as root:
58+
```bash
59+
sudo mysql -u root
60+
```
61+
- Create a user:
62+
```sql
63+
CREATE USER 'pm'@localhost IDENTIFIED BY 'password';
64+
```
65+
- Grant necessary privileges:
66+
```sql
67+
GRANT ALL PRIVILEGES ON *.* TO 'pm'@localhost IDENTIFIED BY 'password';
68+
```
69+
70+
4. **Pyperclip Fix (if needed):**
71+
If you encounter a "not implemented error", follow [this guide](https://pyperclip.readthedocs.io/en/latest/index.html#not-implemented-error).
72+
73+
### Windows
74+
75+
1. **Install Python Requirements:**
76+
```bash
77+
pip install -r requirements.txt
78+
```
79+
80+
2. **Install MariaDB:**
81+
Follow [this guide](https://www.mariadbtutorial.com/getting-started/install-mariadb/) for installation on Windows.
82+
83+
3. **Create MariaDB User:**
84+
- Navigate to the MariaDB bin directory:
85+
```bash
86+
C:\Program Files\MariaDB\bin
87+
```
88+
- Login as root:
89+
```bash
90+
mysql.exe -u root -p
91+
```
92+
- Create a user:
93+
```sql
94+
CREATE USER 'pm'@localhost IDENTIFIED BY 'password';
95+
```
96+
- Grant privileges:
97+
```sql
98+
GRANT ALL PRIVILEGES ON *.* TO 'pm'@localhost IDENTIFIED BY 'password';
99+
```
100+
101+
---
102+
103+
## Configuration
104+
105+
Before using the password manager, you need to configure it by setting up a **MASTER PASSWORD**.
106+
107+
1. **Create Configuration:**
108+
Run the following command to set up the MASTER PASSWORD and generate the DEVICE SECRET. This also creates the necessary database and tables.
109+
```bash
110+
python config.py make
111+
```
112+
113+
2. **Delete Configuration:**
114+
Warning: This will permanently delete all saved passwords.
115+
```bash
116+
python config.py delete
117+
```
118+
119+
3. **Remake Configuration:**
120+
This will delete the existing setup and create a new configuration.
121+
```bash
122+
python config.py remake
123+
```
124+
125+
---
126+
127+
## Usage
128+
129+
After configuration, you can use the password manager to add, retrieve, or generate passwords. Below are the common commands:
130+
131+
### Command Help
132+
```bash
133+
python pm.py -h
134+
```
135+
This displays all available options for adding, retrieving, and generating passwords.
136+
137+
### Adding Entries
138+
To add a new entry for a site:
139+
```bash
140+
python pm.py add -s mysite -u mysite.com -e [email protected] -l myusername
141+
```
142+
143+
### Retrieving Entries
144+
- Retrieve all entries:
145+
```bash
146+
python pm.py extract
147+
```
148+
- Retrieve entries by site name:
149+
```bash
150+
python pm.py e -s mysite
151+
```
152+
- Retrieve a specific entry by site name and username:
153+
```bash
154+
python pm.py e -s mysite -l myusername
155+
```
156+
- Copy the password of a specific entry to the clipboard:
157+
```bash
158+
python pm.py e -s mysite -l myusername --copy
159+
```
160+
161+
### Generating Passwords
162+
To generate a random password and copy it to the clipboard:
163+
```bash
164+
python pm.py g --length 15
165+
```
166+
167+
---
168+
169+
## License
170+
This project is licensed under the [MIT License](LICENSE.md).
171+
172+
---
173+
174+
## Contributing
175+
Contributions are welcome! Please open an issue or submit a pull request if you'd like to improve the code or documentation.

TODO.md

Whitespace-only changes.

git-push.sh

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/bash
2+
3+
# Check if a commit message is supplied
4+
if [ -z "$1" ]; then
5+
echo "Error: No commit message supplied."
6+
echo "Usage: ./git_push.sh <commit-message>"
7+
exit 1
8+
fi
9+
10+
# Perform git add, commit, and push
11+
git add .
12+
git commit -m "$1"
13+
git push

requirements.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
commonmark==0.9.1
2+
mysql-connector-python==8.0.29
3+
protobuf==3.20.1
4+
pycryptodome==3.14.1
5+
Pygments==2.12.0
6+
pyperclip==1.8.2
7+
rich==12.3.0

0 commit comments

Comments
 (0)