I work with Python language from time to time but here’s a issue that I have never met.
Actually Im playing with an remote console that asks me to return every word it gives.
For example :
>>> car # Remote console gives a word car # I answer Ok next word ! # Remote console after checking >>> house # Remote console gives a second word and is waiting for me
I could manually answer each word the console says. But I’d like to make a Python script to automate it.
I’m thinking about a loop that would do this job, that is to say :
- get the word from the remote console
- send that word back to the remote console
I tried it with the pwntools library by using the
sendline() commands. I wrote :
import pwn import re c = pwn.remote ("URL", port) question = str(c.recvline()) c.sendline(question) c.interactive()
By doing this, the console returns :
Ok next word ! >>> house
That’s a start but obviously as there’s no loop, the script can’t send “house” back. To adapt it, I used
for loops on the
recvline command but without results after many tries. And I must admit I’m getting stuck.
Is there a trick to do it and put each try inside the
>>> input of the service ?
Any help would be very appreciated.