# ======================================================================================================================
# Author: BERKYT
# ======================================================================================================================
import requests
import re
import hashlib
import random
from rich.console import Console
console = Console()
def decrypt_md5(target_hash: str) -> str:
alphabet = '0123456789abcdefghijklmnopqrstuvwxyz'
with console.status('[bold green]Waiting...[/bold green]'):
while True:
decrypt_hash = ''
for _ in range(4):
decrypt_hash += random.choice(alphabet)
hash_object = hashlib.md5(decrypt_hash.encode('utf-8'))
if hash_object.hexdigest() == target_hash:
return decrypt_hash
def get_hash(responce: str) -> list:
return re.findall(r'(?<=name="hash" value=").+?(?=")', responce)
link = 'https://task1.tasks.rubikoid.ru/c3e97dd6e97fb5125688c97f36720cbe.php'
responce = requests.get(link)
sourse_code_site = responce.text
sourse_code_site = sourse_code_site.split(r'\n')
for line in sourse_code_site:
hash_capture = get_hash(line)
if hash_capture:
hash_capture = hash_capture[0]
break
print(f'{hash_capture=}')
print(f'{decrypt_md5(hash_capture)=}')