-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
195 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,91 @@ | ||
# permutations | ||
# Permutations | ||
|
||
**Permutations** is a local password manager built in Python. It allows users to securely store, view, update, and delete their passwords for various services. The app is modular and provides support for multiple user interfaces, including: | ||
|
||
- **Qt6** (for KDE Plasma builds) | ||
- **GTK4 Libadwaita** (for GNOME builds) | ||
- **WinUI Mica** (for Windows builds) | ||
- **TUI** (Text User Interface) | ||
|
||
### Features | ||
|
||
- **Secure Encryption**: Passwords are encrypted using the Fernet symmetric encryption algorithm from the `cryptography` library. | ||
- **JSON-based Storage**: Passwords are stored in a lightweight, portable JSON file, eliminating the need for a database. | ||
- **Cross-platform Compatibility**: The app supports Windows, macOS, and Linux, storing data in appropriate system-specific directories. | ||
- **Modular Frontends**: Choose your preferred user interface, whether graphical or text-based. | ||
|
||
### Directory Structure | ||
|
||
``` | ||
permutations/ | ||
├── core/ | ||
│ ├── __init__.py | ||
│ ├── core_app.py # Main application logic | ||
│ ├── database.py # Handles JSON-based storage | ||
│ └── encryption.py # Handles encryption and decryption | ||
├── frontends/ | ||
│ ├── qt6/ # Qt6 GUI for KDE | ||
│ ├── gtk4/ # GTK4 Libadwaita GUI for GNOME | ||
│ ├── winui/ # WinUI Mica interface for Windows | ||
│ └── tui/ # Text-based user interface | ||
├── README.md # Project documentation | ||
└── requirements.txt # Python dependencies | ||
``` | ||
|
||
### Requirements | ||
|
||
- Python 3.10+ | ||
- `cryptography` library | ||
- `PyQt6`, `PyGObject`, or other UI libraries depending on the frontend you choose. | ||
|
||
### Installation | ||
|
||
1. Clone the repository: | ||
|
||
```bash | ||
git clone https://github.com/yourusername/permutations.git | ||
cd permutations | ||
``` | ||
|
||
2. Install dependencies: | ||
|
||
```bash | ||
pip install -r requirements.txt | ||
``` | ||
|
||
3. Run the application: | ||
|
||
```bash | ||
python -m core.core_app | ||
``` | ||
|
||
### Usage | ||
|
||
1. **Add a Password**: Input the service name, username, and password. The password is encrypted and saved. | ||
2. **View Passwords**: Retrieve saved passwords. Decrypt them securely. | ||
3. **Update Password**: Update an existing password for a service. | ||
4. **Delete Password**: Remove a password entry from the database. | ||
|
||
### Planned Features | ||
|
||
- **UI Enhancements**: Full support for modular frontends. | ||
- **Windows Installer**: Easy-to-use installer for Windows users. | ||
- **Icon Design**: Custom app icon for better branding. | ||
|
||
### Security Considerations | ||
|
||
- Ensure the encryption key is securely stored and not exposed. | ||
- Use the application in a trusted environment to prevent unauthorized access. | ||
|
||
### Contributing | ||
|
||
Contributions are welcome! Feel free to fork the repository and submit a pull request. | ||
|
||
### License | ||
|
||
This project is licensed under the GNU GPL v3 License. | ||
|
||
--- | ||
|
||
Enjoy managing your passwords with **Permutations**! | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
from encryption import Encryption | ||
from database import Database | ||
from pathlib import Path | ||
import os | ||
import platform | ||
|
||
|
||
if os.name == 'nt': # Windows | ||
data_filepath = Path(os.getenv("APPDATA")) / "permutations" | ||
elif os.name == 'posix': | ||
import platform | ||
system = platform.system() | ||
if system == 'Darwin': # macOS | ||
data_filepath = Path.home() /"Library"/"Application"/"Support"/"permutations" | ||
elif system == 'Linux': # Linux | ||
data_filepath = Path.home() /".local"/"share"/"permutations" | ||
else: | ||
raise ValueError(f"Unsupported POSIX OS: {system}") | ||
else: | ||
raise ValueError(f"Unsupported OS: {os.name}") | ||
|
||
|
||
|
||
class PassMan: | ||
def __init__(self, encryption_key, db_filepath=data_filepath/"passwords.json"): | ||
os.makedirs(data_filepath, exist_ok=True) | ||
self.encryption = Encryption(encryption_key) | ||
self.database = Database(db_filepath) | ||
|
||
def add_passwd(self, service, userid, password): | ||
encrypted_passwd = self.encryption.encrypt(password) | ||
self.database.add_password(service, userid, encrypted_passwd) | ||
|
||
def view_passwd(self): | ||
entries = self.database.get_passwords() | ||
if not entries: | ||
print("No Passwords found") | ||
return | ||
|
||
print("\n Saved Passwords: ") | ||
for entry in entries: | ||
decrypted_passwd = self.encryption.decrypt(entry["password"]) | ||
print(f"Service: {entry["service"]}, Username: {entry["userid"]}, Password: {decrypted_passwd}") | ||
|
||
def update_passwd(self, service, userid, new_password): | ||
encrypted_passwd = self.database.encrypt(new_password) | ||
self.database.update_password(service, userid, encrypted_passwd) | ||
|
||
print(f"Password for {service} updated successfully!") | ||
|
||
def delete_passwd(self, service, userid): | ||
self.database.delete_password(service,userid) | ||
print(f"Password for {service} has been deleted successfully!") | ||
|
||
if __name__ == "__main__": | ||
encryption_key = Encryption.keygen() | ||
|
||
manager = PassMan(encryption_key) | ||
|
||
while True: | ||
print("\nPassword Manager\n") | ||
print("1. Add Password") | ||
print("2. View Passwords") | ||
print("3. Update Password") | ||
print("4. Delete Password") | ||
print("5. Exit") | ||
|
||
print("\nEnter the operation number [1-5]\n") | ||
|
||
choice = int(input("==> ")) | ||
|
||
if choice == 1: | ||
|
||
service = input("Service: ") | ||
userid = input("Username: ") | ||
password = input("Password: ") | ||
|
||
manager.add_passwd(service, userid, password) | ||
|
||
elif choice == 2: | ||
|
||
manager.view_passwd() | ||
|
||
elif choice == 3: | ||
|
||
service = input("Service: ") | ||
userid = input("Username: ") | ||
new_password = input("New Password: ") | ||
|
||
manager.update_passwd(service, userid, new_password) | ||
|
||
elif choice == 4: | ||
service = input("Service: ") | ||
userid = input("Username: ") | ||
|
||
manager.delete_passwd(service,userid) | ||
|
||
elif choice == 5: | ||
print("Exiting Permutations") | ||
break | ||
|
||
else: | ||
print("INVALID CHOICE: Please try again.") |