# hangetzzu/saycheese architecture

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

- Interactive diagram: https://gitdiagram.com/hangetzzu/saycheese
- Repository: https://github.com/hangetzzu/saycheese

## Overview

##### Project type and purpose (from README + tree)
**Type:** Small “toolkit” combining shell + PHP + static HTML/JS to host a web page that requests camera permissions and then sends captured data back to the server.
**Purpose (as described):** Drive-by camera capture through a link; the README explicitly frames it as malicious.
**Architecture style:** Single-node web “collector” + public tunneling/port-forwarding to expose it to the internet.

Top-level files strongly imply the runtime components:

- `saycheese.sh`
Orchestration script. Likely: starts a local web server, sets up a tunnel (Serveo/Ngrok), prints the public URL, and tails logs.
- `saycheese.html`
Client page (browser) that triggers camera permission and captures frames.
- `post.php`
Server endpoint that receives uploaded frames/data from the client.
- `ip.php`
Server endpoint that logs/collects visitor IP/user-agent (often used for “who clicked” tracking).
- `template.php`
Probably server-side template to generate the delivered page (or customize payload/redirects).
- `README.md`, `LICENSE`
Documentation/legal.

##### Operator environment (attacker/runner)
- **Operator workstation** (Kali/Termux)
- Runs `saycheese.sh`
- Stores outputs (captured images/logs)

##### Exposure layer (public ingress)
- **Tunnel / Port-forwarding service**
- “Public URL” entry point
- Routes inbound HTTPS traffic to the local machine
- This is a major trust-boundary crossing

##### Web server (local collector)
- **Local HTTP server / PHP runtime**
- Serves `saycheese.html` (possibly via `template.php`)
- Receives uploads via `post.php`
- Logs metadata via `ip.php`

##### Victim client (browser execution environment)
- **Target device browser**
- Loads page
- Runs client-side JS
- Requests camera permission via browser APIs
- Captures media stream and sends data back

##### Data stores / artifacts
Even if they’re just files on disk, model them explicitly:
- **Filesystem storage**
- Captured images (frames)
- IP logs / request logs

##### Operator → Tunnel Service
- Establishes tunnel / registers endpoint
##### Target Browser → Tunnel Service (HTTPS request)
- Requests the hosted page
##### Tunnel Service → Local Web Server
- Forwards inbound requests to local server
##### Local Web Server → Target Browser
- Responds with HTML/JS content
##### Target Browser → Local Web Server
- Sends telemetry (IP/user-agent gets logged)
##### Target Browser → Local Web Server
- Sends uploaded media/captured frames
##### Local Web Server → Filesystem
- Persists captured artifacts/logs
##### Operator → Filesystem
- Views/exports collected artifacts

##### Architectural patterns to highlight

- **Client-driven capture**: browser is the execution/runtime for media access; server mainly collects.
- **Reverse tunneling as ingress**: external service introduces a large attack surface and trust boundary.
- **Minimal “backend”**: PHP endpoints are thin collectors; state is typically files-on-disk.
- **Trust boundaries**:
- Public internet ↔ tunneling provider ↔ operator machine
- Browser sandbox ↔ device camera permissions
- Web server ↔ local filesystem

- Nodes: Operator device, Tunnel service, Target device
- Inside operator device: “Web server + PHP scripts” and “Storage”
- Processes: “Serve page”, “Log visitor metadata”, “Receive media upload”
- Data stores: “Captured images”, “IP logs”
- External entities: “Target browser”, “Tunnel service”, “Operator”

##### What “very detailed” means here (without being operational)
To be thorough, add annotations next to flows/components:
- **Authentication: none / unknown** (if not present)
- **Transport: HTTPS terminated at tunnel vs local** (trust implication)
- **Data sensitivity**: captured images, IPs, user-agent
- **Retention**: stored on disk (location/rotation if known)
- **Abuse risks**: unauthorized collection, privacy violations
- **Mitigations (if this is a defensive review)**:
- Browser permission UX, enterprise policies disabling camera access
- Network egress controls / blocking known tunneling domains
- Server-side hardening if running in a lab (isolated VM, no public exposure)

- [Target Browser] → (HTTPS) → [Tunnel Service] → (forward) → [Local Web Server (PHP)]
- [Local Web Server] → [Filesystem: Captured Media]
- [Local Web Server] → [Filesystem: IP/Access Logs]
- [Operator] ↔ [Local Web Server/Filesystem] (view results, manage runtime)

