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 size bytes 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 byte bytes of data from pipe. Function blocks until byte bytes 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 line lines of data from pipe. Function blocks until line \n appears 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 until appears in pipe. Function blocks until until appears in available data.

Parameters:until (str) – string to read until.
Returns:data read from pipe including until.
write(buf)

Write buf to pipe.

Parameters:buf (str) – data to be written.
write_line(buf)

Write buf with \n to 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 False to 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 False to 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 False to disable logging.