# vbrochard/lyrem architecture

> Architecture diagram of the GitHub repository vbrochard/lyrem, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vbrochard/lyrem
- Repository: https://github.com/vbrochard/lyrem

## Overview

Lyrem is a command-line Linux ELF security analyzer. A user supplies a binary and output options; the CLI parses the ELF into metadata, derives hardening properties, and displays a default security summary, a full report, or JSON. The parser handles ELF headers, program headers, and dynamic entries; the security layer interprets metadata for NX, PIE, RELRO, interpreter, dynamic-segment, and RWX results. The graph follows calls visible in the CLI source and parser relationships supported by the excerpts and source index; unsampled output details are represented only where documented.

Main entry points: [`src/main.rs`](https://github.com/vbrochard/lyrem/blob/main/src/main.rs) (CLI workflow), [`src/elf/parser.rs`](https://github.com/vbrochard/lyrem/blob/main/src/elf/parser.rs) (ELF parser), [`src/elf/metadata.rs`](https://github.com/vbrochard/lyrem/blob/main/src/elf/metadata.rs) (ELF metadata), [`src/output/cli.rs`](https://github.com/vbrochard/lyrem/blob/main/src/output/cli.rs) (Human reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Input and parsing"]
  node_cli["CLI workflow<br/>[main.rs]"]
  node_parser["ELF parser<br/>[parser.rs]"]
end

subgraph group_elfdata["ELF representation"]
  node_metadata["ELF metadata<br/>[metadata.rs]"]
  node_program_headers["Program headers<br/>[program.rs]"]
  node_dynamic_entries["Dynamic entries<br/>[dynamic.rs]"]
end

subgraph group_analysis["Security analysis"]
  node_security["Security analysis<br/>[security.rs]"]
end

subgraph group_reports["Output"]
  node_renderer["Human reports<br/>[cli.rs]"]
  node_json["JSON report<br/>[main.rs]"]
end

node_user(("User"))
node_binary["ELF binary"]
node_terminal(("Terminal output"))

node_user -->|"supplies options"| node_cli
node_user -->|"selects file"| node_binary
node_cli -->|"calls parse"| node_parser
node_parser -->|"reads"| node_binary
node_parser -->|"builds"| node_metadata
node_parser -->|"parses"| node_program_headers
node_parser -->|"parses"| node_dynamic_entries
node_metadata -->|"contains"| node_program_headers
node_metadata -->|"contains"| node_dynamic_entries
node_cli -->|"calls analyze"| node_security
node_cli -->|"calls report"| node_renderer
node_cli -->|"serializes"| node_json
node_renderer -->|"prints"| node_terminal
node_json -->|"prints JSON"| node_terminal

click node_cli "https://github.com/vbrochard/lyrem/blob/main/src/main.rs"
click node_parser "https://github.com/vbrochard/lyrem/blob/main/src/elf/parser.rs"
click node_metadata "https://github.com/vbrochard/lyrem/blob/main/src/elf/metadata.rs"
click node_program_headers "https://github.com/vbrochard/lyrem/blob/main/src/elf/program.rs"
click node_dynamic_entries "https://github.com/vbrochard/lyrem/blob/main/src/elf/dynamic.rs"
click node_security "https://github.com/vbrochard/lyrem/blob/main/src/elf/security.rs"
click node_renderer "https://github.com/vbrochard/lyrem/blob/main/src/output/cli.rs"
click node_json "https://github.com/vbrochard/lyrem/blob/main/src/main.rs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_cli,node_parser,node_user toneBlue
class node_metadata,node_program_headers,node_dynamic_entries toneAmber
class node_security toneMint
class node_renderer,node_json toneRose
class node_binary,node_terminal toneIndigo
```

## Components

### Input and parsing

- [CLI workflow](https://github.com/vbrochard/lyrem/blob/main/src/main.rs): `src/main.rs`
- [ELF parser](https://github.com/vbrochard/lyrem/blob/main/src/elf/parser.rs): `src/elf/parser.rs`

### ELF representation

- [ELF metadata](https://github.com/vbrochard/lyrem/blob/main/src/elf/metadata.rs): `src/elf/metadata.rs`
- [Program headers](https://github.com/vbrochard/lyrem/blob/main/src/elf/program.rs): `src/elf/program.rs`
- [Dynamic entries](https://github.com/vbrochard/lyrem/blob/main/src/elf/dynamic.rs): `src/elf/dynamic.rs`

### Security analysis

- [Security analysis](https://github.com/vbrochard/lyrem/blob/main/src/elf/security.rs): `src/elf/security.rs`

### Output

- [Human reports](https://github.com/vbrochard/lyrem/blob/main/src/output/cli.rs): `src/output/cli.rs`
- [JSON report](https://github.com/vbrochard/lyrem/blob/main/src/main.rs): `src/main.rs`

### Other components

- **User**
- **ELF binary**
- **Terminal output**

## Connections

- User → CLI workflow: supplies options (evidence: `src/main.rs`)
- User → ELF binary: selects file (evidence: `README.md`)
- CLI workflow → ELF parser: calls parse (evidence: `src/main.rs`)
- ELF parser → ELF binary: reads (evidence: `src/elf/parser.rs`)
- ELF parser → ELF metadata: builds (evidence: `src/elf/parser.rs`)
- ELF parser → Program headers: parses (evidence: `src/elf/parser.rs`)
- ELF parser → Dynamic entries: parses (evidence: `src/elf/parser.rs`)
- ELF metadata → Program headers: contains (evidence: `src/elf/metadata.rs`)
- ELF metadata → Dynamic entries: contains (evidence: `src/elf/metadata.rs`)
- CLI workflow → Security analysis: calls analyze (evidence: `src/main.rs`)
- CLI workflow → Human reports: calls report (evidence: `src/main.rs`)
- CLI workflow → JSON report: serializes (evidence: `src/main.rs`)
- Human reports → Terminal output: prints (evidence: `src/output/cli.rs`)
- JSON report → Terminal output: prints JSON (evidence: `src/main.rs`)
