pythonpwntools

How do I use recvline to read specific lines


I am connecting to a server, whereby the server will prompt me a question. To retrieve the question, I used recvline().strip().decode() to retrieve the line outputted. But it gets only the first line, what I am aiming for is the second line.

Please guide me on what I can do to retrieve the second line.

The server outputs:

Ok then! Let's go!
GORGE, FIRE, GORGE, GORGE
What do you do?

This is my code but I am unable to get the second line 'GORGE, FIRE, GORGE, GORGE'

import pwn

p = pwn.remote("83.136.254.233", "56584")

a = p.recvline().strip().decode()
things = ['GORGE', 'FIRE', 'PHREAK']
reply = ['STOP', 'DROP', 'ROLL']
flag = ""
if(a):
    b = p.sendlineafter("(y/n) ", "y")
    if(b):
        c = p.recvline().strip().decode()
        print(c)

else:
    print("bob")

Solution

  • This command:

    p.recvline().strip().decode()
    

    will print the first line. By repeating the same command, I am able to retrieve the second line.