Skip to content

0xLhu/C-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

79 Commits
Β 
Β 
Β 
Β 

Repository files navigation

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: and CMD: prefixes),
  • a telemetry thread running in parallel with a command listener,
  • a small command parser with non-dangerous built-in commands.

⚠️ Disclaimer: this repository is for learning only. Do not use it for unauthorized monitoring or offensive activity.

Features

Client

  • 🌐 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).

Server

  • πŸ“₯ Receives KEY: telemetry lines and appends them to keylogger.txt.
  • πŸ“„ Receives CMD: command results and appends them to result_commands.txt.
  • ⌨️ Lets the operator type commands in stdin and forwards them to the client.

Project structure

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

Build

Linux

cd Malware/client/src
make

cd ../../server
make

Windows (MinGW example)

cd 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_32

Server uses POSIX APIs in this repo version and is intended to run on Linux.

Usage

  1. Start server:
cd Malware/server
./server
  1. Start client:
cd Malware/client/src
./client
  1. From the server terminal, send commands:
  • help
  • ping
  • time

The server writes outputs to:

  • keylogger.txt for telemetry (KEY: messages)
  • result_commands.txt for command output (CMD: messages)

About

Educational Purpose only

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published