# kadekedwin/hackcam architecture

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

- Interactive diagram: https://gitdiagram.com/kadekedwin/hackcam
- Repository: https://github.com/kadekedwin/hackcam

## Overview

##### Project Type and Purpose
- Purpose: HACKCAM is a script-based phishing utility designed to capture webcam snapshots from targets. The README indicates that when the target visits the generated link and consents to camera access, the tool automatically saves the photo to a “result” directory.
- Project Type: This is not a traditional full-stack web application but rather a script (PHP + shell) based hacking tool that leverages web components for its functionality (e.g., HTML, PHP) along with tunneling via ngrok.

##### File Structure
- Top-Level Files:
- README.md & banner.txt: Provide documentation and likely some introductory banner visuals.
- hackcam.sh: The primary executable shell script that orchestrates the project’s setup, including environment configuration and launching the server.
- index.html: Likely the landing page where the target will be presented with a webpage that triggers the camera access request.
- index.php, ip.php, post.php: Server-side PHP scripts handling different parts of the interaction:
▪ index.php may serve as a controller for the overall page logic.
▪ ip.php could be used to capture and log visitor IP addresses.
▪ post.php likely handles receiving and processing the photo data from the target’s device.
- result directory: Intended to store captured images.

- Absence of separate frontend/backend directories, which suggests a relatively straightforward web server setup (possibly via PHP’s built-in server or another lightweight solution triggered by the shell script).

##### README for Additional Insights
- The README details installation and requirements (PHP, git, wget, curl, ngrok), which are essential for running and exposing the local server online.
- It highlights that the tool leverages ngrok for tunneling so that the local server can be accessed by an external target, indicating a critical dependency in the system architecture.
- The workflow described:
▪ Start the tool via hackcam.sh.
▪ Configure ngrok (if not already done).
▪ Generate a link for the target to access.
▪ Capture the photo when the target grants camera access.
▪ Store the photo in the result folder.

## Diagram (Mermaid)

```mermaid
flowchart TD
    Attacker["Attacker"]:::external
    CLI["CLI Orchestration (hackcam.sh)"]:::cli
    NGROK["Tunneling Service (ngrok)"]:::tunnel
    Target["Target"]:::external
    FE["Web Frontend (Phishing Page: index.html)"]:::frontend
    Storage["Storage (result folder)"]:::storage

    subgraph "Web Server (PHP Components)"
        indexPHP["Main Controller: index.php"]:::server
        ipPHP["IP Logging: ip.php"]:::server
        postPHP["Photo Reception: post.php"]:::server
    end

    Attacker -->|"launch"| CLI
    CLI -->|"start tunneling"| NGROK
    CLI -->|"initiate web server"| indexPHP
    NGROK -->|"publicURL"| Target
    Target -->|"visit URL"| FE
    FE -->|"sends photoData"| postPHP
    FE -->|"sends visitorIP"| ipPHP
    postPHP -->|"store image"| Storage

    click CLI "https://github.com/kadekedwin/hackcam/blob/main/hackcam.sh"
    click FE "https://github.com/kadekedwin/hackcam/blob/main/index.html"
    click indexPHP "https://github.com/kadekedwin/hackcam/blob/main/index.php"
    click ipPHP "https://github.com/kadekedwin/hackcam/blob/main/ip.php"
    click postPHP "https://github.com/kadekedwin/hackcam/blob/main/post.php"
    click Storage "https://github.com/kadekedwin/hackcam/tree/main/result"

    classDef external fill:#ffcccc,stroke:#cc0000,stroke-width:2px;
    classDef cli fill:#cce5ff,stroke:#007bff,stroke-width:2px;
    classDef tunnel fill:#e0e0e0,stroke:#606060,stroke-width:2px,stroke-dasharray: 5, 5;
    classDef frontend fill:#fff2cc,stroke:#d79b00,stroke-width:2px;
    classDef server fill:#d1e7dd,stroke:#0f5132,stroke-width:2px;
    classDef storage fill:#d9d2e9,stroke:#6f42c1,stroke-width:2px,stroke-dasharray: 2, 2;
```
