# oni-kuki/tape architecture

> Architecture diagram of the GitHub repository oni-kuki/tape, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/oni-kuki/tape
- Repository: https://github.com/oni-kuki/tape

## Overview

##### Main Components
- Sliver Repository (an external dependency): Although not inside the Tape repo, the README instructs users to clone this repo because Tape is meant to modify and obfuscate its payload.
- Taping.sh Script: This is the orchestrator that accepts parameters (version and path) and then drives the obfuscation process differently based on the Sliver version (v1.5 vs v1.6).
- Loaders Directory: Contains two subdirectories (v1.5 and v1.6), each with Go source code files for 64-bit and 32-bit (exe) loaders. These are compiled into binary payload components used by Tape.
- Scotch.py Script: An independent Python-based obfuscation tool allowing separate usage from Taping.sh.
- Yara_Rules: Contains YARA rule files (e.g., Multi_Trojan_Sliver.yar) that are used for identifying and replacing specific hexadecimal patterns, as mentioned in the README.
- (Implicit) External Integrated Components: The final outputs include binaries – external-server, client, and server – generated for various purposes (implant creation and execute-assembly).

##### Relationships and Interactions
- The user clones both the Sliver and Tape repositories.
- The Taping.sh script is modified with custom variables and then invoked with specific parameters (e.g., specifying the version and an optional --ext flag).
- Depending on the Sliver version specified (v1.5 or v1.6), Taping.sh will call the corresponding loader (from the loaders directory) for assembly modifications. The loader code, written in Go, is compiled to generate architecture-specific executables (x64 and x86).
- The generated binaries are used for either creating the implant (“external-server”) or for execute-assembly functions (“client” and “server”), with special emphasis on OPSEC – noting that version 1.6 might be quieter for implants while version 1.5 is more stable.
- Scotch.py can be used separately to obfuscate a given file, following similar transformation principles.
- YARA rules are referenced in both scripts and manual instructions to pinpoint the hex patterns that need obfuscation. They help in verifying that the modifications are applied correctly.

##### Important Architectural Patterns/Design Principles
- Separation of Concerns: There is a clear separation between the build/orchestration logic (taping.sh) and the independent obfuscation function (scotch.py).
- Version-based Branching: The project supports two different versions of the loader (v1.5 and v1.6), acknowledging varying trade-offs in stability and execution methods.
- Modularity: The use of independent directories (loaders, yara_rules) and scripts makes it easier to update each component without impacting the whole system.
- Extensibility: By incorporating flags (like --ext) and external configuration through variable adjustments in Taping.sh, the design is made flexible and user-customizable.

##### Relevant Technologies and Tools
- Bash scripting (taping.sh)
- Go programming language for building binaries (loader_exe_x64.go and loader_exe_x86.go)
- Python (scotch.py)
- YARA for pattern matching in payloads
- Git for version control and cloning the required repositories
- External tools such as GVM (as referenced for prerequisites) and potentially GHIDRA for manual steps

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Sliver Repository (Input Payload)"]:::external
    B["Taping.sh (Obfuscation Orchestrator)"]:::script
    H["Scotch.py (Python Obfuscator)"]:::script
    C["Loader v1.5 (x64)"]:::source
    D["Loader v1.5 (x86)"]:::source
    E["Loader v1.6 (x64)"]:::source
    F["Loader v1.6 (x86)"]:::source
    G["Compiled Loader Binaries"]:::compiled
    I["Output Binaries: External-Server, Client, Server"]:::output
    J["YARA Rules Module"]:::yara

    %% Flow Connections
    A -->|"provides_payload"| B
    B -->|"v1.5"| C
    C -->|"compile_step"| D
    B -->|"v1.6"| E
    E -->|"compile_step"| F
    D -->|"compiled"| G
    F -->|"compiled"| G
    G -->|"assemble"| I
    H -->|"obfuscate"| I

    %% YARA Integration (dotted lines)
    B ---|"YARA_check"| J
    H ---|"YARA_check"| J

    %% Styles
    classDef external fill:#FFD700,stroke:#333,stroke-width:2px;
    classDef script fill:#ADD8E6,stroke:#333,stroke-width:2px;
    classDef source fill:#90EE90,stroke:#333,stroke-width:2px;
    classDef compiled fill:#FFA07A,stroke:#333,stroke-width:2px;
    classDef output fill:#DDA0DD,stroke:#333,stroke-width:2px;
    classDef yara fill:#FF6347,stroke:#333,stroke-width:2px;

    %% Click Events
    click B "https://github.com/oni-kuki/tape/blob/main/./taping.sh"
    click C "https://github.com/oni-kuki/tape/blob/main/./loaders/v1.5/loader_exe_x64.go"
    click D "https://github.com/oni-kuki/tape/blob/main/./loaders/v1.5/loader_exe_x86.go"
    click E "https://github.com/oni-kuki/tape/blob/main/./loaders/v1.6/loader_exe_x64.go"
    click F "https://github.com/oni-kuki/tape/blob/main/./loaders/v1.6/loader_exe_x86.go"
    click H "https://github.com/oni-kuki/tape/blob/main/./scotch.py"
    click J "https://github.com/oni-kuki/tape/tree/main/./yara_rules"
```
