Кодировщик
Кодировщик
Platform: hackerlab | Category: Misc | Type: Challenge | Difficulty: Easy | OS: NA | Author: XESXOR | Date: 2025-12-25 | Status: Solved Techniques: Base32 encoding automation, Regex pattern matching for data extraction, Time-limited challenge automation with pwntools
Summary
Task: Encode random strings in Base32 within time limit across 50 rounds. Solution: Automated with pwntools to receive strings, encode them, and send responses before timeout.
Кодировщик — hackerlab
Description
Опять кошка, но, в этот раз она будет капризничать, если в течении нескольких секунд не погладишь её
Server: 62.173.140.174:10002
Analysis
When connecting to the server:
- Need to send the
startcommand to begin the game - Server provides 50 rounds
- Each round gives a random string that needs to be encoded in Base32
- Only a few seconds are given to respond
- Manual solving is impossible — automation is required
Server message format:
(1/50) random_string
>>>
Solution
Automation using pwntools:
python read-only • copy allowed#!/usr/bin/env python3 from pwn import * import base64 import re HOST = "62.173.140.174" PORT = 10002 conn = remote(HOST, PORT) conn.recvuntil(b">>>") conn.sendline(b"start") for i in range(50): data = conn.recvuntil(b">>>", timeout=10) match = re.search(r'\((\d+)/50\)\s+(.+)', data.decode()) if match: text = match.group(2).strip() encoded = base64.b32encode(text.encode()).decode() conn.sendline(encoded.encode()) print(conn.recvall(timeout=10).decode()) # FLAG: CODEBY{REDACTED}
Algorithm:
- Connection — establish TCP connection via pwntools
- Start game — send the
startcommand - Loop through 50 rounds:
- Receive data until the
>>>marker - Extract the string to encode using regex
- Encode in Base32 using
base64.b32encode() - Send the response
- Receive data until the
- Get the flag — after 50 successful rounds the server returns the flag
Notes
- Base32 uses alphabet A-Z and 2-7, outputs strings that are multiples of 8 characters with
=padding - pwntools — ideal tool for automating CTF tasks with network interaction
- The name "50 times encrypted" in the flag hints at the 50 encoding rounds