Get 2Lakh Prize Money
If you solve Easyalgo DSA sheet then you can get a chance to get a prize of Rs. 2 lakhs, you have to solve only 350 questions.!
March 11, 2024, 5:20 a.m.
Password manager means that you store all your passwords, like YouTube, Facebook, and your personal password, securely, so you don't have to worry about remembering them.
Password manager means that you store all your passwords, like YouTube, Facebook, and your personal password, securely, so you don't have to worry about remembering them.That is a password manager application built using the Python Tkinter library.This provides a secure and simple way to store.This technology helps internet users create,save, manage, or use passwords across different online services.
Used to implement Password managment system requires following technology:
The password manager must be able to handle many users and store the password and username for websites, apps, and games.
from cryptography.fernet import Fernet
class PasswordManager:
def __init__(self):
self.key=None
self.password_file=None
self.password_dict={}
def create_key(self,path):
self.key = Fernet.generate_key()
# print(self.key)
with open(path,'wb') as f:
f.write(self.key)
# # create mykey.kev
# pm = PasswordManager()
# pm.create_key("mykey.kev")
def load_key(self,path):
with open(path,'rb') as f:
self.key=f.read()
def create_password_file(self,path,initial_value=None):
self.password_file=path
if initial_value is not None:
for key,value in initial_value.items():
# pass #ToDO: add password function
self.add_password(key,value)
def load_password_file(self,path):
self.password_file=path
with open(path,'r') as f:
for line in f:
site, encrypted = line.split(":")
self.password_dict[site]= Fernet(self.key).decrypt(encrypted.encode()).decode()
def add_password(self,site,password):
self.password_dict[site]=password
if self.password_file is not None:
with open(self.password_file,'a+') as f:
encrypted = Fernet(self.key).encrypt(password.encode())
f.write(site + "."+encrypted.decode()+"\n")
def get_password(self,site):
return self.password_dict[site]
def main():
password={
"email": "1234567",
"facebook": "myfbpassword",
"youtube":"helloworld123",
"something":"myfavoritepassword_123"
}
pm = PasswordManager()
print("""what do you want to do
(1)Create a new key
(2) Load a existing key
(3) Create new password file
(4) Add existing password file
(5) Get a password
(q) quit
""")
done= False
while not done:
choice = input("Enter your choice:")
if choice=="1":
path = input("Enter path :")
pm.create_key(path)
elif choice=="2":
path = input("Enter path:")
pm.load_key(path)
elif choice == "3":
path = input("enter Path: ")
pm.create_password_file(path,password)
elif choice=="4":
path = input("Enter path:")
pm.load_password_file(path)
elif choice=="5":
site = input("Enter the site :")
password= input("Enter the password:")
pm.add_password(site,password)
elif choice=="6":
site = input("what site do you want:")
print(f"Password for {site} is {pm.get_password(site)}")
elif choice == "q":
done=True
print("Bye")
else:
print("Invalid choice !")
if __name__=="__main__":
main()
Firstly, import the library, like the fernet class, from the cryptography.fernet module. This class used to be.
Depending on your choices, the code will perform actions such as generation of keys,saving and loading passwords, and displaying passwords.
Press the above action, then create a "testkey. key", "mypasswords.pass".
The program uses the fernet class for encryption and decryption.When your passwords are added or loaded, this key is encrypted using the encryption key. When passwords are retrieved, they are decrypted using the same key.
open mypasswords.pass andmypasswords.pass provide a decrypted password.
email.gAAAAABlx3Sl7JnGu1CZTjVkLRzNmL7xGpiSK0OaIdUVZr_oNVkC_C_M9ZdJ3Bh9LFF5tj1bMc-ijQ1X7DqWviLAF0umXmD-3w== facebook.gAAAAABlx3SmIJtZlfbPCKg5vUwVTPQQ18M1KK7KpJZvbZ_ujph5nTbVDctgUMBcbnyQQOX1gERsRHO--RrKwagdZkzzoGKpuQ== youtube.gAAAAABlx3SmrVGCKUa8mSK8GGWXe49LRZLjPNL1h-x6zoKVZ8R4zTvIgQvKLC9kraXO-jCp3yCVOjsvN9R9lD_52p4OwTQCFg== something.gAAAAABlx3SmwXFjmStEfYdR7sfsQ72HZyZe3TNn_Iablr8vo-N-z4uveb7BtnDVXvwR1jdZisgKBNQnc-OtxhW0lQ5BWlaLZGOAB21AqpPii9Ig2m7V6bU=
This program provides basic password manager properties where users can manage their passwords using a command-line interface.That is the act of creating, loading, saving,adding, and retrieving passwords securely.
If you solve Easyalgo DSA sheet then you can get a chance to get a prize of Rs. 2 lakhs, you have to solve only 350 questions.!
If you solve Easyalgo DSA sheet then you can get a chance to get a prize of Rs. 2 lakhs, you have to solve only 350 questions.!
Copyright © EasyAlgo All Rights Reserved
Comments
Add Comment