pwnbox.pipe¶
General purpose pipe interface.
-
class
pwnbox.pipe.BasePipe(log_to=stderr, logging=True)¶ Base class of pipes.
Parameters: - log_to – (optional) fd to write logs. Set
Noneto disable logging. - logging (bool) – (optional) use
log_toinstead.
-
close()¶ Close pipe.
-
interact(stdin=stdin, stdout=stdout)¶ Interact pipe directly with standard IO. Graceful return is not guaranteed.
Parameters: - stdin – (optional) standard input fd.
- stdout – (optional) standard output fd.
-
read(*args, **kwargs)¶ 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(*args, **kwargs)¶ Read exactly
countbytes of data from pipe. Function blocks untilcountbytes of data is available.Parameters: byte (int) – (optional) size of data in bytes to read. Returns: data read from pipe.
-
read_line(*args, **kwargs)¶ 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(*args, **kwargs)¶ Read up some data from pipe. Function blocks until at least a byte of data is available.
Returns: data read from pipe.
-
read_until(*args, **kwargs)¶ Read until
untilappears in pipe. Function blocks untiluntilappears in available data.Parameters: until (str) – string to read until. Returns: data read from pipe ends with until.
-
write(*args, **kwargs)¶ Write
bufto pipe.Parameters: buf (str) – data to be written.
-
write_line(*args, **kwargs)¶ Write
datawith\nto pipe.Parameters: data (str) – data to be written.
- log_to – (optional) fd to write logs. Set
-
class
pwnbox.pipe.Pipe(**kwargs)¶ An echo pipe with
os.pipe().Parameters: kwargs – BasePipeoptions.
-
pwnbox.pipe.connect(*args, **kwargs)¶ Alias of
SocketPipe.
-
class
pwnbox.pipe.SocketPipe(addr, port, **kwargs)¶ A pipe with a TCP connection.
Parameters: - addr (str) – network address of remote server.
- port (int) – port number of remote server.
- kwargs –
BasePipeoptions.
-
pwnbox.pipe.popen(*args, **kwargs)¶ Alias of
ProcessPipe.