Skip to content

Instantly share code, notes, and snippets.

@legowerewolf
Last active April 10, 2020 00:06
Show Gist options
  • Save legowerewolf/addc81b3833106c4be86d6c88ae49c19 to your computer and use it in GitHub Desktop.
Save legowerewolf/addc81b3833106c4be86d6c88ae49c19 to your computer and use it in GitHub Desktop.
Inject passwords into Chrome's Password Manager
$arr = [System.Collections.ArrayList]@()
while ($true) {
$url = Read-Host "Service URL (must be valid, leave empty if done)"
if ($url -eq "") {
break
}
$arr.Add([pscustomobject]@{
name = $url
url = $url
username = Read-Host "Username"
password = Read-Host "Password" -AsSecureString | ConvertFrom-SecureString -AsPlainText
}) | Out-Null
}
if ($arr.Count -eq 0) {
exit
}
Clear-Host
$tmp = New-TemporaryFile | Rename-Item -NewName { $_ -replace 'tmp$', 'csv' } -PassThru
read-host "1. Close Chrome processes so that we may relaunch with the necessary feature enabled. Press ENTER when done."
"2. Open the password manager by clicking your user icon and selecting 'Passwords' from the menu."
"3. Open the import passwords menu by clicking the three-dot icon on the same line as the 'Saved Passwords' title and selecting 'Import' from the menu."
"4. Select the following file: $tmp"
$arr | Export-CSV -Path $tmp
Start-Process -FilePath "${env:ProgramFiles(x86)}\Google\Chrome\Application\chrome.exe" -ArgumentList "--enable-features=PasswordImport"
read-host "5. After importing the file and checking the new entries, press ENTER to clean up..."
Remove-Item $tmp
$arr = $null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment