-
-
Save ryanpcmcquen/cee082bff514f8849a29c409fe3571ff to your computer and use it in GitHub Desktop.
// 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) | |
) | |
} | |
) | |
})() |
Thanks for the code - however, it failed to execute for me, with the following error:
Uncaught TypeError: Cannot read property 'shadowRoot' of null
at :26:51
at :53:3
Any ideas?
Worked for me on latest Chrome. Thanks.
Thanks! Work on chrome 63.0.3239.132 on osx 10.13.2
Worked perfectly on Chrome 63.0.3239.132 on Win 7 64
Appreciate it man, thanks~!
To get a csv for 1password, i adapted the function with console.log to:
function() {
var txt = "";
for (i = 0; i < passwordItems.length; i++) {
var user = passwordItems[i].entry.loginPair.username;
var pw = passwordItems[i].password;
var url = passwordItems[i].entry.loginPair.urls.origin;
// 1pw csv login
txt += (url+','+url+','+user+','+pw+',\n');
}
console.log(txt);
},
(quick hack, probably not ideal. you can play around with the urls.shown and urls.link too)
(@skwashd is doing something elaborate in https://gist.github.com/skwashd/30c918e43fc741e01077b65bc22c6730 )
Hi How to import the file in another system please ?
@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.
where does it save the password text file at??