# nathanlopez/stitch architecture

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

- Interactive diagram: https://gitdiagram.com/nathanlopez/stitch
- Repository: https://github.com/nathanlopez/stitch

## Overview

Stitch is a cross-platform remote administration framework. The operator starts the host console, establishes or accepts a target session, selects a platform-specific shell, and issues remote commands whose results return through the session. A separate branch generates platform-specific payloads and installer packages. The README documents broad host-management, file-transfer, monitoring, and system-information capabilities; the graph groups these rather than enumerating every command. Some subsystem links reflect README descriptions because their implementation was not sampled.

Main entry points: [`Application/Stitch_Vars/payload_code.py`](https://github.com/nathanlopez/stitch/blob/master/Application/Stitch_Vars/payload_code.py) (Remote Command Execution), [`Application/stitch_cmd.py`](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_cmd.py) (Connection Handling), [`Application/stitch_gen.py`](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_gen.py) (Payload Generator), [`main.py`](https://github.com/nathanlopez/stitch/blob/master/main.py) (Program Entry)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host Console"]
  node_entry["Program Entry<br/>[main.py]"]
  node_console["Command Console<br/>[stitch_cmd.py]"]
end

subgraph group_session["Remote Session"]
  node_session["Connection Handling<br/>[stitch_cmd.py]"]
  node_aes["Encrypted Transport<br/>[stitch_lib.py]"]
  node_shell_win["Windows Shell<br/>[stitch_winshell.py]"]
  node_shell_linux["Linux Shell<br/>[stitch_lnxshell.py]"]
  node_shell_osx["macOS Shell<br/>[stitch_osxshell.py]"]
end

subgraph group_payload["Payload Creation"]
  node_generator["Payload Generator<br/>[stitch_gen.py]"]
  node_payload_code["Payload Templates<br/>[payload_code.py]"]
  node_installer_vars["Installer Definitions"]
  node_installer["Installer Packaging<br/>[nsis.py]"]
end

subgraph group_capabilities["Target Capabilities"]
  node_remote_exec["Remote Command Execution<br/>[payload_code.py]"]
  node_file_ops["File Operations<br/>[download.py]"]
  node_system_info["System Information<br/>[sysinfo.py]"]
  node_monitoring["Monitoring Features<br/>[kl_start.py]"]
  node_platform_support["Platform Support"]
end

node_operator(("Operator"))
node_target(("Target Host"))

node_operator -->|"starts"| node_entry
node_entry -->|"runs"| node_console
node_operator -->|"enters commands"| node_console
node_console -->|"connects or listens"| node_session
node_target -->|"opens session"| node_session
node_session -->|"exchanges data"| node_aes
node_session -->|"dispatches by OS"| node_shell_win
node_session -->|"dispatches by OS"| node_shell_linux
node_session -->|"dispatches by OS"| node_shell_osx
node_shell_win -->|"issues commands"| node_remote_exec
node_shell_linux -->|"issues commands"| node_remote_exec
node_shell_osx -->|"issues commands"| node_remote_exec
node_remote_exec -->|"invokes"| node_file_ops
node_remote_exec -->|"invokes"| node_system_info
node_remote_exec -->|"invokes"| node_monitoring
node_remote_exec -->|"uses platform features"| node_platform_support
node_operator -->|"requests payload"| node_generator
node_generator -->|"uses templates"| node_payload_code
node_generator -->|"creates packages"| node_installer
node_installer -->|"uses definitions"| node_installer_vars

click node_entry "https://github.com/nathanlopez/stitch/blob/master/main.py"
click node_console "https://github.com/nathanlopez/stitch/blob/master/Application/stitch_cmd.py"
click node_generator "https://github.com/nathanlopez/stitch/blob/master/Application/stitch_gen.py"
click node_payload_code "https://github.com/nathanlopez/stitch/blob/master/Application/Stitch_Vars/payload_code.py"
click node_installer_vars "https://github.com/nathanlopez/stitch/tree/master/Application/Stitch_Vars"
click node_session "https://github.com/nathanlopez/stitch/blob/master/Application/stitch_cmd.py"
click node_aes "https://github.com/nathanlopez/stitch/blob/master/Application/stitch_lib.py"
click node_shell_win "https://github.com/nathanlopez/stitch/blob/master/Application/stitch_winshell.py"
click node_shell_linux "https://github.com/nathanlopez/stitch/blob/master/Application/stitch_lnxshell.py"
click node_shell_osx "https://github.com/nathanlopez/stitch/blob/master/Application/stitch_osxshell.py"
click node_remote_exec "https://github.com/nathanlopez/stitch/blob/master/Application/Stitch_Vars/payload_code.py"
click node_file_ops "https://github.com/nathanlopez/stitch/blob/master/PyLib/download.py"
click node_system_info "https://github.com/nathanlopez/stitch/blob/master/PyLib/sysinfo.py"
click node_monitoring "https://github.com/nathanlopez/stitch/blob/master/PyLib/kl_start.py"
click node_platform_support "https://github.com/nathanlopez/stitch/tree/master/Configuration/mss"
click node_installer "https://github.com/nathanlopez/stitch/blob/master/Application/Stitch_Vars/nsis.py"

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_entry,node_console toneBlue
class node_session,node_aes,node_shell_win,node_shell_linux,node_shell_osx toneAmber
class node_generator,node_payload_code,node_installer_vars,node_installer toneMint
class node_remote_exec,node_file_ops,node_system_info,node_monitoring,node_platform_support toneRose
class node_operator,node_target toneIndigo
```

## Components

### Host Console

- [Program Entry](https://github.com/nathanlopez/stitch/blob/master/main.py): `main.py`
- [Command Console](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_cmd.py): `Application/stitch_cmd.py`

### Remote Session

- [Connection Handling](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_cmd.py): `Application/stitch_cmd.py`
- [Encrypted Transport](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_lib.py): `Application/stitch_lib.py`
- [Windows Shell](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_winshell.py): `Application/stitch_winshell.py`
- [Linux Shell](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_lnxshell.py): `Application/stitch_lnxshell.py`
- [macOS Shell](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_osxshell.py): `Application/stitch_osxshell.py`

### Payload Creation

- [Payload Generator](https://github.com/nathanlopez/stitch/blob/master/Application/stitch_gen.py): `Application/stitch_gen.py`
- [Payload Templates](https://github.com/nathanlopez/stitch/blob/master/Application/Stitch_Vars/payload_code.py): `Application/Stitch_Vars/payload_code.py`
- [Installer Definitions](https://github.com/nathanlopez/stitch/tree/master/Application/Stitch_Vars): `Application/Stitch_Vars`
- [Installer Packaging](https://github.com/nathanlopez/stitch/blob/master/Application/Stitch_Vars/nsis.py): `Application/Stitch_Vars/nsis.py`

### Target Capabilities

- [Remote Command Execution](https://github.com/nathanlopez/stitch/blob/master/Application/Stitch_Vars/payload_code.py): `Application/Stitch_Vars/payload_code.py`
- [File Operations](https://github.com/nathanlopez/stitch/blob/master/PyLib/download.py): `PyLib/download.py`
- [System Information](https://github.com/nathanlopez/stitch/blob/master/PyLib/sysinfo.py): `PyLib/sysinfo.py`
- [Monitoring Features](https://github.com/nathanlopez/stitch/blob/master/PyLib/kl_start.py): `PyLib/kl_start.py`
- [Platform Support](https://github.com/nathanlopez/stitch/tree/master/Configuration/mss): `Configuration/mss`

### Other components

- **Operator**
- **Target Host**

## Connections

- Operator → Program Entry: starts
- Program Entry → Command Console: runs
- Operator → Command Console: enters commands
- Command Console → Connection Handling: connects or listens
- Target Host → Connection Handling: opens session
- Connection Handling → Encrypted Transport: exchanges data
- Connection Handling → Windows Shell: dispatches by OS
- Connection Handling → Linux Shell: dispatches by OS
- Connection Handling → macOS Shell: dispatches by OS
- Windows Shell → Remote Command Execution: issues commands
- Linux Shell → Remote Command Execution: issues commands
- macOS Shell → Remote Command Execution: issues commands
- Remote Command Execution → File Operations: invokes
- Remote Command Execution → System Information: invokes
- Remote Command Execution → Monitoring Features: invokes
- Remote Command Execution → Platform Support: uses platform features
- Operator → Payload Generator: requests payload
- Payload Generator → Payload Templates: uses templates
- Payload Generator → Installer Packaging: creates packages
- Installer Packaging → Installer Definitions: uses definitions
