Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions Password-Manager/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2020 Anubhab Swain

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
63 changes: 63 additions & 0 deletions Password-Manager/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# Python Password Manager
>Note: This password manager was made as a project and is NOT intended for actual use. Please use more sophisticated and well-tested/trusted password managers to store sensitive data.


## AES Encryption

The encryption method used in this program comes from the python library [PyCryptoDome](https://pypi.org/project/pycryptodome/). This program uses AES encryption methods to store sensitive data (in this case passwords) into a json file.

## Hash Verification
To authenticate the user, they are prompted to create a master password (that is also used to decrypt data) which is then stored using a SHA256 Hash Function and is verified at login. Whenever the user is prompted to verify their master password, the password they enter is compared to the hash of the stored master password and access if granted if the two hashes match.

## Requirements
- astroid (2.3.3)
- colorama (0.4.3)
- cursor (1.3.4)
- halo (0.0.28)
- isort (4.3.21)
- lazy-object-proxy (1.4.3)
- log-symbols (0.0.14)
- mccabe (0.6.1)
- pycryptodome (3.9.4)
- pylint (2.4.4)
- pyperclip (1.7.0)
- six (1.13.0)
- spinners (0.0.23)
- termcolor (1.1.0)
- typed-ast (1.4.0)
- wrapt (1.11.2)

#### To be executed in the terminal:
```shell
pip install astroid
pip install colorama
pip install cursor
pip install halo
pip install isort
pip install lazy-object-proxy
pip install log-symbols
pip install mccabe
pip install pycryptodome
pip install pylint
pip install pyperclip
pip install six
pip install spinners
pip install termcolor
pip install typed-ast
pip install wrapt
```

## Vulnerability
As mentioned at the top, this was made as a project and not intended for actual use. Below I demonstrate what any expert hacker can accomplish by exploiting a vulnerability. Just kidding, anyone can do this. Since the files are stored locally, they can easily be deleted without needing to enter any credentials and consequently all stored passwords are gone along with other data.

## Screenshots
[![Screenshot 1](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/1.png "Screenshot 1")](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/1.png "Screenshot 1")

[![Screenshot 2](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/2.png "Screenshot 2")](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/2.png "Screenshot 2")

[![Screenshot 3](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/3.png "Screenshot 3")](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/3.png "Screenshot 3")

[![Screenshot 4](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/4.png "Screenshot 4")](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/4.png "Screenshot 4")

[![Screenshot 5](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/5.png "Screenshot 5")](https://github.com/anubhab-code/Password-Manager/blob/master/Screenshots/5.png "Screenshot 5")

Binary file added Password-Manager/Screenshots/1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Password-Manager/Screenshots/2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Password-Manager/Screenshots/3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Password-Manager/Screenshots/4.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Password-Manager/Screenshots/5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
69 changes: 69 additions & 0 deletions Password-Manager/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
import os
import json
import sys
import getpass

from os.path import isfile
from hashlib import sha256
from termcolor import colored
from halo import Halo

from modules.encryption import DataManip
from modules.exceptions import UserExits, PasswordFileDoesNotExist
from modules.menu import Manager

def exit_program():
print(colored("Exiting...", "yellow"))
sys.exit()

def start(obj: DataManip):
if os.path.isfile("db/masterpassword.json"):
with open("db/masterpassword.json", 'r') as jsondata:
jfile = json.load(jsondata)

stoyellow_master_pass = jfile["Master"] # load the saved hashed password
master_password = getpass.getpass("Enter Your Master Password: ")

# compare the two hashes of inputted password and stoyellow
spinner = Halo(text=colored("Unlocking", "green"), color="green", spinner=obj.dots_)
if sha256(master_password.encode("utf-8")).hexdigest() == stoyellow_master_pass:
print(colored(f"{obj.checkmark_} Thank you! Choose an option below:", "green"))
# create instance of Manager class
menu = Manager(obj, "db/passwords.json", "db/masterpassword.json", master_password)

try:
menu.begin()
except UserExits:
exit_program()
except PasswordFileDoesNotExist:
print(colored(f"{obj.x_mark_} DB not found. Try adding a password {obj.x_mark_}", "yellow"))
else:
print(colored(f"{obj.x_mark_} Master password is incorrect {obj.x_mark_}", "yellow"))
return start(obj)

else: # First time running program: create a master password
try:
os.mkdir("db/")
except FileExistsError:
pass

print(colored("To start, we'll have you create a master password. Be careful not to lose it as it is unrecoverable.", "green"))
master_password = getpass.getpass("Create a master password for the program: ")
second_input = getpass.getpass("Verify your master pasword: ")

if master_password == second_input:
spinner = Halo(text=colored("initializing base...", "green"), color="green", spinner=obj.dots_)
hash_master = sha256(master_password.encode("utf-8")).hexdigest()
jfile = {"Master": {}}
jfile["Master"] = hash_master
with open("db/masterpassword.json", 'w') as jsondata:
json.dump(jfile, jsondata, sort_keys=True, indent=4)
spinner.stop()
print(colored(f"{obj.checkmark_} Thank you! Restart the program and enter your master password to begin.", "green"))
else:
print(colored(f"{obj.x_mark_} Passwords do not match. Please try again {obj.x_mark_}", "yellow"))
return start(obj)

if __name__ == "__main__":
obj = DataManip()
start(obj)
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading