Skip to content

Instantly share code, notes, and snippets.

@MoradiDavijani
Last active September 12, 2020 18:00
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save MoradiDavijani/bff853361f3506c8005fa03aa7bf745c to your computer and use it in GitHub Desktop.
Save MoradiDavijani/bff853361f3506c8005fa03aa7bf745c to your computer and use it in GitHub Desktop.
As Chrome removed the "Backup" button in "Saved Passwords", you can make a backup from your passwords by running this code in the console!
// 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!
function asyncForEach(array, done, iterator) {
var i = 0;
next();
function next(err) {
if (err) {
done(err);
}
else if (i >= array.length) {
done();
}
else if (i < array.length) {
var item = array[i++];
setTimeout(function() {
iterator(item, i - 1, next);
}, 0);
}
}
}
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, function () {
console.log(JSON.stringify(passwordItems, null, 4));
// Now you can save output in a text file!
}, function (item, index, next) {
passwordSection.passwordManager_.getPlaintextPassword(item.loginPair, function (item) {
passwordItems[index].password = item.plaintextPassword;
next();
}.bind(passwordSection))
});
@duckbrain
Copy link

In Chrome 63, you need to change the function call on line 38 to pass only the index.

- passwordSection.passwordManager_.getPlaintextPassword(item.loginPair, function (item) {
+ passwordSection.passwordManager_.getPlaintextPassword(index, function (item) {

Thank you so much for this.

@ryanpcmcquen
Copy link

Updated for Chrome 63 and modernized a bit:
https://gist.github.com/ryanpcmcquen/cee082bff514f8849a29c409fe3571ff

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