Skip to content

Instantly share code, notes, and snippets.

@ryanpcmcquen
Last active April 24, 2021 11:32
Show Gist options
  • Save ryanpcmcquen/cee082bff514f8849a29c409fe3571ff to your computer and use it in GitHub Desktop.
Save ryanpcmcquen/cee082bff514f8849a29c409fe3571ff to your computer and use it in GitHub Desktop.
DEPRECATED! Chrome now has password export built in.
// 1. Open: chrome://settings/passwords
// 2. Open Chrome developer tools (using F12 or Ctrl+Shift+i).
// 3. Run the following code in the console tab.
// 4. Copy output in a text file and save it somewhere safe!
;(() => {
const asyncForEach = (array, done, iterator) => {
let i = 0
let next = err => {
if (err) {
done(err)
} else if (i >= array.length) {
done()
} else if (i < array.length) {
let item = array[i++]
setTimeout(() => {
iterator(item, i - 1, next)
}, 0)
}
}
next()
}
settingsUi = $$("settings-ui")
settingsPage = Polymer.dom(settingsUi[0].shadowRoot)
container = settingsPage.querySelector("#container")
settingsPasswordsAndForms = Polymer.dom(
Polymer.dom(
Polymer.dom(
settingsPage.querySelector("#main").shadowRoot
).querySelector("settings-basic-page").shadowRoot
).querySelector("settings-passwords-and-forms-page").shadowRoot
)
page = settingsPasswordsAndForms.querySelector("passwords-section")
.shadowRoot
passwordSection = Polymer.dom(
settingsPasswordsAndForms.querySelector("#pages")
).querySelector("#passwordSection")
list = Polymer.dom(page).querySelector("iron-list")
passwordItems = list.get("items")
asyncForEach(
passwordItems,
() => {
console.log(JSON.stringify(passwordItems, null, 4))
// Now you can save the output in a text file!
},
(item, index, next) => {
passwordSection.passwordManager_.getPlaintextPassword(
index,
(item) => {
passwordItems[index].password = item.plaintextPassword
next()
}.bind(passwordSection)
)
}
)
})()
@ryanpcmcquen
Copy link
Author

@gregh747, you have to copy and paste it to a file manually. But, Chrome now has a password export built in, and this no longer works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment