Last active
January 4, 2023 03:26
-
-
Save a-mcf/43a60c1352b88ec9a8ca5eb176ac88fe to your computer and use it in GitHub Desktop.
PowerShell Lastpass Encrypted Vault Viewer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<# | |
Quick script to make a LastPass vault export easier to parse, as requested on | |
Security Now #904. | |
Requires an XML file downloaded as per Wladimir Palant's blog and referenced by | |
the show notes: | |
- https://palant.info/2022/12/24/what-data-does-lastpass-encrypt/#downloading-your-lastpass-data | |
You should proably just use this instead: | |
- https://github.com/cfbao/lastpass-vault-parser | |
Example: | |
.\Format-LastPassVault.ps1 -LastPassXmlPath .\DownloadedLastPassVaultXML.xml | |
#> | |
param( | |
[Parameter( | |
Mandatory = $true, | |
Position = 0)] | |
[ValidateScript({$true})] | |
[String] | |
$LastPassXmlPath | |
) | |
[xml] $LastPassXml = Get-Content $LastPassXmlPath | |
# stole this from here | |
# https://stackoverflow.com/questions/17229866/powershell-hex-to-string-conversion | |
function ConvertFrom-Hex | |
{ | |
param($HexString) | |
$converted = for($i=0; $i -lt $HexString.length; $i+=2) | |
{ | |
[char][int]::Parse($HexString.substring($i,2),'HexNumber') | |
} | |
-join $converted | |
} | |
foreach ($a in $LastPassXml.response.accounts.account) | |
{ | |
[PSCustomObject] @{ | |
Name = $a.name | |
UrlId = $a.urlid | |
Id = $a.id | |
Url = ConvertFrom-Hex -HexString $a.url | |
M = $a.m | |
Http = [bool][int] $a.http | |
Favorite = [bool][int] $a.fav | |
favico = $a.favico | |
AutoLogin = [bool][int] $a.autologin | |
BasicAuthSite = [bool][int] $a.basic_auth | |
group = $a.group | |
FiId = $a.fiid | |
AutoGeneratedPW = [bool][int] $a.genpw | |
NoteData = $a.extra | |
IsBookMark = [bool][int] $a.isbookmark | |
NeverAutoFill = [bool][int] $a.never_autofill | |
LastTouched = (Get-Date 01.01.1970).AddSeconds($a.last_modified) | |
LastModified = (Get-Date 01.01.1970).AddSeconds($a.last_touched) | |
IsSecureNote = [bool][int] $a.sn | |
Realm = $a.realm | |
SharedFromId = $a.sharedfromaid | |
PWRepRompt = [bool][int] $a.pwprotect | |
LaunchCount = $a.launch_count | |
UserName = $a.username | |
GroupId = $a.groupid | |
Login = $a.login | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This wasn't tested overly much, but shouldn't hurt your machine. It probably makes more sense to just use the linked project instead, but this is good if you want to play with the fields on the PowerShell CLI.