# extremecoders-re/nuitka-extractor architecture

> Architecture diagram of the GitHub repository extremecoders-re/nuitka-extractor, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/extremecoders-re/nuitka-extractor
- Repository: https://github.com/extremecoders-re/nuitka-extractor

## Overview

1. **Repository purpose**
   - This is a small Go command-line tool named **`nuitka-extractor`**.
   - Its job is to unpack **Nuitka onefile executables** and recover the embedded runtime assets inside them.

2. **High-level architecture**
   - The repo is essentially a **single executable application**, not a library or multi-service system.
   - There are only two Go source files:
     - `main.go` for program entry / orchestration
     - `peutils.go` for platform-specific executable parsing helpers, especially PE-related logic

3. **Input boundary**
   - The only external input is a **path to a compiled Nuitka executable** passed on the command line.
   - Supported input formats are:
     - **Windows PE binaries**
     - **Linux ELF binaries**
   - The tool is explicitly scoped to **onefile/single-file Nuitka executables**.

4. **Core data flow**
   - The CLI reads the executable file.
   - It locates Nuitka’s embedded payload area inside the binary.
   - It extracts embedded **DLLs, shared libraries, and other binary assets**.
   - The extracted content is then written out to the local filesystem.
   - The tool does **not** recover Python bytecode (`pyc`), because Nuitka compiles Python to native code.

5. **Format-handling boundary**
   - The main architectural split is by executable format:
     - **PE path** for Windows binaries
     - **ELF path** for Linux binaries
   - `peutils.go` likely contains the low-level helpers needed to navigate PE structures and locate embedded data.
   - The README indicates PE extraction has an important limitation: **signed PE executables are not supported unless the certificate is stripped first**.

6. **Output behavior**
   - The tool’s output is a set of extracted files placed locally, rather than a structured API response or network transfer.
   - In architecture-diagram terms, this is a **file-to-file transformation pipeline**:
     - input executable → extractor → extracted artifacts on disk

7. **Runtime and implementation stack**
   - Implemented in **Go**, so the resulting artifact is a single native binary.
   - This keeps deployment simple: no runtime VM, no package manager, and no separate backend service.

8. **Operational model**
   - Usage is intentionally minimal: run the binary and pass the target executable path.
   - The repository does not suggest any daemon, server, or long-running process model.
   - The tool is therefore best represented as a **local offline utility**.

9. **Release and distribution**
   - The README points to **precompiled binaries in GitHub Releases**.
   - That means GitHub serves as the distribution channel, while the actual extractor runs entirely on the user’s machine.

10. **Build pipeline**
   - The `.github/workflows/build.yaml` workflow indicates automated CI builds.
   - This likely produces platform-specific release binaries from the Go source, supporting the repo’s “download from releases” distribution model.

11. **Important architectural constraint**
   - The extractor is not a general Nuitka reverse-engineering framework.
   - It is constrained to embedded native assets in onefile executables, with no claim of extracting source-level Python artifacts.

12. **Diagram-friendly summary**
   - A clean architecture diagram would show:
     - **User / CLI invocation**
     - **Input Nuitka onefile executable**
     - **Go extractor core**
     - **PE/ELF parsing helpers**
     - **Extracted binaries/assets written to disk**
     - Optional side box for **GitHub Actions → GitHub Releases** as the build/distribution path

