Skip to content

Architecture

flowchart TD
  CLI[Typer CLI (python/pe_packer/cli.py)] --> Core[Python API (pe_packer.core)]
  Core -->|PyO3 bindings| Native[pe_packer._native (Rust)]
  Native --> Packer[packer/ (Rust packing logic)]
  Native --> PE[pe/ (PE parsing/building)]
  Core --> Utils[python/pe_packer/utils]
  Core --> Training[python/pe_packer/training]
  • CLI: Entrypoint (python/pe_packer/cli.py) providing pack, generate-training-data, analyze-dataset, validate.
  • Python API: High-level orchestrators that validate inputs and call into Rust.
  • Rust core: Packing logic and PE structure handling, exposed via PyO3 as _native.
  • Training: Dataset generation and metadata management for ML experiments.
  • Utils: Validation, entropy calculation, helpers.

Data Flow

  1. CLI validates inputs, constructs PackerConfig.
  2. Safety gate check: env+flag required for packing; otherwise dry-run (entropy, size).
  3. Python calls Rust bindings; Rust performs packing and returns results.
  4. Training module iterates input directory, aggregates metadata, writes JSON.