HTB - Secure Signing
by Windows7 - Friday August 2, 2024 at 05:54 AM
#1
brute.py

#!/usr/bin/env python3 import pwn import string from hashlib import sha256 def xor(a, b):     return bytes([i ^ j for i, j in zip(a, b)]) def H(m):     return sha256(m).digest() def send_payload(conn, payload):     # receive until '> '     conn.recvuntil(b'> ')     # send '1'     conn.sendline(b'1')     # receive until 'Enter your message: '     conn.recvuntil(b'Enter your message: ')     # send payload     conn.sendline(payload)     # get hash receiving the next line     h = conn.recvline().decode().split(":")[1].strip()     return h host = '94.237.59.63'  #change accordingly port = 35688   #change accordingly # establish connection conn = pwn.remote(host, port) flag = "" l = 1 while not flag.endswith("}"):     sentinel = H(b'\0'*l).hex()     with pwn.log.progress('Finding next character {} + _...'.format(flag)):         for c in string.printable:             guess = flag + c             # send guess             h_guess = send_payload(conn, guess.encode('utf-8'))             if h_guess == sentinel:                 print(f"Found next character of flag: {c}")                 flag += c                 break         else:             # next character not found             print("Couldn't found next character. Cracking failed.")             exit(1)     l += 1 print("Cracked flag! {}".format(flag)) # close connection conn.close()
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [FREE] 300+ Writeups PDF HackTheBox/HTB premium retired Tamarisk 360 91,518 03-28-2026, 09:28 AM
Last Post: catsweet
  [FREE] HTB-ProLabs APTLABS Just Flags kewlsunny 23 4,826 03-28-2026, 03:30 AM
Last Post: lulaladrow
  [MEGALEAK] HackTheBox ProLabs, Fortress, Endgame - Alchemy, 250 Flags, leak htb-bot htb-bot 87 10,019 03-27-2026, 07:22 PM
Last Post: stn
  HTB Eloquia User and Root Flags - Insane Box 69646B 13 2,807 03-27-2026, 06:14 PM
Last Post: vlxw
  HTB - ALL Challenges you Stuck in osamy7593 2 3,100 03-27-2026, 04:24 PM
Last Post: catsweet



 Users browsing this thread: