Skip to main content

DarReader

Struct DarReader 

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

Read-only DAR archive reader.

Implementations§

Source§

impl<R> DarReader<R>
where R: Read + Seek,

Source

pub fn open(reader: R) -> Result<DarReader<R>, DarError>

Source

pub fn entry_count(&self) -> usize

Number of catalogue entries, in O(1) — without materialising or cloning the entry list (cheap even for a multi-hundred-thousand-entry archive).

Source

pub fn iter_entries(&self) -> impl Iterator<Item = DarEntry>

Iterate the catalogue entries lazily, cloning one DarEntry at a time rather than allocating the whole Vec up front — for streaming over a large archive (hashing, timelining, filtering) without holding every entry in memory at once. Use entries when you want them all collected.

Source

pub fn entries(&self) -> Vec<DarEntry>

List all archived file entries (path and uncompressed size).

Source

pub fn is_complete(&self) -> bool

Whether the catalog was parsed to a clean end.

false means parsing stopped early — typically at a catalog entry type this reader does not model (e.g. a hardlink or device node) or at corruption — so entries may be an incomplete listing. A forensic caller should treat an incomplete listing as “more may exist”.

Source

pub fn verify<P>(&mut self, path: P) -> Result<CrcStatus, DarError>
where P: AsRef<[u8]>,

Verify a file entry’s data against the CRC stored in the catalogue, decompressing the entry as needed. Returns CrcStatus::Match, CrcStatus::Mismatch, or CrcStatus::NotStored. Unlike a verify-on-extract design, this never refuses to hand over the bytes — a forensic caller can still extract data that fails its CRC in order to examine the corruption.

Source

pub fn extract_to<P, W>( &mut self, path: P, out: &mut W, ) -> Result<u64, DarError>
where P: AsRef<[u8]>, W: Write,

Extract a file by path, streaming its (decompressed) bytes to out and returning the number of bytes written. Unlike extract, this never holds the whole file in memory, so it is safe for multi-GiB entries (and composes with hashing, scanning, or writing to disk).

Source

pub fn extract<P>(&mut self, path: P) -> Result<Vec<u8>, DarError>
where P: AsRef<[u8]>,

Extract a file by path, returning its raw bytes. Buffers the whole entry in memory; prefer extract_to for large files.

Source§

impl DarReader<SliceReader>

Source

pub fn open_slices(basename: &Path) -> Result<DarReader<SliceReader>, DarError>

Open a multi-volume (sliced) archive from its basename: base resolves base.1.dar, base.2.dar, … until a slice is missing. The catalogue lives in the last slice and entry data may span slices — both are handled transparently. Errors if no base.1.dar exists.

Trait Implementations§

Source§

impl<R: Read + Seek> DarAudit for DarReader<R>

Source§

fn audit(&self) -> Vec<Anomaly>

Audit the loaded catalogue for forensic anomalies, returning them sorted most-severe first. See AnomalyKind for what is detected; each Anomaly is an observation, not a conclusion.
Source§

fn write_bodyfile<W: Write>(&self, out: &mut W) -> Result<()>

Write a Sleuth Kit bodyfile — one line per catalogue entry, newline-terminated — to out, for feeding TSK’s mactime timeline tool. Pure metadata over the parsed catalogue; no archive data is read. Read more

Auto Trait Implementations§

§

impl<R> Freeze for DarReader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for DarReader<R>
where R: RefUnwindSafe,

§

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

§

impl<R> Sync for DarReader<R>
where R: Sync,

§

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

§

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

§

impl<R> UnwindSafe for DarReader<R>
where R: UnwindSafe,

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, 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.