25 lines
720 B
Python
25 lines
720 B
Python
# Import dependencies
|
|
|
|
import sqlite3
|
|
import os
|
|
|
|
# Get the current working directory
|
|
main_directory = os.getcwd()
|
|
|
|
|
|
# Define check database function
|
|
def check_database(pssh: str):
|
|
dbconnection = sqlite3.connect(f"{main_directory}\\keys\\database.db")
|
|
dbcursor = dbconnection.cursor()
|
|
dbcursor.execute("SELECT keys FROM database WHERE pssh = :pssh", {"pssh": pssh})
|
|
vaultkeys = dbcursor.fetchall()
|
|
if vaultkeys:
|
|
vaultkey = str(vaultkeys[0])
|
|
stripped_vault_key = vaultkey.strip(",'()")
|
|
formatted_vault_key = stripped_vault_key.replace('\\n', '\n')
|
|
dbconnection.close()
|
|
return formatted_vault_key
|
|
else:
|
|
dbconnection.close()
|
|
return "Not found"
|