Skip to content

Instantly share code, notes, and snippets.

@pnettto
Last active April 11, 2020 20:03
Show Gist options
  • Save pnettto/82ed60cf46bb16f2f8c3f0ac8f2f578f to your computer and use it in GitHub Desktop.
Save pnettto/82ed60cf46bb16f2f8c3f0ac8f2f578f to your computer and use it in GitHub Desktop.
"""
Creates a CSV file to import passwords into BitWarden from an array
Usage:
- Download this file to a folder in your computer
- Change the file as you wish to add more account entries
- "cd" into the chosen download directory with the Terminal
- Run "python3 generate_bitwarden_import_file.py"
- A file called "generated_passwords.csv" will be created in the same directory
Array item format:
[<Password name>, <User>, <Password>, <Notes>]
"""
# Optional folder to place these passwords
folder = ''
# Read passwords
passwords = [
# Example:
['Account name', 'username-here', 'password-here', ''],
]
# Create CSV file
csv_file = open('generated_passwords.csv', 'w')
# File header
csv_file.write(
'folder,favorite,type,name,notes,fields,login_uri,login_username,login_password,login_totp\n')
# Write account information in BitWarden format
# https://help.bitwarden.com/article/import-data/
for p in passwords:
account_name = p[0]
user = p[1]
password = p[2]
notes = p[3]
csv_file.write(
f'{folder},,login,{account_name},{notes},,,{user},{password},\n')
# Save file
csv_file.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment