dissect.target.containers.asif¶
Module Contents¶
Classes¶
Base class that acts as a file-like object wrapper around anything that can behave like a "raw disk". |
- class dissect.target.containers.asif.AsifContainer(fh: BinaryIO | pathlib.Path, *args, **kwargs)¶
Bases:
dissect.target.container.ContainerBase class that acts as a file-like object wrapper around anything that can behave like a “raw disk”.
Containers are anything from raw disk images and virtual disks, to evidence containers and made-up binary formats. Consumers of the
Containerclass only need to implementseek,tellandread. Override__init__for any opening that you may need to do, but don’t forget to initialize the super class.- Parameters:
fh – The source file-like object of the container or a
Pathobject to the file.size – The size of the container.
vs – An optional shorthand to set the underlying volume system, usually set later.
- __type__ = 'asif'¶
A short string identifying the type of container.
- asif¶
- stream¶
- static detect_path(path: pathlib.Path, original: list | BinaryIO) bool¶
Detect if this
Containercan be used to openpath.The function checks wether file inside
pathis formatted in such a way that thisContainercan 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:
Trueif thisContainercan be used for this path,Falseotherwise.
- seek(offset: int, whence: int = io.SEEK_SET) int¶
Change the stream position to
offset.whencedetermines 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.