Skip to main content

Crate threatflux_binary_analysis

Crate threatflux_binary_analysis 

Source
Expand description

Structural binary parsing and opt-in static-analysis primitives.

BinaryFile detects and parses enabled ELF, PE, Mach-O, Java, and WebAssembly formats into a shared representation. BinaryAnalyzer adds feature-gated disassembly, control-flow, entropy, and symbol-demangling passes when explicitly enabled through AnalysisConfig. Unrecognized, non-empty input is represented as BinaryFormat::Raw.

Results are best-effort structural facts and heuristics. They are not a malware verdict, an execution sandbox, or proof that an input is safe.

§Quick start

use threatflux_binary_analysis::{BinaryAnalyzer, BinaryFormat, Result};

fn inspect(bytes: &[u8]) -> Result<BinaryFormat> {
    let result = BinaryAnalyzer::new().analyze(bytes)?;
    Ok(result.format)
}

assert_eq!(inspect(b"unrecognized bytes")?, BinaryFormat::Raw);

§Untrusted input

The analyzer rejects input larger than AnalysisConfig::max_analysis_size, which defaults to 100 MiB. Callers must still bound reads before allocating the input and should isolate hostile-file analysis with operating-system CPU, memory, privilege, and wall-time limits.

Re-exports§

pub use disasm::DisassemblyEngine;
pub use error::BinaryError;
pub use error::Result;
pub use types::AnalysisResult;
pub use types::Architecture;
pub use types::BasicBlock;
pub use types::BinaryFormat;
pub use types::BinaryFormatParser;
pub use types::BinaryFormatTrait;
pub use types::BinaryMetadata;
pub use types::CallGraph;
pub use types::CallGraphConfig;
pub use types::CallGraphEdge;
pub use types::CallGraphNode;
pub use types::CallGraphStatistics;
pub use types::ComplexityMetrics;
pub use types::ControlFlowGraph;
pub use types::EnhancedControlFlowAnalysis;
pub use types::EntropyAnalysis;
pub use types::Export;
pub use types::Function;
pub use types::HalsteadMetrics;
pub use types::Import;
pub use types::Instruction;
pub use types::Loop;
pub use types::LoopType;
pub use types::NodeType;
pub use types::Section;
pub use types::SecurityIndicators;
pub use types::Symbol;

Modules§

analysis
Analysis modules for binary analysis
disasm
Disassembly module supporting multiple disassembly engines
error
Error types for binary analysis operations
formats
Binary format parsers and detection
types
Core types and data structures for binary analysis
utils
Utility functions for binary analysis

Structs§

AnalysisConfig
Configuration for binary analysis
BinaryAnalyzer
Main entry point for binary analysis
BinaryFile
Parsed binary file representation