dissect.target.containers.vdi#

Module Contents#

Classes#

VdiContainer

VirtualBox hard disks

class dissect.target.containers.vdi.VdiContainer(fh: BinaryIO | pathlib.Path, *args, **kwargs)#

Bases: dissect.target.container.Container

VirtualBox hard disks

static detect_fh(fh: BinaryIO, original: list | BinaryIO) bool#

Detect if this Container can be used to open the file-like object fh.

The function checks wether the raw data contains any magic information that corresponds to this specific container.

Parameters:
  • fh – A file-like object that we want to open a Container on.

  • original – The original argument passed to detect().

Returns:

True if this Container can be used for this file-like object, False otherwise.

static detect_path(path: pathlib.Path, original: list | BinaryIO) bool#

Detect if this Container can be used to open path.

The function checks wether file inside path is formatted in such a way that this Container can be used to read it. For example, it validates against the file extension.

Parameters:
  • path – A location to a file.

  • original – The original argument passed to detect().

Returns:

True if this Container can be used for this path, False otherwise.

read(length: int) bytes#

Read a length of bytes from this Container.

seek(offset: int, whence: int = io.SEEK_SET) int#

Change the stream position to offset.

whence determines where to seek from:

  • io.SEEK_SET (0):: absolute offset in the stream.

  • io.SEEK_CUR (1):: current position in the stream.

  • io.SEEK_END (2):: end of stream.

Parameters:
  • offset – The offset relative to the position indicated by whence.

  • whence – Where to start the seek from.

tell() int#

Returns the current seek position of the Container.

close() None#

Close the container.

Override this if you need to clean-up anything.