dissect.cramfs.cramfs¶
Module Contents¶
Classes¶
CramFS filesystem implementation. |
|
Basic buffered stream that provides aligned reads. |
- class dissect.cramfs.cramfs.CramFS(fh: BinaryIO)¶
CramFS filesystem implementation.
- Parameters:
fh – A file-like object of the volume containing the filesystem.
- fh¶
- sb¶
- root¶
- class dissect.cramfs.cramfs.INode(fs: CramFS, offset: int)¶
- fs¶
- offset¶
- __repr__() str¶
- property inode: dissect.cramfs.c_cramfs.c_cramfs.cramfs_inode¶
Return the inode header.
- property mode: int¶
Return the file mode.
- property uid: int¶
Return the user ID.
- property major: int¶
Return the major device ID for block and character devices.
- property minor: int¶
Return the minor device ID for block and character devices.
- property size: int¶
Return the file size.
- property gid: int¶
Return the group ID.
- property data_offset: int¶
Offset to the start of the data block or
INode.For files: this is the offset to the first data block.
For directories: this is the offset to the first
INode.For symlinks: this is the offset the data block holding the target name.
- property name: str¶
Return the name of this inode.
- property link: str¶
Return the symlink target.
- property blocks: list[tuple[int, int]]¶
Return a list containing pairs of starting offsets and byte lengths for each block of this inode.
- is_dir() bool¶
Return whether this inode is a directory.
- is_file() bool¶
Return whether this inode is a file.
- is_symlink() bool¶
Return whether this inode is a symlink.
- is_block_device() bool¶
Return whether this inode is a block device.
- is_character_device() bool¶
Return whether this inode is a character device.
- is_device() bool¶
Return whether this inode is a device file.
- is_fifo() bool¶
Return whether this inode is a FIFO (named pipe).
- is_socket() bool¶
Return whether this inode is a socket.
- is_ipc() bool¶
Return whether this inode is an IPC object (FIFO or socket).
- dirlist¶
- open() BlockStream | dissect.util.stream.RangeStream¶
Return a file-like object for reading.
- class dissect.cramfs.cramfs.BlockStream(inode: INode)¶
Bases:
dissect.util.stream.AlignedStreamBasic buffered stream that provides aligned reads.
- Must be subclassed for various stream implementations. Subclasses can implement:
_read()_seek()
The offset and length for
_readare guaranteed to be aligned for streams of a known size. If your stream has an unknown size (i.e.size == None), reads of length-1(i.e. read until EOF) will be passed through to your implementation of_read. The only time that overriding_seekwould make sense is if there’s no known size of your stream, but still want to provideSEEK_ENDfunctionality.Most subclasses of
AlignedStreamtake one or more file-like objects as source. Operations on these subclasses, like reading, will modify the source file-like object as a side effect.- Parameters:
size – The size of the stream. This is used in read and seek operations.
Noneif unknown.align – The alignment size. Read operations are aligned on this boundary. Also determines buffer size.
- _seek(pos: int, whence: int = 0) int¶
Calculate and return the new stream position after a seek.
- inode¶
- blocks¶
- num_blocks¶