Wargames Python¶
- class interact.Process¶
An class to facilitate interaction with the Wargames process. Creating an instance will connect with the process’s stdin and stdout
- flush()¶
Ensures any data written so far is sent. Blocks until the next time the process reads. Multiple flushes in a row without sends between act as a single flush.
- interactive()¶
Hookup stdin and stdout to the python terminal, allowing user interaction again.
Hit ^C during this to break in the debugger (Only works if program is currently waiting for input)
- interrupt()¶
If debugging, sends a SIGINT to the debugger. This is useful for breaking out of your script into the debugger. NOTE: Only works if program is currently reading input
- readuntil(needle)¶
Keep reading from the process’s stdout until the string needle is found in the output.
Returns everything that it read.
- recv(numberOfBytes)¶
Read numberOfBytes bytes from the process’s stdout, and returns them as a string.
recv may return less data than expected if data is flushed to it.
- send(data)¶
Send data to the process’s stdin
- sendafter(needle, to_send)¶
Keep reading from the process’s stdout until the string needle is found in the output.
After it is found, send to_send to the process’s stdin
Returns everything that it read.
- sendline(data)¶
Send data to the attached process’s stdin followed by a newline
- sendlineafter(needle, to_send)¶
Keep reading from the process’s stdout until the string needle is found in the output.
After it is found, send to_send to the process’s stdin followed by a newline
Returns everything that it read.