1use crate::types::ExtractionResult;
2use anyhow::Result;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6pub struct FsEntry {
7 pub path: String,
8 pub size: u64,
9 pub is_dir: bool,
10}
11
12#[derive(Debug, Clone, Serialize, Deserialize)]
13pub struct UnallocatedRegion {
14 pub offset: u64,
15 pub data: Vec<u8>,
16}
17
18pub trait ForensicFs: Send + Sync {
19 fn list(&self, path: &str) -> Result<Vec<FsEntry>>;
20 fn read(&self, path: &str) -> Result<Vec<u8>>;
21 fn exists(&self, path: &str) -> bool;
22 fn unallocated_regions(&self) -> Vec<UnallocatedRegion>;
23}
24
25pub trait ForensicPlugin: Send + Sync {
26 fn name(&self) -> &str;
27 fn detect(&self, fs: &dyn ForensicFs) -> bool;
28 fn extract(
29 &self,
30 fs: &dyn ForensicFs,
31 local_offset_seconds: Option<i32>,
32 ) -> Result<ExtractionResult>;
33}