Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- import time
- import os
- import hashlib
- import getpass
- global listUsers
- global listPass
- global LPassword
- global listHash
- listUsers = []
- listPass = []
- listHash = []
- '''
- def encryptList(username,password):
- for x in username:
- b = random.choice(username)
- c = random.choice(password)
- print(" {} {} {}".format(b,c,x))
- '''
- def passwordHashing(password1):
- hash_object1 = hashlib.sha256(password1.encode())
- hex_dig1 = hash_object1.hexdigest()
- for x in listPass:
- hash_object = hashlib.sha256(x.encode())
- hex_dig = hash_object.hexdigest()
- listHash.append(hex_dig)
- return hex_dig1
- def passwordDictHashing():
- for listPass in dict1:
- hash_object = hashlib.sha256(listPass.encode())
- hex_dig = hash_object.hexdigest()
- return hex_dig
- def Register():
- username = input("Your wished Username :")
- password = getpass.getpass('Your wished Password ::')
- listUsers.append(username)
- listPass.append(password)
- print("Successfully registered !")
- time.sleep(3)
- welcome()
- def welcome():
- os.system('cls' if os.name == 'nt' else 'clear')
- print("Welcome to matt and ivan's lasagna")
- print("Enter number : \n 1. Register \n 2. Login")
- answer = input()
- if answer =='1':
- Register()
- elif answer =='2':
- login()
- else:
- print("You are stupid")
- time.sleep(3)
- os.system('cls' if os.name == 'nt' else 'clear')
- welcome()
- def login():
- Lusername = input("Username : ")
- LPassword = getpass.getpass("UPassword : ")
- BPassword = passwordHashing(LPassword)
- if Lusername in listUsers and BPassword in listHash:
- print("Logged in")
- time.sleep(3)
- loggedIn(Lusername)
- else:
- print("Please try again.")
- time.sleep(1)
- os.system('cls' if os.name == 'nt' else 'clear')
- login()
- #print(username + " " + passowrd)
- def loggedIn(Lusername):
- Lusername = Lusername
- dict1 = {"Usernames":listUsers, "Passwords":listPass, "HashList":listHash}
- os.system('cls' if os.name == 'nt' else 'clear')
- print("Welcome {}!".format(Lusername))
- print("What do you want to do ?\n1. See all users and passwords.\n 2. Return to the main menu.")
- answer = input()
- if answer == "1":
- print('List of usernames : {}'.format(dict1["Usernames"]))
- #print('List of passwords : {}'.format(dict1["Passwords"]))
- print('List of Hash : {}'.format(dict1["HashList"]))
- time.sleep(1)
- answer2 = input("Do you wish to remove an account ?Y/N: ")
- answer2 = answer2.lower()
- if answer2 == "y":
- print("In progress")
- elif answer2 == "n":
- loggedIn(Lusername)
- elif answer == "2":
- welcome()
- '''
- def PasswordEncryption():
- '''
- welcome()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement