pwnbox.pipe¶
General purpose pipe interface.
-
class
pwnbox.pipe.Pipe(logging=True)¶ Base class of pipes.
-
close()¶ Close pipe.
-
interact()¶ Interact pipe directly with standard IO.
-
read(size=4096)¶ Read up to
sizebytes of data from pipe. Function blocks until at least a byte of data is available.Parameters: size (int) – (optional) maximum size of data in bytes to read. Returns: data read from pipe.
-
read_byte(byte=1)¶ Read exactly
bytebytes of data from pipe. Function blocks untilbytebytes of data is available.Parameters: byte (int) – (optional) size of data in bytes to read. Returns: data read from pipe.
-
read_line(line=1)¶ Read exactly
linelines of data from pipe. Function blocks untilline\nappears in available data.Parameters: line (int) – (optional) lines to read. Returns: data read from pipe including \n.
-
read_some()¶ Read up some data from pipe. Function blocks until at least a byte of data is available.
Returns: data read from pipe.
-
read_until(until)¶ Read until
untilappears in pipe. Function blocks untiluntilappears in available data.Parameters: until (str) – string to read until. Returns: data read from pipe including until.
-
write(buf)¶ Write
bufto pipe.Parameters: buf (str) – data to be written.
-
write_line(buf)¶ Write
bufwith\nto pipe.Parameters: buf (str) – data to be written.
-
-
class
pwnbox.pipe.ProcessPipe(cmd=None, **kwargs)¶ A pipe with local process.
Parameters: - cmd (str) – command to execute.
- logging (bool) – (optional) set
Falseto disable logging.
-
class
pwnbox.pipe.SocketPipe(addr=None, port=None, **kwargs)¶ A pipe with TCP server.
Parameters: - addr (str) – network address of remote server.
- port (int) – port number of remote server.
- logging (bool) – (optional) set
Falseto disable logging.
-
class
pwnbox.pipe.StringPipe(data, **kwargs)¶ A pipe from string data. Useful when simulating pipe.
Parameters: - data (str) – data to be pushed into read buffer.
- logging (bool) – (optional) set
Falseto disable logging.