print("You have not installed the required modules. Follow these steps to do so:\n\n1. Open the terminal (Linux/MacOS) or command prompt (Windows).\n2. Navigate to this directory and then to the files directory.\n3. Type 'pip install -r dependencies.txt'.\n4. Restart the program.\n\nIf you have followed all the steps correctly, keyvault will work on the next start.")
exit()
withopen("database/db.dat","rb")asf:
whileTrue:
defdatabase_enc():
conn=sc.connect("database/keyvault.db")
cursor=conn.cursor()
ifpath.isfile("database/keyvault.db"):
for_inrange(3):
try:
db=pickle.load(f)
exceptEOFError:
print("\nDatabase loaded.")
password=gp(prompt="Enter master password: ")
conn.execute(f"PRAGMA key = {password}")
conn.execute('''
CREATETABLEIFNOTEXISTSdata(
idINTEGERPRIMARYKEYAUTOINCREMENT,
serviceTEXT,
usernameTEXT,
emailTEXT,
passwordTEXT,
websiteTEXT,
categoryTEXT,
notesTEXT,
totpTEXT)
''')
passCorrect=True
break
shred()
exceptsc.DatabaseError:
print("Incorrect password.\n")
passCorrect=False
defshred():
withopen("database/db.dat","wb")asf:
for_inrange(5):
f.seek(0)
f.write(urandom(path.getsize("database/db.dat")))
remove("database/db.dat")
ifnotpassCorrect:
print("You have entered a wrong password three times. Please restart the program to try again.")