Stop Drop and Roll

Personal Rating: Medium

Its another question-answer type of thing where you need to script the answers. Jonas shew me pwntools, which makes this sort of thing really easy:

from pwn import *
import sympy

# connect to the server
r = remote('83.136.255.100', 34140)

# wait until ')' is received
r.recvuntil(b')')

# send a 'y' as response to 'Ready? (y|n)'
r.sendline(b'y')

# wait until the next newline
r.recvuntil(b'\n')

while 1 == 1:
    # wait until the next newline, so until the first question and store it in 'resp'
    resp = r.recvuntil(b'\n')
    print(resp)

    # Format the question to exlude the text and replace the strings as required for the answer
    # if GORGE type STOP
    # if PHREAK type DROP
    # if FIRE type ROLL
    # if GORGE, FIRE type STOP-ROLL
    # replace commas with hyphen and remove newline
    resp = resp.replace(b'What do you do? ',b'')
    resp = resp.replace(b'GORGE',b'STOP')
    resp = resp.replace(b'PHREAK',b'DROP')
    resp = resp.replace(b'FIRE',b'ROLL')
    resp = resp.replace(b', ',b'-')
    resp = resp.replace(b'\n',b'')
    print(resp)

    # send the response
    r.sendline(resp)

HTB{1_wiLl_sT0p_dR0p_4nD_r0Ll_mY_w4Y_oUt!}

Last updated