Zreechxnn/edukeylogger

GitHub: Zreechxnn/edukeylogger

一个集成了守护进程保护、CPU压力测试和日志加密功能的Linux键盘记录系统,用于系统编程和安全教育演示。

Stars: 0 | Forks: 0

# 🔥 EduKeylogger - 高级教育类键盘记录系统 🔥 ![License](https://img.shields.io/badge/License-GNU-red) ![Platform](https://img.shields.io/badge/Platform-Linux-blue) ![C++](https://img.shields.io/badge/C++-17-yellowgreen) ![Security](https://img.shields.io/badge/Security-Demonstration-purple) **EduKeylogger** 是一个高级教育类键盘记录系统,旨在演示系统编程技术、进程防御机制和 CPU 压力测试。该项目展示了专业级的 Linux OS 概念实现,以及用于热基准测试的高 CPU 负载模拟。 ## 🌟 核心特性 ### 🛡️ 高防御守护进程系统 - **双 Fork 守护进程 化** - 针对所有终止信号的 **信号屏蔽** - 带自动重启功能的 **看门狗进程** - 使用 `flock()` 的 **基于 PID 的锁文件** - 通过原始模式实现的 **终端隔离** ### 🔥 CPU 压力引擎 - **多线程加压器** (8–32 线程) - **大型 Unicode 处理** (超过 1000 万个 CJK 字符) - **复杂数学运算** x = sin(x) * cos(x) / tan(x) * sqrt(x); - **内存密集型交换** (每秒 1000+ 次) - **动态模式生成** ### 🔐 安全机制 - 通过 JSON 配置进行的 **密码认证** - **安全文件标志验证** - **Ctrl+E 退出组合键检测** - **自动会话超时** (60 分钟) ### 📊 日志系统 - **结构化日志格式** - **特殊按键检测** (\[ENTER], \[TAB], \[BACK]) - **时间戳精度** - **加密日志选项** (AES-256-CBC) ## 📦 系统要求 | 组件 | 最低要求 | 推荐配置 | | --------- | ----------------- | ---------------------- | | OS | Linux Kernel 5.4+ | Ubuntu 22.04 LTS | | CPU | 双核 64 位 | 8 核+ 且具备散热 | | RAM | 2GB | 16GB+ | | Storage | 100MB | SSD 且有 1GB+ 可用空间 | | Compiler | g++ 9.4.0 | g++ 12.3.0 | | Libraries | nlohmann/json | Boost 1.75+ (可选) | ## 🚀 安装与配置 ### 从源码编译 ``` # Clone 仓库 git clone https://github.com/Zreechxnn/edukeylogger.git cd edukeylogger # 安装依赖 sudo apt update sudo apt install g++ build-essential sudo apt install g++ libjsoncpp-dev # 使用优化标志编译 g++ -O3 -march=native -std=c++17 -o edukeylogger main.cpp -lpthread # 可选:授予 CAP_SYS_ADMIN capability sudo setcap cap_sys_admin+ep edukeylogger ``` ## 💻 使用方法 ### 作为守护进程运行 ``` sudo ./edukeylogger ``` ### 监控日志 ``` tail -f /var/log/edukey.log ``` ### 停止程序 ``` ./edukeylogger interactive Enter shutdown password: secreet [✓] Shutdown command sent. Program will exit within 10 seconds. ``` ### CPU 压力测试模式 ``` Sudo ./edukeylogger --stress-test ``` ## 🧠 系统架构 ``` graph TD A[Main Process] --> B[Daemonize] B --> C[Create Lockfile] C --> D[Block Signals] D --> E[Fork Watchdog] E --> F[Start CPU Burner] F --> G[Keylogger Main Loop] G --> H{Time Remaining?} H -->|Yes| I[Check Exit Flag] I --> J{Valid Password?} J -->|No| K[Read Input] K --> L[Process Key] L --> M[Write Log] M --> H J -->|Yes| N[Clean Exit] H -->|No| N ``` ## 📂 文件系统结构 | 路径 | 描述 | 权限 | | ------------------------- | ---------------------- | ----------- | | `/tmp/edu_keylogger.lock` | PID 锁文件 | `0600` | | `/var/log/edukey.log` | 加密日志文件 | `0600` | | `/proc/self/exe` | 看门狗重启路径 | - | | `/dev/tty` | 虚拟终端 | `0666` | | `/tmp/edu_keylogger.exit` | 通过密码验证的退出标志 | `0644` | ## 🧪 性能测试 ### CPU 负载概况 ![CPU Load Profile](https://example.com/cpu_profile.png) | 参数 | 数值 | | ---------------- | -------------- | | Thread Count | 核心数 × 8 | | Unicode Size | 1000–2000 万 | | Operations/sec | \~5.2×10⁹ | | Memory Bandwidth | 48GB/s | | Temp Increase | 平均 +35°C | ### CPU 加压方式对比 | 方法 | CPU 使用率 | 内存使用 | 有效性 | | --------------- | --------- | ------------ | ------------- | | 空循环 | 100% | 最低 | ★★★☆☆ | | 大型 Unicode | 100% | 高 | ★★★★☆ | | 数学运算 | 100% | 中等 | ★★★★★ | | **组合方式** | **100%** | **高** | **★★★★★** | ## ⚠️ 安全与道德声明 1. **仅限用于您自己的系统** 2. **未经授权请勿安装** 3. **可能导致硬件过热** 4. **日志可能包含敏感信息** 5. **仅在受控环境中使用** ``` # WARNING:以下操作可能损坏硬件! ./edukeylogger --max-stress ``` ## 📜 许可证 ``` Copyright (c) 2025 Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. ```
标签:AES-256加密, C++17, CPU压力测试, ETW劫持, HTTP头分析, HTTP工具, Sysadmin工具, 代码生成, 信号屏蔽, 原始模式, 双分支守护, 后端开发, 子域名变形, 子域名枚举, 守护进程, 性能测试, 教育目的, 文件锁定, 日志记录, 渗透测试工具, 热基准测试, 用户空间, 看门狗, 系统安全, 系统编程, 红队模拟, 终端控制, 网络安全审计, 进程防御, 键盘记录器