Skip to content

Instantly share code, notes, and snippets.

@ryzhovau
Last active May 15, 2023 18:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ryzhovau/ce7eae2cad7f4e7b7704ecc272447ef1 to your computer and use it in GitHub Desktop.
Save ryzhovau/ce7eae2cad7f4e7b7704ecc272447ef1 to your computer and use it in GitHub Desktop.
Aegis → Bitwarden Migration
<#
.SYNOPSIS
Converts Aegis data file to Bitwarden format
.DESCRIPTION
This is a way to import Aegis TOTP records to Bitwarden
.NOTES
* Export unencrypted *.JSON file from Aegis App
* Edit $AegisExportFile
* Run script
* Import *.JSON.Bitwarden.csv as Bitwarden CSV format
You'll find new TOTP accounts at "Aegis import YYYYMMDD" folder
Also, you have to add URLs to new accounts manually.
Tested on Aegis 2.1.3, Vaultwarden 2023.3.0, Linux Powershell 7.3.4
.LINK
https://github.com/beemdevelopment/Aegis
https://github.com/dani-garcia/vaultwarden
#>
# Path to unencrypted Aegis backup file
$AegisExportFile = '~/Рабочий стол/aegis-export-plain-3390701544822992525.json'
# An import sanitizer
$ErrorActionPreference = 'Stop'
(Get-Content $AegisExportFile | ConvertFrom-Json).db.entries |
# Yandex, Steam and other non-standard algos ignored
Where-Object {$PSItem.info.algo -EQ 'SHA1'} |
ForEach-Object {
# CSV template from https://bitwarden.com/help/condition-bitwarden-import/
[ordered]@{
folder = 'Aegis import ' + (Get-Date -Format FileDate)
favorite = ''
type = 'login'
name = $PSItem.issuer
notes = ''
fields = ''
reprompt = 0
login_uri = ''
login_username = $PSItem.name
login_password = ''
login_totp = $PSItem.info.secret
}
} |
Export-Csv -NoTypeInformation -QuoteFields $false -Encoding utf8 -Path ($AegisExportFile + '.Bitwarden.csv')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment