Overview
To solve this CTF challenge, you can use the provided rotating wheel to decrypt the ciphertext RKPUYPFCIAKKJMYZZJT. The flag will be in the format MetaCTF{.*}. Here’s a step-by-step approach to solve it:
- Understand the Wheel: The wheel has two concentric circles of characters. The outer circle is fixed, and the inner circle rotates. Each position of the inner circle corresponds to a different substitution cipher.
- Identify the Flag Format: Since the flag format is MetaCTF{.*}, you can use this known prefix to help identify the correct rotation.
- Brute Force the Rotations: You will need to try each possible rotation of the inner wheel and check if the decrypted text starts with METACTF{.
- Decrypt the Ciphertext: For each rotation, map each character of the ciphertext to the corresponding character on the outer wheel. Here’s a Python script to automate this process:
def decrypt(ciphertext, outer_wheel, inner_wheel):
decrypted_text = ""
for char in ciphertext:
if char in outer_wheel:
index = outer_wheel.index(char)
decrypted_text += inner_wheel[index]
else:
decrypted_text += char
return decrypted_text
def find_flag(ciphertext, outer_wheel, inner_wheel):
for rotation in range(len(inner_wheel)):
rotated_inner_wheel = inner_wheel[rotation:] + inner_wheel[:rotation]
decrypted_text = decrypt(ciphertext, outer_wheel, rotated_inner_wheel)
#print(decrypted_text)
if decrypted_text.startswith("METACTF{"):
return decrypted_text
return None
# Define the wheels
outer_wheel = "ABCDEFGHIJKLMNOPQRSTUVWXYZ{}"
inner_wheel = "QNFUVWLEZYXPTKMR}ABJICOSDHG{"
# Ciphertext
ciphertext = "RKPUYPFCIAKKJMYZZJT"
# Find the flag
flag = find_flag(ciphertext, outer_wheel, inner_wheel)
if flag:
print(f"Flag found: {flag}")
else:
print("Flag not found")
Explanation:
- decrypt function: This function takes the ciphertext and the current rotation of the inner wheel and decrypts the text by mapping each character of the ciphertext to the corresponding character on the inner wheel.
- find_flag function: This function iterates through all possible rotations of the inner wheel. For each rotation, it decrypts the ciphertext and checks if the decrypted text starts with MetaCTF{. If it does, it returns the decrypted text as the flag.
- Define the wheels: The outer wheel is fixed as ABCDEFGHIJKLMNOPQRSTUVWXYZ{}. The inner wheel is given as
QNFUVWLEZYXPTKMR}ABJICOSDHG{
. - Ciphertext: The given ciphertext is RKPUYPFCIAKKJMYZZJT.
- Find the flag: The script tries all possible rotations and prints the flag if found. Run this script, and it will output the correct flag by trying all possible rotations of the inner wheel.
Flag: METACTF{WHEELYCOOL}