added read config file and testing results

This commit is contained in:
crp3844
2022-09-07 10:42:04 -04:00
parent d684cd0360
commit a8cb3ca250

View File

@@ -54,6 +54,17 @@ def build_logger(level):
return logger
def read_config_file(config_file):
config = configparser.ConfigParser()
config.read(config_file)
sections = config.sections()
accounts = dict()
for section in sections:
accounts[decrypt(client, section)] = dict()
for key in config[section]:
accounts[decrypt(client, section)][key] = decrypt(client, config[section][key])
return accounts
def create_encryption_key(client):
# Create an encryption key.
try:
@@ -311,13 +322,12 @@ if __name__ == "__main__":
else:
print("This value must be one of the following characters: n, q.")
while True:
config = configparser.ConfigParser()
config.read(secrets_ini_file)
accounts = config.sections()
accounts = read_config_file
print(accounts)
print("Current Bitwarden accounts:")
print(" ")
for account in accounts:
print(decrypt(client, account))
print(account)
print(" ")
print("e) Edit account")
print("n) New account")