BERKYT

laba_1

May 25th, 2022 (edited)
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.36 KB | None | 0 0
  1. # ======================================================================================================================
  2.  
  3. # Author: BERKYT
  4.  
  5. # ======================================================================================================================
  6.  
  7. import requests
  8. import re
  9. import hashlib
  10. import random
  11.  
  12. from rich.console import Console
  13.  
  14. console = Console()
  15.  
  16.  
  17. def decrypt_md5(target_hash: str) -> str:
  18.     alphabet = '0123456789abcdefghijklmnopqrstuvwxyz'
  19.  
  20.     with console.status('[bold green]Waiting...[/bold green]'):
  21.         while True:
  22.             decrypt_hash = ''
  23.  
  24.             for _ in range(4):
  25.                 decrypt_hash += random.choice(alphabet)
  26.    
  27.             hash_object = hashlib.md5(decrypt_hash.encode('utf-8'))
  28.  
  29.             if hash_object.hexdigest() == target_hash:
  30.                 return decrypt_hash
  31.  
  32.  
  33. def get_hash(responce: str) -> list:
  34.     return re.findall(r'(?<=name="hash" value=").+?(?=")', responce)
  35.  
  36.  
  37. link = 'https://task1.tasks.rubikoid.ru/c3e97dd6e97fb5125688c97f36720cbe.php'
  38. responce = requests.get(link)
  39. sourse_code_site = responce.text
  40. sourse_code_site = sourse_code_site.split(r'\n')
  41.  
  42. for line in sourse_code_site:
  43.     hash_capture = get_hash(line)
  44.     if hash_capture:
  45.         hash_capture = hash_capture[0]
  46.         break
  47.  
  48. print(f'{hash_capture=}')
  49. print(f'{decrypt_md5(hash_capture)=}')
  50.  
Add Comment
Please, Sign In to add comment