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)
)
}
)
})()
Copy link

ghost commented Jan 9, 2018

Worked for me on latest Chrome. Thanks.

@RobertoD91
Copy link

Thanks! Work on chrome 63.0.3239.132 on osx 10.13.2

@WolfieOne
Copy link

Worked perfectly on Chrome 63.0.3239.132 on Win 7 64
Appreciate it man, thanks~!

@guruz
Copy link

guruz commented Feb 1, 2018

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 )

@sunil-gcet
Copy link

Hi How to import the file in another system please ?

@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