# screetsec/thefatrat architecture

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

- Interactive diagram: https://gitdiagram.com/screetsec/thefatrat
- Repository: https://github.com/screetsec/thefatrat

## Overview

TheFatRat is a Linux-oriented security tool whose documented workflow is to configure payloads, generate platform-specific artifacts, and optionally prepare a listener. The shown files cover a PowerShell payload generator/listener, an Android APK injection utility, a file-size utility, and bundled Clang headers. README capabilities such as MSFvenom automation, other payload formats, and autorun generation are included as documented subsystems, but their implementations are not present in the sampled tree. Edges without direct source evidence are marked unverified.

Main entry points: [`tools/apkembed.rb`](https://github.com/screetsec/thefatrat/blob/master/tools/apkembed.rb) (APK injector), [`tools/power.py`](https://github.com/screetsec/thefatrat/blob/master/tools/power.py) (PowerShell generator), [`tools/trusted_2_6.py`](https://github.com/screetsec/thefatrat/blob/master/tools/trusted_2_6.py) (Unicorn generator), [`tools/pw_exec.py`](https://github.com/screetsec/thefatrat/blob/master/tools/pw_exec.py) (PowerShell executor)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_payloads["Payload generation"]
  node_fatrat["TheFatRat CLI"]
  node_powershell["PowerShell generator<br/>[power.py]"]
  node_unicorn["Unicorn generator<br/>[trusted_2_6.py]"]
  node_pwexec["PowerShell executor<br/>[pw_exec.py]"]
  node_listeners["Listener session<br/>[power.py]"]
  node_payload_outputs["Payload artifacts"]
  node_autorun["Autorun artifacts"]
end

subgraph group_android["Android packaging"]
  node_apk_input["Original APK"]
  node_apk_inject["APK injector<br/>[apkembed.rb]"]
  node_apk_output["Rebuilt APK"]
end

subgraph group_support["Utilities and headers"]
  node_file_pumper["File pumper<br/>[pump.py]"]
  node_pumped_file["Expanded file"]
  node_clang_cuda["CUDA runtime wrapper"]
  node_cuda_vars["CUDA builtins"]
  node_clang_intrinsics["Clang intrinsic headers"]
end

subgraph group_integrations["External integrations"]
  node_msfvenom["MSFvenom / Metasploit"]
  node_apktool["apktool"]
end

node_operator(("Operator"))
node_file_operator(("File operator"))

node_operator -.->|"configures"| node_fatrat
node_fatrat -.->|"selects payload"| node_powershell
node_fatrat -.->|"selects payload"| node_unicorn
node_fatrat -.->|"selects payload"| node_pwexec
node_fatrat -.->|"automates"| node_msfvenom
node_powershell -.->|"generates"| node_payload_outputs
node_unicorn -.->|"generates"| node_payload_outputs
node_pwexec -.->|"generates"| node_payload_outputs
node_fatrat -.->|"offers listener"| node_listeners
node_operator -.->|"provides APK"| node_apk_inject
node_apk_input -->|"receives"| node_apk_inject
node_apk_inject -.->|"uses payload"| node_msfvenom
node_apk_inject -->|"rebuilds with"| node_apktool
node_apk_inject -->|"produces"| node_apk_output
node_file_operator -->|"sets target size"| node_file_pumper
node_file_pumper -->|"appends data"| node_pumped_file
node_fatrat -.->|"creates automatically"| node_autorun
node_clang_cuda -->|"includes"| node_cuda_vars

click node_powershell "https://github.com/screetsec/thefatrat/blob/master/tools/power.py"
click node_unicorn "https://github.com/screetsec/thefatrat/blob/master/tools/trusted_2_6.py"
click node_pwexec "https://github.com/screetsec/thefatrat/blob/master/tools/pw_exec.py"
click node_listeners "https://github.com/screetsec/thefatrat/blob/master/tools/power.py"
click node_apk_inject "https://github.com/screetsec/thefatrat/blob/master/tools/apkembed.rb"
click node_file_pumper "https://github.com/screetsec/thefatrat/blob/master/tools/pump.py"
click node_clang_cuda "https://github.com/screetsec/thefatrat/blob/master/tools/android-sdk/renderscript/clang-include/__clang_cuda_runtime_wrapper.h"
click node_cuda_vars "https://github.com/screetsec/thefatrat/blob/master/tools/android-sdk/renderscript/clang-include/cuda_builtin_vars.h"
click node_clang_intrinsics "https://github.com/screetsec/thefatrat/tree/master/tools/android-sdk/renderscript/clang-include"

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_fatrat,node_powershell,node_unicorn,node_pwexec,node_listeners,node_payload_outputs,node_autorun toneBlue
class node_apk_input,node_apk_inject,node_apk_output toneAmber
class node_file_pumper,node_pumped_file,node_clang_cuda,node_cuda_vars,node_clang_intrinsics toneMint
class node_msfvenom,node_apktool toneRose
class node_operator,node_file_operator toneIndigo
```

## Components

### Payload generation

- **TheFatRat CLI**
- [PowerShell generator](https://github.com/screetsec/thefatrat/blob/master/tools/power.py): `tools/power.py`
- [Unicorn generator](https://github.com/screetsec/thefatrat/blob/master/tools/trusted_2_6.py): `tools/trusted_2_6.py`
- [PowerShell executor](https://github.com/screetsec/thefatrat/blob/master/tools/pw_exec.py): `tools/pw_exec.py`
- [Listener session](https://github.com/screetsec/thefatrat/blob/master/tools/power.py): `tools/power.py`
- **Payload artifacts**
- **Autorun artifacts**

### Android packaging

- **Original APK**
- [APK injector](https://github.com/screetsec/thefatrat/blob/master/tools/apkembed.rb): `tools/apkembed.rb`
- **Rebuilt APK**

### Utilities and headers

- [File pumper](https://github.com/screetsec/thefatrat/blob/master/tools/pump.py): `tools/pump.py`
- **Expanded file**
- [CUDA runtime wrapper](https://github.com/screetsec/thefatrat/blob/master/tools/android-sdk/renderscript/clang-include/__clang_cuda_runtime_wrapper.h): `tools/android-sdk/renderscript/clang-include/__clang_cuda_runtime_wrapper.h`
- [CUDA builtins](https://github.com/screetsec/thefatrat/blob/master/tools/android-sdk/renderscript/clang-include/cuda_builtin_vars.h): `tools/android-sdk/renderscript/clang-include/cuda_builtin_vars.h`
- [Clang intrinsic headers](https://github.com/screetsec/thefatrat/tree/master/tools/android-sdk/renderscript/clang-include): `tools/android-sdk/renderscript/clang-include`

### External integrations

- **MSFvenom / Metasploit**
- **apktool**

### Other components

- **Operator**
- **File operator**

## Connections

- Operator → TheFatRat CLI: configures
- TheFatRat CLI → PowerShell generator: selects payload
- TheFatRat CLI → Unicorn generator: selects payload
- TheFatRat CLI → PowerShell executor: selects payload
- TheFatRat CLI → MSFvenom / Metasploit: automates
- PowerShell generator → Payload artifacts: generates
- Unicorn generator → Payload artifacts: generates
- PowerShell executor → Payload artifacts: generates
- TheFatRat CLI → Listener session: offers listener
- Operator → APK injector: provides APK
- Original APK → APK injector: receives (evidence: `tools/apkembed.rb`)
- APK injector → MSFvenom / Metasploit: uses payload
- APK injector → apktool: rebuilds with (evidence: `tools/apkembed.rb`)
- APK injector → Rebuilt APK: produces (evidence: `tools/apkembed.rb`)
- File operator → File pumper: sets target size (evidence: `tools/pump.py`)
- File pumper → Expanded file: appends data (evidence: `tools/pump.py`)
- TheFatRat CLI → Autorun artifacts: creates automatically
- CUDA runtime wrapper → CUDA builtins: includes (evidence: `tools/android-sdk/renderscript/clang-include/__clang_cuda_runtime_wrapper.h`)
