Skip to main content

Crate scrump_core

Crate scrump_core 

Source
Expand description

Core traits and types for scrump.

A capture file is opened by exactly one Format implementation, which yields scannable Chunks for the detection engine. The engine produces Hits, which the format then applies as in-place redactions. The final bytes can be obtained via Format::to_bytes (used by container formats to repackage their members) or written atomically with write_atomic.

Structs§

Chunk
A region inside the source file that the detection engine should scan.
Dispatcher
Routes a file (by path or bytes) to the appropriate Format handler.
Handler
A handler entry registered with the Dispatcher.
Hit
A confirmed sensitive region to be redacted.

Enums§

ChunkOrigin
Origin of a chunk inside a capture file. Carrying this with each chunk lets format-specific scrubbers make smarter redaction decisions and lets the CLI explain where a hit was found.
Replacement
Strategy for redacting a Hit.
ScrumpError
Errors produced by format and engine code.
VerifyResult
Verification result from an optional live HTTP probe.

Traits§

Detector
A detection rule: a regex (+ optional entropy floor) matching candidate secrets in arbitrary bytes.
Format
A handler for one specific capture-file format.

Functions§

apply_hits_in_place
Apply a list of Hits to a flat byte buffer in place.
shannon_entropy
Shannon entropy of a byte slice in bits per byte (range 0.0..=8.0).
write_atomic
Write bytes to out atomically (write to a sibling tmp file, fsync, then rename over the destination).

Type Aliases§

DetectFn
Detection function: given the first ~512 bytes and the original path, decide whether this handler claims the file.
OpenBytesFn
Open from an in-memory buffer. hint_path lets the implementation preserve filename context (used for atomic-write naming and for extension-based detection of inner members).
OpenPathFn
Open from a filesystem path.
Result