One-liner: A lightweight, multi-threaded C engine that ingests system logs, scores threat patterns using sliding time-windows, and fires real-time alerts — built for speed, built for detection.
CodeShield is a multi-threaded C-based log analysis and scoring engine designed to detect suspicious activity patterns from system or application logs. It ingests logs, analyzes events, scores threats, and generates alerts using a modular pipeline architecture.
hack_vsc/
├── alert.c # Alert generation and logging
├── alert_log.txt # Generated alert output
├── analyzer.c # Core analysis logic
├── codeshield.exe # Compiled Linux ELF binary (name retained)
├── compile.bat # Windows compile script
├── generate_logs.c # Test log generator
├── generate_logs.exe # Compiled log generator binary
├── hashmap.c # Custom hashmap implementation
├── ingestion.c # Log ingestion & parsing
├── main.c # Program entry point
├── Makefile # Linux build automation
├── sample_logs.txt # Sample input logs
├── scorer.c # Threat scoring logic
├── structures.h # Shared data structures
└── window.c # Sliding time-window analysis
- GCC
- POSIX threads (
pthread)
makegcc -o codeshield alert.c analyzer.c hashmap.c ingestion.c main.c scorer.c window.c -lpthread./codeshieldNote: On Linux, binaries must be executed with
./— even if the file is named.exe, it is a standard ELF executable and works natively on Linux.
Use the provided batch file:
compile.batRequires MinGW or a compatible GCC environment.
[Logs] → [Ingestion] → [Parser] → [Time-Window] → [Scorer] → [Alerts]
- Log Ingestion — Reads logs from text files or generated sources (
ingestion.c) - Parsing & Structuring — Converts raw logs into structured events (
structures.h) - Time-Window Analysis — Groups events using sliding windows for pattern detection (
window.c) - Scoring Engine — Assigns threat scores based on behavior frequency and severity (
scorer.c) - Alert System — Writes alerts to
alert_log.txt(alert.c)
Generate test logs:
gcc generate_logs.c -o generate_logs && ./generate_logsThen analyze them:
./codeshield| Name | Roll Number | Role | Responsibilities |
|---|---|---|---|
| Rakesh G | 2401201064 | 👑 Team Lead & Core Engine Dev | Project architecture, main.c, analyzer.c, integration, final build & submission |
| Aditya Shibu | 2401201047 | scorer.c, window.c, alert.c, generate_logs.c, testing and validation |
|
| Ujjwal Chauhan | 2401201059 | 🔍 Ingestion & Data Pipeline Dev | ingestion.c, hashmap.c, structures.h, log parsing and data structuring |
- The
.exeextension is cosmetic on Linux; the binary is a standard ELF executable. - Designed for learning, prototyping, and hackathon use.
- Easily extensible for real-time log streams or SIEM integration.
- Real-time log streaming
- JSON log support
- Configurable rule engine
- REST API output
- Dashboard integration
MIT License © 2025 Rakesh G, Aditya Shibu, Ujjwal Chauhan