Skip to main content

Ext4Fs

Struct Ext4Fs 

Source
pub struct Ext4Fs<R: Read + Seek> { /* private fields */ }
Expand description

Forensic-grade ext4 filesystem reader.

Accepts any Read + Seek source (raw image file, EWF reader, etc.). Provides both standard filesystem access (tier 1) and forensic operations (tier 2).

Implementations§

Source§

impl<R: Read + Seek> Ext4Fs<R>

Source

pub fn open(source: R) -> Result<Self>

Open an ext4 filesystem from a Read+Seek source.

Source

pub fn superblock(&self) -> &Superblock

Reference to the superblock.

Source

pub fn read_file(&mut self, path: &str) -> Result<Vec<u8>>

Read a file’s contents by path.

Source

pub fn read_dir(&mut self, path: &str) -> Result<Vec<DirEntry>>

List directory entries by path.

Source

pub fn metadata(&mut self, path: &str) -> Result<InodeMetadata>

Get full metadata for a path.

Read a symlink’s target by path.

Source

pub fn exists(&mut self, path: &str) -> Result<bool>

Check if a path exists.

Source

pub fn read_dir_by_ino(&mut self, dir_ino: u64) -> Result<Vec<DirEntry>>

List directory entries by inode number.

Source

pub fn lookup_by_ino( &mut self, dir_ino: u64, name: &[u8], ) -> Result<Option<u64>>

Lookup a name inside a directory by inode number.

Read symlink target by inode number.

Source

pub fn read_inode_data(&mut self, ino: u64) -> Result<Vec<u8>>

Read file data by inode number.

Source

pub fn read_inode_data_range( &mut self, ino: u64, offset: u64, len: usize, ) -> Result<Vec<u8>>

Read a range of file data by inode number.

Source

pub fn inode(&mut self, ino: u64) -> Result<Inode>

Read any inode by number.

Source

pub fn all_inodes(&mut self) -> Result<Vec<(u64, Inode)>>

Enumerate all inodes (allocated and deleted).

Source

pub fn deleted_inodes(&mut self) -> Result<Vec<DeletedInode>>

Find all deleted inodes (dtime != 0).

Source

pub fn orphan_inodes(&mut self) -> Result<Vec<DeletedInode>>

Find all orphan inodes (links_count == 0, dtime == 0, mode != 0).

Source

pub fn recover_file(&mut self, ino: u64) -> Result<RecoveryResult>

Attempt to recover a deleted file by inode number.

Source

pub fn journal(&mut self) -> Result<Journal>

Parse the jbd2 journal.

Source

pub fn timeline(&mut self) -> Result<Vec<TimelineEvent>>

Generate a forensic timeline of all filesystem events.

Source

pub fn xattrs(&mut self, ino: u64) -> Result<Vec<Xattr>>

Read block-stored extended attributes for an inode.

Source

pub fn unallocated_blocks(&mut self) -> Result<Vec<BlockRange>>

Get all unallocated block ranges.

Source

pub fn read_unallocated(&mut self, range: &BlockRange) -> Result<Vec<u8>>

Read raw data from an unallocated block range.

Source

pub fn slack_space(&mut self, ino: u64) -> Result<Option<SlackSpace>>

Read slack space for a single file inode.

Source

pub fn scan_all_slack(&mut self) -> Result<Vec<SlackSpace>>

Scan all allocated regular file inodes for slack space.

Source

pub fn hash_file(&mut self, ino: u64) -> Result<FileHash>

Compute BLAKE3, SHA-256, MD5, and SHA-1 hashes for a file by inode number.

Source

pub fn hash_all_files(&mut self) -> Result<Vec<FileHash>>

Hash all allocated regular files on the filesystem.

Source

pub fn inode_history(&mut self, ino: u64) -> Result<Vec<HistoryVersion>>

Reconstruct the version history of an inode from the journal.

Source

pub fn recover_dir_entries( &mut self, dir_ino: u64, ) -> Result<Vec<RecoveredDirEntry>>

Recover deleted directory entries from rec_len gaps in a single directory.

Source

pub fn recover_all_dir_entries(&mut self) -> Result<Vec<RecoveredDirEntry>>

Recover deleted directory entries from all directories on the filesystem.

Source

pub fn is_inode_allocated(&mut self, ino: u64) -> Result<bool>

Check if a specific inode is allocated.

Source

pub fn is_block_allocated(&mut self, block: u64) -> Result<bool>

Check if a specific block is allocated.

Source

pub fn read_block(&mut self, block: u64) -> Result<Vec<u8>>

Read a raw block by number.

Source

pub fn verify_superblock_backups(&mut self) -> Result<Vec<SuperblockComparison>>

Verify all superblock backups against the primary.

Source

pub fn search_blocks( &mut self, pattern: &[u8], scope: SearchScope, ) -> Result<Vec<SearchHit>>

Search for a byte pattern across filesystem blocks.

Auto Trait Implementations§

§

impl<R> !Freeze for Ext4Fs<R>

§

impl<R> RefUnwindSafe for Ext4Fs<R>

§

impl<R> Send for Ext4Fs<R>
where R: Send,

§

impl<R> Sync for Ext4Fs<R>
where R: Send,

§

impl<R> Unpin for Ext4Fs<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for Ext4Fs<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for Ext4Fs<R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.