Skip to content

Instantly share code, notes, and snippets.

@psychowood
Forked from Marqin/ExportChromePasswords.js
Last active December 7, 2017 09:06
Show Gist options
  • Save psychowood/1b026a6173cffab8f4bc31e08565c3c1 to your computer and use it in GitHub Desktop.
Save psychowood/1b026a6173cffab8f4bc31e08565c3c1 to your computer and use it in GitHub Desktop.
ExportChromePasswords.js
//Go to chrome://settings/passwords and run in console
//Tested on Chrome v62
//You will get lots of "Error in event handler for passwordsPrivate.onPlaintextPasswordRetrieved: TypeError: Cannot read property 'origin' of undefined"
var decryptedRow="";
var pm = PasswordManagerImpl.getInstance();
var pl;
var getNextPassword = function(index) {
pm.getPlaintextPassword(pl[index].loginPair, function(pwd) {
console.log('getting ' + (index+1));
pl[index].password = pwd.plaintextPassword;
if (++index < pl.length) {
getNextPassword(index);
} else {
console.log('done reading passwords, printing',pl);
var decryptedRow = '"Name","URL","Username","Password"';
for(i=0; i<pl.length; i++){
var item = pl[i];
console.log('printing ' + i);
decryptedRow += '<br/>"'+item.loginPair.urls.origin+'","'+item.loginPair.urls.link+'","'+item.loginPair.username+'","'+item.password+'"';
};
var newWindow = window.open("", "MsgWindow " + new Date().getTime());
newWindow.document.write(decryptedRow);
}
});
};
pm.getSavedPasswordList(function(passwords) {
console.log(arguments);
pl = passwords;
console.log('found ' + pl.length + ' passwords');
if (pl.length > 0) {
getNextPassword(0);
} else {
console.log('no saved passwords');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment