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
  [MEGALEAK] HackTheBox ProLabs, Fortress, Endgame - Alchemy, 250 Flags, leak htb-bot htb-bot 106 42,236 10-31-2026, 07:33 PM
Last Post: aistax
  [FREE] 300+ Writeups PDF HackTheBox/HTB premium retired Tamarisk 383 138,756 10-31-2026, 11:47 AM
Last Post: thaytoiyeucoay30nam
  HTB PWN- Oxidized ROP macavitysworld 4 1,043 10-29-2026, 01:01 PM
Last Post: A1Raid3r
  HTB - code + titanic walkthrough | free tony_boom23 3 7,260 10-25-2026, 06:35 AM
Last Post: A1Raid3r
  HTB apt lab note zapot 14 35,533 10-03-2026, 08:09 PM
Last Post: whuuaa



 Users browsing this thread: 1 Guest(s)