dissect.squashfs#

Submodules#

Package Contents#

Classes#

FileStream

Create a stream from multiple runs on another file-like object.

INode

SquashFS

exception dissect.squashfs.Error#

Bases: Exception

Common base class for all non-exit exceptions.

exception dissect.squashfs.FileNotFoundError#

Bases: Error

Common base class for all non-exit exceptions.

exception dissect.squashfs.NotADirectoryError#

Bases: Error

Common base class for all non-exit exceptions.

exception dissect.squashfs.NotAFileError#

Bases: Error

Common base class for all non-exit exceptions.

exception dissect.squashfs.NotASymlinkError#

Bases: Error

Common base class for all non-exit exceptions.

class dissect.squashfs.FileStream(inode: INode)#

Bases: dissect.util.stream.RunlistStream

Create a stream from multiple runs on another file-like object.

This is common in filesystems, where file data information is stored in “runs”. A run is a (block_offset, block_count) tuple, meaning the amount of consecutive blocks from a specific starting block. A block_offset of None represents a sparse run, meaning it must simply return all \x00 bytes.

Parameters:
  • fh – The source file-like object.

  • runlist – The runlist for this stream in block units.

  • size – The size of the stream. This can be smaller than the total sum of blocks (to account for slack space).

  • block_size – The block size in bytes.

  • align – Optional alignment that differs from the block size, otherwise block_size is used as alignment.

class dissect.squashfs.INode(fs: SquashFS, block: int, offset: int, name: str | None = None, type: int | None = None, inode_number: int | None = None, parent: INode | None = None)#
property inode_number: int#
property type: int#
property mode: int#
property uid: int#
property guid: int#
property gid: int#
property mtime: datetime.datetime#
property size: int | None#
__repr__() str#

Return repr(self).

header() dissect.cstruct.Instance#
data_block() int#
data_offset() int#
is_dir() bool#
is_file() bool#
is_block_device() bool#
is_character_device() bool#
is_device() bool#
is_fifo() bool#
is_socket() bool#
is_ipc() bool#
listdir() dict[str, INode]#
iterdir() Iterator[INode]#
block_list() list[tuple[int | None, int]]#
open() FileStream#
class dissect.squashfs.SquashFS(fh: BinaryIO)#
inode(block: int, offset: int, name: str | None = None, type: int | None = None, inode_number: int | None = None, parent: INode | None = None) INode#
get(path: str | int, node: INode | None = None) INode#
iter_inodes() Iterator[INode]#