## Difficulty 50/100 | MEDIUM They need to figure out that the first part of the message is a substitution alphabet, then decrypt the code, and then finally figure out the flag is embedded in the last message they sent. ## Category Crypto ## How To Solve The first part of every message line was a substitution table, the second part the message. Just substitute the message and the last message will contain the flag. ```python3 from pwn import * import string p = remote("localhost", 3006) p.recvline() while True: msg = p.recvline().decode() p.recvuntil(b"> ") print(msg) alphabet = msg.split(" | ")[0] message = msg.split(" | ")[1][:-1] alphabet_map = dict(zip(alphabet, string.ascii_letters)) decoded = "".join([alphabet_map[c] if c in alphabet_map else c for c in message]) print(f"Sending back decoded: '{decoded}'") p.sendline(decoded.encode()) p.recvline() ``` ## Flag IGCTF{Some-wicked-story-unfolded-here-great-work}