Code
Code
import time
from time import sleep
import os
import pyperclip
NUM =
["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","a","b","c","d","
e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z","1","2","3","4","5","6","7","8","9","0","!","@"
,"$","%","^","&","*","?","."," "]
print("Hello. This is a password manager program which can do the following:\n---Store passwords\n---Generate secure
passwords\n---Encrypt the passwords\n---Delete useless passwords\nNow please the follow the instuctions carefully and enjoy!\
n")
def god():
#Function for writing the PIN and checking if the PIN is inputed correctly.
def write_p():
PIN_write = "Access key:" + PIN
fhand = open('pass_inf.txt', "r+")
y_there = False
for line in fhand:
line = line.rstrip()
if line.startswith("Access key:"):
n = line
if n != PIN_write:
print ("wrong PIN!")
exit()
y_there = True
break
if y_there == False:
fhand.write("\n"+PIN_write)
fhand.close
def generate():
NUM_UPPER =
["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"]
NUM_LOWER = ["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"]
SYM =["!","@","$","%","^","*","?","."]
NUM_noom =["0","1","2","3","4","5","6","7","8","9"]
global message
message = ""
n = input("How long would you like the password to be?\n(Recommended length 6-16)----> ")
try:
int(n)
except:
os.system('cls')
print("Wrong input. Try again!!!")
exit()
g = int(n)
cbrt = g // 4
x = cbrt
y = cbrt
z = cbrt
b = cbrt
while x + y + z + b< g:
x=x+1
break
while x + y + z + b< g:
y=y+1
break
while x + y + z + b< g:
b=b+1
break
while g > 0:
while x > 0:
message = message + random.choice(NUM_UPPER)
x=x-1
break
while y > 0:
message = message + random.choice(NUM_LOWER)
y=y-1
break
while z > 0:
message = message + random.choice(SYM)
z=z-1
break
while b > 0:
message = message + random.choice(NUM_noom)
b=b-1
break
g=g- 1
#Delete Function for removing stored passwords
def remove():
find = input("What is the name of the website you would like to delete your information for? ---->")
global maybe
global found
found = True
maybe = False
with open("pass_inf.txt", "r") as t:
lines = t.readlines()
for i, line in enumerate(lines): #This part of the code is from gabriel
if line.startswith("Website:"+find):
lines[i] = " \n"
maybe = True
with open("pass_inf.txt", "w") as t:
t.writelines(lines)
print("Your information was succesfully deleted!")
if int(choice) == 1:
write_p()
Ans_1()
elif int(choice) == 2:
write_p()
remove()
check()
elif int(choice) == 3:
write_p()
restore()
check()
else:
os.system('cls')
print("\nWrong Input!!!")
god()
instructions()
god()
reuse = "Y"
while reuse == "Y":
sleep(.5)
reuse = input("\nWould you like to use this programm again? ----> (Y/N): ")
if reuse == "Y":
sleep(.3)
os.system('cls')
god()
else:
print("Thanks for using this program!")
exit()