Implementation:0sec labs 0 triage
| Knowledge Sources | |
|---|---|
| Domains | Binary_Analysis, Security |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete tool for pure-Python binary format, architecture, and mitigation detection provided by the 0verse ingest module.
Description
The triage function reads raw binary bytes and classifies the file by format (ELF, PE, Mach-O, fat Mach-O), architecture (x86-64, ARM64, MIPS, etc.), bit width, endianness, and kind (executable, shared library, kernel module). It also detects security mitigations (NX, PIE, RELRO, stack canary, CFG) by parsing program headers. The entire operation is pure Python with no external decompiler dependency, making it the fast first stage of the 0verse pipeline.
Usage
Import this function when you need to classify a binary file before decompilation or analysis. It is the entry point for both single-binary scans (0verse scan) and fleet ingestion (ingest_fleet).
Code Reference
Source Location
- Repository: 0security
- File: 0verse/src/zeroverse/ingest.py
Signature
def triage(path: str | Path) -> Triage:
"""Read raw bytes, detect format/arch/mitigations, return a Triage dataclass."""
@dataclass
class Triage:
path: str
fmt: str = "unknown" # ELF | PE | Mach-O | unknown
arch: str = "unknown" # x86-64, aarch64, mips, etc.
bits: int = 0 # 32 | 64
endian: str = "unknown" # little | big
kind: str = "" # exec | shared | core | relocatable
stripped: bool = False
mitigations: dict = field(default_factory=dict) # nx, pie, relro, canary, cfg
notes: list[str] = field(default_factory=list)
Import
from zeroverse.ingest import triage, Triage
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| path | Path | Yes | Binary file path to triage |
Outputs
| Name | Type | Description |
|---|---|---|
| return | Triage | Dataclass with fmt, arch, bits, endian, kind, stripped, mitigations, notes |
Usage Examples
Basic Triage
from zeroverse.ingest import triage
# Classify a binary
t = triage("/usr/bin/ls")
print(f"Format: {t.fmt}, Arch: {t.arch}, Bits: {t.bits}")
print(f"Mitigations: {t.mitigations}")
# Format: ELF, Arch: x86-64, Bits: 64
# Mitigations: {'nx': True, 'pie': True, 'relro': 'full', 'canary': True}
Fleet Ingestion (internal use)
from zeroverse.ingest import triage
from pathlib import Path
# triage is called by ingest_fleet for each binary
for bin_path in Path("/firmware").iterdir():
t = triage(bin_path)
if t.fmt in ("ELF", "PE", "Mach-O"):
print(f"{bin_path.name}: {t.fmt} {t.arch} — analyzable")
else:
print(f"{bin_path.name}: unknown format — skipped")