# thorkill/eresi architecture

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

- Interactive diagram: https://gitdiagram.com/thorkill/eresi
- Repository: https://github.com/thorkill/eresi

## Overview

ERESI is a suite of ELF reverse-engineering tools, centered on ELFsh, with related debuggers, tracing and kernel utilities, and analysis libraries. The main workflow is to invoke ELFsh interactively, from a script, or on the command line; its runtime parses commands and operates on ELF objects for inspection, modification, injection, and saving. The README documents additional debugging, tracing, disassembly, control-flow, and network capabilities. The supplied excerpts show entry-point setup and selected library dependencies, but not most command implementations, so undocumented internal call paths are omitted.

Main entry points: [`librevm/lang/parser.c`](https://github.com/thorkill/eresi/blob/master/librevm/lang/parser.c) (Command runtime), [`elfsh/main.c`](https://github.com/thorkill/eresi/blob/master/elfsh/main.c) (ELFsh shell), [`libelfsh/include/libelfsh.h`](https://github.com/thorkill/eresi/blob/master/libelfsh/include/libelfsh.h) (ELF manipulation), [`e2dbg/main.c`](https://github.com/thorkill/eresi/blob/master/e2dbg/main.c) (Embedded debugger)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shells["User tools"]
  node_elfsh["ELFsh shell<br/>[main.c]"]
  node_e2dbg["Embedded debugger<br/>[main.c]"]
  node_etrace["Function tracer<br/>[main.c]"]
  node_evarista["Static analyzer<br/>[main.c]"]
  node_kernsh["Kernel shell<br/>[main.c]"]
  node_kedbg["Kernel debugger<br/>[main.c]"]
end

subgraph group_runtime["Runtime and commands"]
  node_revm["Command runtime<br/>[parser.c]"]
  node_cmds["ELF commands<br/>[init.c]"]
end

subgraph group_binary["Binary analysis"]
  node_elfops["ELF object operations<br/>[data.c]"]
  node_elflib["ELF manipulation<br/>[libelfsh.h]"]
  node_asm["Disassembly<br/>[libasm.h]"]
  node_flow["Control-flow analysis<br/>[graph.c]"]
  node_debugfmt["Debug formats<br/>[stabs.c]"]
  node_inject["ELF injection modules<br/>[modremap.c]"]
end

subgraph group_debug["Debug and trace"]
  node_e2dbglib["Debugger support<br/>[dbghooks.c]"]
  node_gdbwrap["GDB protocol wrapper<br/>[client.c]"]
  node_kernlib["Kernel access<br/>[kvirtm.c]"]
end

subgraph group_support["Supporting libraries"]
  node_dump["Distributed dump<br/>[dump.c]"]
  node_aspect["Shared data structures<br/>[libaspect.h]"]
  node_network["Network commands<br/>[network.c]"]
end

node_user(("Engineer or script"))

node_user -->|"invokes"| node_elfsh
node_elfsh -->|"starts runtime"| node_revm
node_revm -.->|"dispatches commands"| node_cmds
node_cmds -.->|"operates on ELF"| node_elfops
node_elfops -.->|"uses ELF API"| node_elflib
node_elfsh -->|"loads modules"| node_inject
node_elflib -->|"supports disassembly"| node_asm
node_elfsh -->|"offers graph analysis"| node_flow
node_elflib -->|"provides debug data"| node_debugfmt
node_user -->|"starts debugging"| node_e2dbg
node_e2dbg -.->|"uses debugger hooks"| node_e2dbglib
node_e2dbg -->|"uses runtime"| node_revm
node_user -->|"starts tracing"| node_etrace
node_etrace -->|"runs commands"| node_revm
node_user -.->|"starts analysis"| node_evarista
node_evarista -->|"uses runtime"| node_revm
node_user -.->|"starts kernel shell"| node_kernsh
node_kernsh -->|"runs commands"| node_revm
node_kernsh -->|"uses kernel access"| node_kernlib
node_user -.->|"starts kernel debug"| node_kedbg
node_kedbg -->|"controls target"| node_gdbwrap
node_kedbg -->|"uses debugger support"| node_e2dbglib
node_revm -->|"includes ELF API"| node_elflib
node_revm -->|"includes format API"| node_debugfmt
node_revm -->|"includes disassembler"| node_asm
node_revm -->|"uses shared structures"| node_aspect
node_revm -->|"provides network commands"| node_network
node_network -.->|"uses dump protocol"| node_dump

click node_elfsh "https://github.com/thorkill/eresi/blob/master/elfsh/main.c"
click node_e2dbg "https://github.com/thorkill/eresi/blob/master/e2dbg/main.c"
click node_etrace "https://github.com/thorkill/eresi/blob/master/etrace/main.c"
click node_evarista "https://github.com/thorkill/eresi/blob/master/evarista/main.c"
click node_kernsh "https://github.com/thorkill/eresi/blob/master/kernsh/main.c"
click node_kedbg "https://github.com/thorkill/eresi/blob/master/kedbg/main.c"
click node_revm "https://github.com/thorkill/eresi/blob/master/librevm/lang/parser.c"
click node_cmds "https://github.com/thorkill/eresi/blob/master/libstderesi/cmd/init.c"
click node_elfops "https://github.com/thorkill/eresi/blob/master/libstderesi/elf/data.c"
click node_elflib "https://github.com/thorkill/eresi/blob/master/libelfsh/include/libelfsh.h"
click node_asm "https://github.com/thorkill/eresi/blob/master/libasm/include/libasm.h"
click node_flow "https://github.com/thorkill/eresi/blob/master/libstderesi/analysis/graph.c"
click node_debugfmt "https://github.com/thorkill/eresi/blob/master/libedfmt/stabs.c"
click node_inject "https://github.com/thorkill/eresi/blob/master/modules/modremap.c"
click node_e2dbglib "https://github.com/thorkill/eresi/blob/master/libe2dbg/common/dbghooks.c"
click node_gdbwrap "https://github.com/thorkill/eresi/blob/master/libgdbwrap/client.c"
click node_kernlib "https://github.com/thorkill/eresi/blob/master/libkernsh/user/kvirtm.c"
click node_dump "https://github.com/thorkill/eresi/blob/master/libdump/dump.c"
click node_aspect "https://github.com/thorkill/eresi/blob/master/libaspect/include/libaspect.h"
click node_network "https://github.com/thorkill/eresi/blob/master/librevm/io/network.c"

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_elfsh,node_e2dbg,node_etrace,node_evarista,node_kernsh,node_kedbg toneBlue
class node_revm,node_cmds toneAmber
class node_elfops,node_elflib,node_asm,node_flow,node_debugfmt,node_inject toneMint
class node_e2dbglib,node_gdbwrap,node_kernlib toneRose
class node_dump,node_aspect,node_network,node_user toneIndigo
```

## Components

### User tools

- [ELFsh shell](https://github.com/thorkill/eresi/blob/master/elfsh/main.c): `elfsh/main.c`
- [Embedded debugger](https://github.com/thorkill/eresi/blob/master/e2dbg/main.c): `e2dbg/main.c`
- [Function tracer](https://github.com/thorkill/eresi/blob/master/etrace/main.c): `etrace/main.c`
- [Static analyzer](https://github.com/thorkill/eresi/blob/master/evarista/main.c): `evarista/main.c`
- [Kernel shell](https://github.com/thorkill/eresi/blob/master/kernsh/main.c): `kernsh/main.c`
- [Kernel debugger](https://github.com/thorkill/eresi/blob/master/kedbg/main.c): `kedbg/main.c`

### Runtime and commands

- [Command runtime](https://github.com/thorkill/eresi/blob/master/librevm/lang/parser.c): `librevm/lang/parser.c`
- [ELF commands](https://github.com/thorkill/eresi/blob/master/libstderesi/cmd/init.c): `libstderesi/cmd/init.c`

### Binary analysis

- [ELF object operations](https://github.com/thorkill/eresi/blob/master/libstderesi/elf/data.c): `libstderesi/elf/data.c`
- [ELF manipulation](https://github.com/thorkill/eresi/blob/master/libelfsh/include/libelfsh.h): `libelfsh/include/libelfsh.h`
- [Disassembly](https://github.com/thorkill/eresi/blob/master/libasm/include/libasm.h): `libasm/include/libasm.h`
- [Control-flow analysis](https://github.com/thorkill/eresi/blob/master/libstderesi/analysis/graph.c): `libstderesi/analysis/graph.c`
- [Debug formats](https://github.com/thorkill/eresi/blob/master/libedfmt/stabs.c): `libedfmt/stabs.c`
- [ELF injection modules](https://github.com/thorkill/eresi/blob/master/modules/modremap.c): `modules/modremap.c`

### Debug and trace

- [Debugger support](https://github.com/thorkill/eresi/blob/master/libe2dbg/common/dbghooks.c): `libe2dbg/common/dbghooks.c`
- [GDB protocol wrapper](https://github.com/thorkill/eresi/blob/master/libgdbwrap/client.c): `libgdbwrap/client.c`
- [Kernel access](https://github.com/thorkill/eresi/blob/master/libkernsh/user/kvirtm.c): `libkernsh/user/kvirtm.c`

### Supporting libraries

- [Distributed dump](https://github.com/thorkill/eresi/blob/master/libdump/dump.c): `libdump/dump.c`
- [Shared data structures](https://github.com/thorkill/eresi/blob/master/libaspect/include/libaspect.h): `libaspect/include/libaspect.h`
- [Network commands](https://github.com/thorkill/eresi/blob/master/librevm/io/network.c): `librevm/io/network.c`

### Other components

- **Engineer or script**

## Connections

- Engineer or script → ELFsh shell: invokes
- ELFsh shell → Command runtime: starts runtime (evidence: `elfsh/main.c`)
- Command runtime → ELF commands: dispatches commands
- ELF commands → ELF object operations: operates on ELF
- ELF object operations → ELF manipulation: uses ELF API
- ELFsh shell → ELF injection modules: loads modules
- ELF manipulation → Disassembly: supports disassembly
- ELFsh shell → Control-flow analysis: offers graph analysis
- ELF manipulation → Debug formats: provides debug data
- Engineer or script → Embedded debugger: starts debugging
- Embedded debugger → Debugger support: uses debugger hooks
- Embedded debugger → Command runtime: uses runtime
- Engineer or script → Function tracer: starts tracing
- Function tracer → Command runtime: runs commands (evidence: `etrace/main.c`)
- Engineer or script → Static analyzer: starts analysis
- Static analyzer → Command runtime: uses runtime
- Engineer or script → Kernel shell: starts kernel shell
- Kernel shell → Command runtime: runs commands (evidence: `kernsh/main.c`)
- Kernel shell → Kernel access: uses kernel access (evidence: `kernsh/main.c`)
- Engineer or script → Kernel debugger: starts kernel debug
- Kernel debugger → GDB protocol wrapper: controls target
- Kernel debugger → Debugger support: uses debugger support
- Command runtime → ELF manipulation: includes ELF API
- Command runtime → Debug formats: includes format API
- Command runtime → Disassembly: includes disassembler
- Command runtime → Shared data structures: uses shared structures
- Command runtime → Network commands: provides network commands
- Network commands → Distributed dump: uses dump protocol
