> For the complete documentation index, see [llms.txt](https://shibudocs.gitbook.io/htb-writeups/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shibudocs.gitbook.io/htb-writeups/cyber-apocalypse-2024-hacker-royale/stop-drop-and-roll.md).

# 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:

<figure><img src="https://746814813-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fe1HXVppEt3OHWIFqtAXT%2Fuploads%2F5f4eK5O84vWM1RD3nCfE%2Fimage.png?alt=media&amp;token=813bb730-51c6-42f5-a689-2db1fe0babce" alt=""><figcaption></figcaption></figure>

```python
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!}`
