updated get account details to only return encryption. updated new account to use the encrypted fields

This commit is contained in:
crp3844
2022-09-07 10:29:45 -04:00
parent e16cd74e4d
commit 503e5bce53

View File

@@ -220,13 +220,13 @@ def ask_for_account_details():
print("The Bitwarden account vault passwords do not match, please try again.") print("The Bitwarden account vault passwords do not match, please try again.")
array = dict() array = dict()
array["account_email_address"] = account_email_address #array["account_email_address"] = account_email_address
array["encrypted_account_email_address"] = encrypted_account_email_address array["encrypted_account_email_address"] = encrypted_account_email_address
array["account_api_client_id"] = account_api_client_id #array["account_api_client_id"] = account_api_client_id
array["encrypted_account_api_client_id"] = encrypted_account_api_client_id array["encrypted_account_api_client_id"] = encrypted_account_api_client_id
array["account_api_secret"] = account_api_secret #array["account_api_secret"] = account_api_secret
array["encrypted_account_api_secret"] = encrypted_account_api_secret array["encrypted_account_api_secret"] = encrypted_account_api_secret
array["account_vault_password"] = account_vault_password #array["account_vault_password"] = account_vault_password
array["encrypted_account_vault_password"] = encrypted_account_vault_password array["encrypted_account_vault_password"] = encrypted_account_vault_password
return array return array
@@ -299,10 +299,10 @@ if __name__ == "__main__":
if user_input.casefold() == "n": if user_input.casefold() == "n":
account_details = ask_for_account_details() account_details = ask_for_account_details()
config = configparser.ConfigParser() config = configparser.ConfigParser()
config.add_section(account_details["account_email_address"]) config.add_section(account_details["encrypted_account_email_address"])
for key in account_details.keys(): for key in account_details.keys():
if not key == "account_email_address": if not key == "encrypted_account_email_address":
config.set(account_details["account_email_address"], key, account_details[key]) config.set(account_details["encrypted_account_email_address"], key, account_details[key])
with open(secrets_ini_file, "w") as configfile: with open(secrets_ini_file, "w") as configfile:
config.write(configfile) config.write(configfile)
break break
@@ -317,7 +317,7 @@ if __name__ == "__main__":
print("Current Bitwarden accounts:") print("Current Bitwarden accounts:")
print(" ") print(" ")
for account in accounts: for account in accounts:
print(account) print(decrypt(client, account))
print(" ") print(" ")
print("e) Edit account") print("e) Edit account")
print("n) New account") print("n) New account")
@@ -330,10 +330,10 @@ if __name__ == "__main__":
elif user_input.casefold() == "n": elif user_input.casefold() == "n":
account_details = ask_for_account_details() account_details = ask_for_account_details()
config.add_section(account_details["account_email_address"]) config.add_section(account_details["encrypted_account_email_address"])
for key in account_details.keys(): for key in account_details.keys():
if not key == "account_email_address": if not key == "encrypted_account_email_address":
config.set(account_details["account_email_address"], key, account_details[key]) config.set(account_details["encrypted_account_email_address"], key, account_details[key])
with open(secrets_ini_file, "w") as configfile: with open(secrets_ini_file, "w") as configfile:
config.write(configfile) config.write(configfile)
break break