Main entry points: [`main.go`](https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go) (CLI entry), [`peutils.go`](https://github.com/extremecoders-re/nuitka-extractor/blob/main/peutils.go) (PE path), [`.github/workflows/build.yaml`](https://github.com/extremecoders-re/nuitka-extractor/blob/main/.github/workflows/build.yaml) (Build workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Local utility"]
  node_user(("User<br/>operator"))
  node_cli["CLI entry<br/>go main<br/>[main.go]"]
  node_input_bin["Nuitka exe<br/>onefile input"]
  node_format_detect{{"Format detect<br/>dispatch<br/>[main.go]"}}
  node_pe_path["PE path<br/>windows parsing<br/>[peutils.go]"]
  node_elf_path["ELF path<br/>linux parsing<br/>[main.go]"]
  node_payload_locate{{"Payload locate<br/>scanner"}}
  node_extract_core["Extractor core<br/>unpacker<br/>[main.go]"]
  node_output_fs[("Output files<br/>filesystem output")]
  node_signed_limit{{"Signed PE limit<br/>constraint"}}
end

subgraph group_distribution["Build and release"]
  node_workflow["Build workflow<br/>github actions<br/>[build.yaml]"]
  node_releases[("GitHub Releases<br/>distribution")]
end

node_user -->|"invokes"| node_cli
node_cli -->|"reads path"| node_input_bin
node_cli -->|"orchestrates"| node_format_detect
node_format_detect -->|"PE"| node_pe_path
node_format_detect -->|"ELF"| node_elf_path
node_pe_path -->|"locates"| node_payload_locate
node_elf_path -->|"locates"| node_payload_locate
node_payload_locate -->|"feeds"| node_extract_core
node_extract_core -->|"writes"| node_output_fs
node_pe_path -.->|"limited by"| node_signed_limit
node_workflow -->|"publishes"| node_releases
node_releases -.->|"downloaded by"| node_user

click node_cli "https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go"
click node_format_detect "https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go"
click node_pe_path "https://github.com/extremecoders-re/nuitka-extractor/blob/main/peutils.go"
click node_elf_path "https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go"
click node_extract_core "https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go"
click node_workflow "https://github.com/extremecoders-re/nuitka-extractor/blob/main/.github/workflows/build.yaml"

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_user,node_cli,node_input_bin,node_format_detect,node_pe_path,node_elf_path,node_payload_locate,node_extract_core,node_output_fs,node_signed_limit toneBlue
class node_workflow,node_releases toneAmber
```

## Components

### Local utility

The offline Go command-line path that reads a Nuitka onefile executable and writes extracted assets to disk.

- **User**: operator · Runs the extractor with a target executable path.
- [CLI entry](https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go): go main · Program entrypoint and orchestration in main.go. · `main.go`
- **Nuitka exe**: onefile input · Compiled Nuitka onefile executable supplied on the command line.
- [Format detect](https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go): dispatch · Selects the PE or ELF handling path based on the executable format. · `main.go`
- [PE path](https://github.com/extremecoders-re/nuitka-extractor/blob/main/peutils.go): windows parsing · Windows-specific executable parsing and payload location logic. · `peutils.go`
- [ELF path](https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go): linux parsing · Linux executable parsing and payload location logic. · `main.go`
- **Payload locate**: scanner · Finds Nuitka's embedded runtime assets inside the executable.
- [Extractor core](https://github.com/extremecoders-re/nuitka-extractor/blob/main/main.go): unpacker · Coordinates unpacking of embedded DLLs, shared libraries, and other assets. · `main.go`
- **Output files**: filesystem output · Extracted artifacts written locally to disk.
- **Signed PE limit**: constraint · Signed PE executables are not supported unless the certificate is stripped first.

### Build and release

CI builds native binaries and publishes them as release artifacts.

- [Build workflow](https://github.com/extremecoders-re/nuitka-extractor/blob/main/.github/workflows/build.yaml): github actions · Automated CI build pipeline in .github/workflows/build.yaml. · `.github/workflows/build.yaml`
- **GitHub Releases**: distribution · Publishes precompiled binaries for users to download.

## Connections

- User → CLI entry: invokes · User runs the native Go tool.
- CLI entry → Nuitka exe: reads path · The CLI accepts a target executable path.
- CLI entry → Format detect: orchestrates · Entrypoint dispatches into format-specific handling.
- Format detect → PE path: PE · Windows binaries follow the PE branch.
- Format detect → ELF path: ELF · Linux binaries follow the ELF branch.
- PE path → Payload locate: locates · PE helpers navigate executable structures to find embedded data.
- ELF path → Payload locate: locates · ELF handling finds the embedded Nuitka payload area.
- Payload locate → Extractor core: feeds · Located payload content is passed into the unpacking logic.
- Extractor core → Output files: writes · Recovered DLLs, shared libraries, and assets are emitted to disk.
- PE path → Signed PE limit: limited by · PE extraction is constrained by signed executables.
- Build workflow → GitHub Releases: publishes · CI builds release binaries and uploads them to releases.
- GitHub Releases → User: downloaded by · Users obtain precompiled binaries from release artifacts.
