Red Rum

Challenge:

We want you to infiltrate DEADFACE as a programmer. Thing is, they're picky about who they bring in. They want to make sure you're the real deal when it comes to programming. Generate a list of numbers 1-500. For each number divisible by 3, replace it with Red; for each number divisible by 5, replace it with Rum. For numbers divisible by both 3 AND 5, replace it with RedRum.

nc env2.hacktober.io 5000

Solution:

This challenge is a pretty straightforward programming challenge which I solved in Python and utilized PwnTools to handle the network communication.

from pwn import *
context.log_level = 'critical'
r = remote('env2.hacktober.io', 5000)
answr = []
for x in range(1, 501):
    if not x % 3 and not x % 5:
        answr.append("RedRum")
    elif not x % 3:
        answr.append("Red")
    elif not x % 5:
        answr.append("Rum")
    else:
        answr.append(str(x))
r.recvuntil("\n")
r.send(f'{",".join(answr)}\n')
print(r.recv().decode())
r.close()

Running the script produces the flag:

$ python3 solve_redrum.py

flag{h33eeeres_j0hnny!!!}

Published:

Updated:

Leave a comment