HackTheBox Terrorfryer Writeup
Explore the basics of cybersecurity in the Terrorfryer Challenge on Hack The Box. This easy-level Challenge introduces encryption reversal and file handling concepts in a clear and accessible way, perfect for beginners.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
from pwn import *
import string
r = process("./fryer")
inp = string.printable[:48]
r.sendlineafter(b"frying: ", inp.encode())
r.recvuntil(b'`')
scrambled = r.recvline().strip(b'`\n').decode()
r.recvuntil(b'`')
expected_output = r.recvline().strip(b'`\n').decode()
flag = []
for char in inp:
index_in_scrambled = scrambled.index(char)
flag.append(expected_output[index_in_scrambled])
print(''.join(flag))
Summary
In the Terrorfryer Challenge on Hack The Box, the goal is to reverse a string shuffling function. The challenge involves submitting an input string of printable characters to retrieve a scrambled result, then deducing the original order of the string. The solution uses pwntools
to automate interaction with the binary, retrieving the scrambled output, and mapping each character back to its correct position in the expected result. This method efficiently reconstructs the flag by iterating over the characters and matching their positions, offering a logical and systematic approach to solving the challenge.