Client-Server Telemetry Demo in C (Educational, Cross-Platform)
π§ Introduction
This project is now a safe educational exercise to practice C programming with networking and multithreading on Linux and Windows. It keeps a client/server architecture and demonstrates:
- a long-lived TCP connection,
- simple message framing (
KEY:andCMD:prefixes), - a telemetry thread running in parallel with a command listener,
- a small command parser with non-dangerous built-in commands.
- π TCP client connection (
connect_to_server). - π§΅ Background telemetry thread (
start_telemetry) that sends a simulated heartbeat. - π¬ Safe command execution (
help,ping,time) without shell execution. - πͺ Cross-platform socket lifecycle helpers for Linux and Windows (
network_init,network_cleanup,socket_close).
- π₯ Receives
KEY:telemetry lines and appends them tokeylogger.txt. - π Receives
CMD:command results and appends them toresult_commands.txt. - β¨οΈ Lets the operator type commands in stdin and forwards them to the client.
Malware/
βββ client/
β βββ include/
β β βββ commands.h
β β βββ keylogger.h
β β βββ network.h
β βββ src/
β βββ main.c
β βββ network.c
β βββ keylogger.c # simulated telemetry thread
β βββ commands.c # safe built-in commands only
β βββ c2_listener.c
β βββ demon.c
β βββ Makefile
βββ server/
βββ include/
β βββ server.h
β βββ log.h
βββ src/
β βββ main.c
β βββ server.c
β βββ log.c
βββ Makefile
cd Malware/client/src
make
cd ../../server
makecd Malware/client/src
gcc -Wall -Wextra -I../include main.c network.c keylogger.c commands.c c2_listener.c demon.c -o client.exe -lws2_32Server uses POSIX APIs in this repo version and is intended to run on Linux.
- Start server:
cd Malware/server
./server- Start client:
cd Malware/client/src
./client- From the server terminal, send commands:
helppingtime
The server writes outputs to:
keylogger.txtfor telemetry (KEY:messages)result_commands.txtfor command output (CMD:messages)