acquire.acquire.volatilestream

Module Contents

Classes

VolatileStream

Streaming class to handle various procfs and sysfs edge-cases. Backed by AlignedStream.

Functions

timeout

Timeout a function if it takes too long to complete.

Attributes

acquire.acquire.volatilestream.HAS_FCNTL = True
acquire.acquire.volatilestream.timeout(func: collections.abc.Callable, *, timelimit: int) collections.abc.Callable

Timeout a function if it takes too long to complete.

Parameters:
  • func – a function to wrap.

  • timelimit – The time in seconds that an operation is allowed to run.

Raises:

TimeoutError – If its time exceeds the timelimit

class acquire.acquire.volatilestream.VolatileStream(path: pathlib.Path, mode: str = 'rb', flags: int = os.O_RDONLY | getattr(os, 'O_NOATIME', 0) | getattr(os, 'O_NONBLOCK', 0), size: int = 1024 * 1024 * 5)

Bases: dissect.util.stream.AlignedStream

Streaming class to handle various procfs and sysfs edge-cases. Backed by AlignedStream.

Parameters:
  • path – Path of the file to obtain a file-handle from.

  • mode – Mode string to open the file-handle with. Such as “rt” and “rb”.

  • flags – Flags to open the file-descriptor with.

  • size – The maximum size of the stream. None if unknown.

fh
fd
seek(pos: int, whence: int = SEEK_SET) int

Seek the stream to the specified position.

Returns:

The new stream position after seeking.

seekable() bool

Indicate that the stream is seekable.