Created
October 28, 2015 17:12
-
-
Save cmatskas/6e3fa687e97651416430 to your computer and use it in GitHub Desktop.
ExportChromePasswords.js
This file contains 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
var decryptedRow=""; | |
var pm = PasswordManager.getInstance(); | |
var model = pm.savedPasswordsList_.dataModel; | |
var pl = pm.savedPasswordsList_; | |
for(i=0;i<model.length;i++){ | |
PasswordManager.requestShowPassword(i); | |
}; | |
setTimeout(function(){ | |
decryptedRow += '"hostname","username","password","formSubmitURL","httpRealm","usernameField","passwordField"'; | |
for(i=0; i<model.length; i++){ | |
var item = pl.getListItemByIndex(i); | |
decryptedRow += '<br/>"http://'+model.array_[i][0]+'","'+model.array_[i][1]+'","'+item.childNodes[0].childNodes[2].childNodes[0].value+'","http://'+model.array_[i][0]+'"," "," "," "'; | |
}; | |
document.write(decryptedRow); | |
} | |
,300); |
Updated for Chrome 55 on MacOS 10.12.2. Tested on 403 passwords.
During processing you can see percent of processed passwords.
Small note: if you have many passwords, Chrome will ask password several times during export.
var pm = PasswordManager.getInstance();
var pl = pm.savedPasswordsList_;
function sleep(ms) {
return new Promise((r) => { setTimeout(() => {r()}, ms) })
}
var model = pm.savedPasswordsList_.dataModel;
(async function() {
await sleep(1000);
var item, url, user, pass;
pl.scrollTop = 0;
var decryptedRow = '"url","username","password"\n';
for (i=0; i < model.array_.length; i++) {
var percent = ((i+1) / model.array_.length * 100).toFixed(2);
console.log('Processing: ' + percent + '%');
pass = null;
await sleep(100);
PasswordManager.requestShowPassword(i);
await sleep(600);
while (! pass || pass.trim().length == 0) { // while pass length == 0, Chrome showing password dialog
try {
item = pl.getListItemByIndex(i).childNodes[0];
} catch (e) {
await sleep(1000);
try {
item = pl.getListItemByIndex(i).childNodes[0];
} catch (e2) {
console.log('ERROR on index ' + i, pl.getListItemByIndex(i));
}
}
url = item.childNodes[0].childNodes[0]
user = item.childNodes[1].childNodes[0].value
pass = item.childNodes[2].childNodes[0].value
if (pass.trim().length == 0) {
await sleep(1000);
}
}
decryptedRow += url + ', ' + user + ', ' + pass + '\n'
pl.scrollTop += 32;
};
console.log(decryptedRow);
})();
If you want to speed up the above script, just replace all sleep timer to 10. Tested on 840 rows of passwords, reducing waiting time does not change anything and speed up the process by almost 100x
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
updated