INNER CODE UNIT · Python
auto_triage
2akouwu/reverify · reverify/cli.py:92
def auto_triage(data: bytes, filename: str = "") -> Dict[str, Any]:
"""Auto-detect binary format and extract top-level metadata."""
report: Dict[str, Any] = {"filename": filename, "size": len(data), "magic": data[:4].hex()}
info = parse_binary(data)
if info.format in ("PE", "ELF", "MachO"):
labels = {"PE": "Windows PE Binary (EXE/DLL/SYS)", "ELF": "Linux ELF Binary", "MachO": "Mach-O Binary"}
report["type"] = labels[info.format]
report["binary"] = info.summary()
report["sections"] = [s.name for s in info.sections]
report["imports"] = info.imports
report["exports"] = info.exports[:25]
if info.format == "PE":
report["pe_summary"] = info.summary() # backward-compatible key
if info.error:
report["parse_error"] = info.error
elif data.startswith(b"PK\x03\x04"):
report["type"] = "ZIP Archive / Package"
else: