Skip to content

Commit

Permalink
Encrypted the password entered
Browse files Browse the repository at this point in the history
  • Loading branch information
SVijayB committed Jul 8, 2020
1 parent e47e7bd commit a7cd556
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 28 deletions.
29 changes: 1 addition & 28 deletions Password Manager/src/Modules/Functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,31 +50,4 @@ def check_details(account):
def destroy():
cursor.execute('DELETE from DETAILS;',)
print("\nDelete",cursor.rowcount,"records\n")
conn.commit()

def password_function():
try:
file = open('../temp/password.txt', 'r')
password = file.read()
while(True):
entered_password = input("Enter your password \n> ")
if(password == entered_password):
green("Logged in successfully")
grey("Press any key to continue...")
input()
break
else:
red("Incorrect password")
except:
green("PASSWORD MANAGER")
cyan("-" * 25)
print("Since, this is the first time you are using Password_manager, Create a password.")
red("DO NOT FORGET THIS PASSWORD. YOU CANNOT CHANGE IT LATER.")
password = input("Enter your password \n> ")
file = open('../temp/password.txt', 'w')
file.write(password)
green("Your password has been saved successfully")
cyan("Relaunch the application to continue.")
grey("Press enter to exit...")
input()
sys.exit(0)
conn.commit()
38 changes: 38 additions & 0 deletions Password Manager/src/Modules/Password.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
from Modules.Colours import *
from cryptography.fernet import Fernet

def password_function():

file = open('../temp/key.txt','rb')
key = file.read()
file.close()

try:
file = open('../temp/password.txt', 'r')
password = file.read()
while(True):
entered_password = input("Enter your password \n> ")
if(password == entered_password):
green("Logged in successfully")
grey("Press any key to continue...")
input()
break
else:
red("Incorrect password")
except:
green("PASSWORD MANAGER")
cyan("-" * 25)
print("Since, this is the first time you are using Password_manager, Create a password.")
red("DO NOT FORGET THIS PASSWORD. YOU CANNOT CHANGE IT LATER.")

password = input("Enter your password \n> ")
fernet = Fernet(key)
encrypted = fernet.encrypt(password)

file = open('../temp/password.txt', 'w')
file.write(encrypted)
green("Your password has been saved successfully")
cyan("Relaunch the application to continue.")
grey("Press enter to exit...")
input()
sys.exit(0)
1 change: 1 addition & 0 deletions Password Manager/src/Password_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import sys
from Modules.Functions import *
from Modules.Colours import *
from Modules.Password import *

if __name__ == "__main__":
os.system('cls')
Expand Down

0 comments on commit a7cd556

Please sign in to comment.