How zarazaex69/rizin works
1. This repository is the Rizin reverse-engineering platform: a C-based framework plus a set of command-line tools. The architecture is centered on a shared library stack under librz/, with thin executables in binrz/ and librz/main/ wrapping the same core capabilities.
2. The top-level execution path is:
user command line → main/tool entrypoint → librz/core → specialized subsystems such as binary loading, analysis, disassembly, debugging, search, or crypto.
The interactive rizin shell and the standalone tools (rz-bin, rz-asm, rz-diff, rz-find, rz-hash, rz-run, rz-sign, rz-ar, rz-ax) are frontends over this same backend.
3. librz/core is the orchestration layer. It owns the command interpreter, visual/TUI modes, project handling, command descriptions, and the glue that coordinates I/O, binary inspection, analysis, printing, flags, types, searches, debugging, and scripting. If you are drawing boundaries, this is the main “application brain” that connects all other modules.
4. librz/io is the abstraction layer for reading and writing data sources. It supports files, memory, pipes, sockets, HTTP, process/debug targets, archives, and special transport backends. This is the first major boundary after the core: everything else generally consumes bytes through IO descriptors, maps, and caches rather than touching the filesystem directly.
5. librz/bin handles binary-format parsing and object metadata. It contains format-specific loaders for ELF, PE/PE+, Mach-O, Java class files, PYC, WASM, DEX, minidumps, firmware/container formats, and many others. It also exposes symbols, sections, relocations, imports/exports, debug info, demangling, and file-type identification via the magic subsystem.
6. librz/arch is the analysis/disassembly umbrella. It includes architecture-independent analysis logic plus many ISA-specific implementations under isa/, isa_gnu/, p/, asm/, analysis/, and parse/. This layer converts bytes from io/bin into instructions, control-flow, comments, xrefs, function metadata, and platform-specific semantics.
7. The librz/il and ESIL-related code provide intermediate representations and symbolic evaluation. Rizin uses these layers to model instruction effects, validate/execute semantics, export graphs/strings/JSON, and support analysis beyond raw disassembly. This is a key bridge between architecture-specific decoding and higher-level reasoning in core.
8. librz/debug implements native and remote debugging backends. It includes platform-specific support for Linux, BSDs, macOS/XNU, Windows, QNX, GDB/WinDbg/KD-style protocols, breakpoints, memory maps, registers, traces, and coredumps. In architecture terms, debugging is another data source feeding the same core commands and visualizations, but through live process/control-plane APIs instead of static files.
9. Higher-level analysis services live in focused libraries: librz/search for byte/string/regex/hash/entropy/magic/crypto searches, librz/flag for named addresses and zones, librz/type for type and prototype modeling, librz/reg for register profiles and arenas, librz/sign for FLIRT signatures, librz/hash and librz/crypto for hashing/encryption primitives, and librz/diff for byte/line/unified comparisons. These are mostly leaf services consumed by core and arch/bin workflows.
10. librz/util is the shared foundation. It provides containers, strings, buffers, graphs, JSON/YAML-style structured data, threading, filesystem/process helpers, encodings, numeric utilities, and a bundled sdb key-value database implementation. Many other subsystems depend on util; it is the lowest-level internal dependency layer.
11. Plugins and generated tables are a major structural feature. Architecture-, format-, debug-, IO-, and crypto-capabilities are often organized as plugin-like modules under p/, format/, native/, p_gnu/, etc., while large .sdb.txt tables encode opcodes, syscalls, calling conventions, register profiles, and platform/type metadata. This makes the system data-driven and extensible without hard-coding every target in core logic.
12. External dependencies are mostly vendored or wrapped through Meson subprojects: capstone, zydis, tree-sitter, libzip, zlib/zstd/xz/lz4, pcre2, nettle, blake2/blake3, xxhash, yxml, softfloat, and platform/debug wrappers. The build is entirely Meson-based, with CI, cross-build, packaging, and test scaffolding spread across test/, .github/, dist/, and subprojects/. For an architecture diagram, treat build/test/distribution as a separate support plane around the runtime libraries and tools.
Main entry points: core Core · util Util · bin Binary · arch Arch
Components 20
Frontends
Interactive shell and standalone CLI entrypoints.
- rizin · Interactive shell and primary user-facing executable.
binrz/rizin/rizin.c - Tool mains · Thin entrypoints for the standalone utilities.
librz/main
Runtime libs
Core execution, data access, decoding, analysis, and live debug services.
- Core · Command interpreter, UI modes, project handling, and glue for all major workflows.
librz/core - IO · Unified read/write abstraction over files, memory, pipes, sockets, processes, and remote transports.
librz/io - Binary · Binary-format parsing, object metadata, sections, symbols, relocations, and file identification.
librz/bin - Arch · Architecture-specific decoding, analysis, assembly, parsing, and semantics.
librz/arch - IL / ESIL · Intermediate representations, symbolic evaluation, validation, export, and VM-style execution.
librz/il - Debug · Native and remote debugging, registers, breakpoints, traces, and coredumps.
librz/debug - Console · Terminal rendering, input, paging, prompts, and visual display support.
librz/cons
Services
Higher-level reusable analysis and utility libraries.
- Search · Byte, string, regex, entropy, hash, magic, and crypto-oriented searching.
librz/search - Flags · Named addresses, tags, zones, and related symbol organization.
librz/flag - Types · Type, prototype, and ABI modeling plus parsers and serialization.
librz/type - Regs · Register profiles, arenas, and register value handling.
librz/reg - Signatures · FLIRT-style signature creation, matching, and signature database handling.
librz/sign - Hash · Hashing, entropy, fuzzy hash, and related digest algorithms.
librz/hash - Crypto · Symmetric and encoding-style cryptographic primitives used by tools and searches.
librz/crypto - Diff · Byte, line, and unified diff computation.
librz/diff - Lang · Language and piping support for command execution and embedding.
librz/lang
Connections 33
- rizin → Core: starts · Interactive shell enters the shared core orchestration layer.
- Tool mains → Core: wraps · Standalone tools invoke the same shared core/backend APIs.
- Core → IO: uses · Core reads and writes through the IO abstraction layer.
- Core → Binary: loads · Core opens binaries and consumes object metadata.
- Core → Arch: analyzes · Core dispatches disassembly and analysis workflows.
- Core → IL / ESIL: evaluates · Core uses IL/ESIL for semantics and symbolic reasoning.
- Core → Debug: drives · Core coordinates live debugging sessions and control flow.
- Core → Search: searches · Core exposes search commands over byte, string, and pattern services.
- Core → Flags: maps · Core manages address labels, zones, and annotations.
- Core → Types: types · Core surfaces type modeling and prototype information.
- Core → Regs: reads regs · Core and debug workflows use register profiles and state.
- Core → Signatures: matches · Core invokes signature matching for binary identification.
- Core → Hash: hashes · Core uses digest and entropy services.
- Core → Crypto: cryptos · Core exposes crypto-related commands and searches.
- Core → Diff: compares · Core routes diff-oriented workflows to the diff library.
- Core → Lang: scripts · Core delegates command execution and language integration.
- Core → Console: renders · Core uses console/TUI rendering for interactive modes.
- Binary → IO: consumes · Binary loaders inspect bytes through IO descriptors and maps.
- Binary → Util: builds on · Binary parsing depends on shared containers, buffers, and structured data.
- Arch → Util: builds on · Decoding and analysis share low-level utility types and helpers.
- IL / ESIL → Arch: bridges · IL is fed by architecture-specific decoding and semantics.
- Debug → IO: backed by · Debugging reuses IO transports for process and remote access.
- Search → Util: builds on · Search implementations use shared utility and string/regex primitives.
- Types → Util: builds on · Type modeling and parsing depend on shared utility code.
- Regs → Util: builds on · Register state and profiles rely on shared utility structures.
- Signatures → Util: builds on · Signature storage and matching use shared helpers and sdb data.
- Hash → Util: builds on · Hash algorithms depend on common utility primitives.
- Crypto → Util: builds on · Crypto code uses shared buffers, encodings, and helpers.
- Diff → Util: builds on · Diff algorithms use shared comparison and container support.
- Lang → Util: builds on · Scripting and piping use subprocess, strings, and I/O helpers.
- Console → Util: builds on · Console rendering uses shared drawing, text, and output helpers.
- Build → Tool mains: builds · Meson and packaging assemble the CLI executables and runtime libraries.
- Build → Core: tests · Build/test scaffolding validates core command behavior and integration.