That’s the “as many components as possible” decomposition, grounded in the actual repo files, but framed for architecture clarity and security assessment rather than operational misuse.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External / Trust Zones
    subgraph "Victim Device Trust Zone"
        VB["Target Device Browser\n(HTML/JS runtime + Camera permission UX)"]:::client
        CAM["Device Camera / Media Devices\n(OS + Browser permission gate)"]:::sensitive
        VB -->|"getUserMedia()"| CAM
        CAM -->|"mediaStream"| VB
    end

    subgraph "Public Internet / Ingress Trust Zone"
        TUN["Tunneling Service\n(Reverse proxy / Port-forwarding)\nPublic URL entry point"]:::ingress
        NET["Public Network\n(unauthenticated traffic)"]:::external
        NET -->|"HTTPS request"| TUN
    end

    subgraph "Operator Host Trust Zone\n(Local collector runtime)"
        OP["Operator Workstation\n(Kali/Termux)\nRuns orchestrator + views artifacts"]:::operator
        ORCH["Orchestration Script\n(Starts server, sets up tunnel, tails logs)"]:::operator

        subgraph "Local Web Server + PHP Runtime"
            WEB["Local HTTP Server\n(PHP runtime)"]:::server
            PAGE["Client Capture Page\n(Served HTML/JS)"]:::client
            TPL["Server-Side Template / Page Generator"]:::server
            IPLOG["Visitor IP/UA Logging Endpoint"]:::server
            POST["Media Upload / Collector Endpoint"]:::server
        end

        subgraph "Local Filesystem Data Stores"
            FS_MEDIA[("Captured Images / Frames\n(files-on-disk)")]:::datastore
            FS_LOGS[("IP / Access Logs\n(files-on-disk)")]:::datastore
        end
    end

    %% Primary flows (vertical, security-review framing)
    OP -->|"executes"| ORCH
    ORCH -->|"spawns"| WEB
    ORCH -->|"establishesTunnel"| TUN

    TUN -->|"forwardsInboundHTTP(S)"| WEB
    VB -->|"HTTPS GET page"| TUN
    WEB -->|"HTTP 200 HTML/JS"| TUN
    TUN -->|"response"| VB

    WEB -->|"serves"| PAGE
    WEB -->|"renders(Optional)"| TPL

    VB -->|"HTTP(S) POST telemetry"| TUN
    TUN -->|"forward"| IPLOG
    IPLOG -->|"fileWrite:ip/ua"| FS_LOGS

    VB -->|"HTTP(S) POST media"| TUN
    TUN -->|"forward"| POST
    POST -->|"fileWrite:frames"| FS_MEDIA

    OP -->|"reads/exports"| FS_MEDIA
    OP -->|"reviews"| FS_LOGS

    %% Notes / risk annotations (non-operational)
    AUTHNOTE["AuthZ/AuthN\nNone/Unknown (review item)"]:::note
    TLSNOTE["Transport boundary\nTLS terminates at tunnel vs local (review item)"]:::note
    SENSNOTE["Sensitive data\nImages + IP/UA (privacy impact)"]:::note

    WEB -.->|"review"| AUTHNOTE
    TUN -.->|"review"| TLSNOTE
    FS_MEDIA -.->|"classify"| SENSNOTE
    FS_LOGS -.->|"classify"| SENSNOTE

    %% Click events (component mappings)
    click ORCH "https://github.com/hangetzzu/saycheese/blob/master/saycheese.sh"
    click PAGE "https://github.com/hangetzzu/saycheese/blob/master/saycheese.html"
    click POST "https://github.com/hangetzzu/saycheese/blob/master/post.php"
    click IPLOG "https://github.com/hangetzzu/saycheese/blob/master/ip.php"
    click TPL "https://github.com/hangetzzu/saycheese/blob/master/template.php"
    click AUTHNOTE "https://github.com/hangetzzu/saycheese/blob/master/README.md"
    click TLSNOTE "https://github.com/hangetzzu/saycheese/blob/master/README.md"
    click SENSNOTE "https://github.com/hangetzzu/saycheese/blob/master/README.md"

    %% Extra clickable documentation/legal nodes (kept minimal but present)
    DOC["Project Documentation"]:::doc
    LIC["License / Legal"]:::doc
    OP -.->|"reads"| DOC
    OP -.->|"compliance"| LIC
    click DOC "https://github.com/hangetzzu/saycheese/blob/master/README.md"
    click LIC "https://github.com/hangetzzu/saycheese/tree/master/LICENSE"

    %% Styles
    classDef client fill:#2b6cb0,stroke:#1a365d,color:#ffffff,stroke-width:1px
    classDef server fill:#2f855a,stroke:#22543d,color:#ffffff,stroke-width:1px
    classDef ingress fill:#dd6b20,stroke:#7b341e,color:#ffffff,stroke-width:1px
    classDef datastore fill:#718096,stroke:#2d3748,color:#ffffff,stroke-width:1px
    classDef operator fill:#553c9a,stroke:#322659,color:#ffffff,stroke-width:1px
    classDef external fill:#4a5568,stroke:#1a202c,color:#ffffff,stroke-width:1px
    classDef sensitive fill:#c53030,stroke:#742a2a,color:#ffffff,stroke-width:1px
    classDef note fill:#fffaf0,stroke:#dd6b20,color:#1a202c,stroke-width:1px
    classDef doc fill:#0ea5e9,stroke:#075985,color:#ffffff,stroke-width:1px
```
