How cappricio-securities/camjacking works
Project type and purpose
• This is a Node.js-based CLI/web tool (“CamJacking”) that spins up a local Express server with EJS views and static assets, captures webcam photos in the browser (via client-side JS), and forwards those photos to a Telegram chat using a bot.
File structure
• Top level:
• app.js – entry point that bootstraps the CLI interface and starts the Express app
• includes/ – core modules (bot.js, config.js, help.js, route.js)
• views/ – EJS templates (index.ejs plus header/footer components)
• Assets/ – public front-end assets (css/style.css, js/cam.js)
• You see the MVC pattern:
• Routes in includes/route.js
• Views in views/
• Public assets in Assets/
• CLI behavior and configuration (includes/help.js, includes/config.js) integrate with app.js.
README for additional insights
• The tool is installed globally, invoked with CamJacking -p <port> and -c <chatid>.
• It exposes a UI where the user grants webcam permission; snapshots are captured and saved under ~/camjacking/.
• Bot module sends images to Telegram via the Bot API.
a. Main components:
1. CLI Launcher (CamJacking command-line interface)
2. Express Server (app.js + includes/route.js + includes/config.js)
3. View Layer (EJS templates + Assets/css + Assets/js)
4. Browser Client (renders UI, runs cam.js)
5. Bot Module (includes/bot.js communicating with Telegram API)
6. File Storage (local filesystem under ~/camjacking/)
7. External Service (Telegram Bot API)
b. Relationships & interactions:
• CLI Launcher parses flags (-p, -c), passes config into Express Server.
• Express Server exposes HTTP endpoints (GET /, POST /snapshot).
• Browser Client requests /, gets EJS-rendered page + static assets.
• cam.js in the browser captures webcam frames, POSTs image data to POST /snapshot.
• Express Server route receives image, writes file to disk, and invokes Bot Module.
• Bot Module calls Telegram Bot API, sending the image to the configured chat ID.
c. Architectural patterns/design principles:
• MVC-style separation (routes/controllers vs. views vs. public assets)
• Modularization of concerns: config, help, routes, bot logic in separate modules
• Single-process, event-driven server with a thin client capturing media
d. Relevant technologies/frameworks/libraries:
• Node.js + Express.js
• EJS templating engine
• Client-side webcam capture via JavaScript (getUserMedia in cam.js)
• Telegram Bot API for outbound notifications