22 lines
482 B
Python
22 lines
482 B
Python
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()
|