Skip to content

Instantly share code, notes, and snippets.

@made-by-chris
Created February 26, 2021 14:28
Show Gist options
  • Save made-by-chris/2118b3db136ed4935083036948b2cc54 to your computer and use it in GitHub Desktop.
Save made-by-chris/2118b3db136ed4935083036948b2cc54 to your computer and use it in GitHub Desktop.
extract passwords from lastpass browser plugin when you forget master password
const timeout = (ms) => new Promise((res) => setTimeout(res, ms));
const items = document.querySelectorAll(".itemWrapper");
console.log(
`duration: ${
items.length * 4
} seconds. password info will be copied to your clipboard (like copy/paste)`
);
const res = [];
async function go(i) {
var newItem = {};
var item = items[i];
item.querySelector(".itemButton.edit").click();
await timeout(2000);
newItem.url = document.querySelector("#siteDialogName").value;
newItem.name = document.querySelector("#siteDialogUsername").value;
newItem.password = document.querySelector("#siteDialogPassword").value;
document.querySelector("#dialogOverlay").click();
await timeout(2000);
console.log(newItem);
res.push(newItem);
if (i === count - 1) {
copy(res);
} else {
go(i + 1);
}
}
go(0);
@jonathan-s
Copy link

What?! Could this be abused?

@made-by-chris
Copy link
Author

for sure yeh it could be maliciously used. I just needed to create something to retrieve my passwords after losing the master password, i hope this will help other people in the same situation. :D

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