Dark-Knight-Ash/Keylogger-Malware-Detector-Tool

GitHub: Dark-Knight-Ash/Keylogger-Malware-Detector-Tool

一款基于 Python 的轻量级 Windows 端点检测工具,通过多层架构识别键盘记录器、间谍软件及无文件持久化恶意软件,为蓝队提供透明的开源 EDR 替代方案。

Stars: 1 | Forks: 0

# 键盘记录器与间谍软件检测工具 ![Python](https://img.shields.io/badge/Python-3.9%2B-3776AB?style=for-the-badge&logo=python&logoColor=white) ![Platform](https://img.shields.io/badge/Platform-Windows-0078D6?style=for-the-badge&logo=windows&logoColor=white) ![License](https://img.shields.io/badge/License-MIT-22C55E?style=for-the-badge) ![Status](https://img.shields.io/badge/Status-Active%20Development-F59E0B?style=for-the-badge) ![Modules](https://img.shields.io/badge/Detection%20Modules-9-8B5CF6?style=for-the-badge) ![Tests](https://img.shields.io/badge/Tests-62%20Passing-10B981?style=for-the-badge) **一款多层 Windows 安全工具,用于实时检测键盘记录器、间谍软件、** **凭据窃取程序和无文件持久化恶意软件。** ## 概述 **SPY-D** 是一款基于 Python 的端点安全工具,专为蓝队成员、恶意软件分析师和安全研究人员打造,他们需要一款**轻量级、开源的替代方案**,以取代沉重的 EDR 代理,用于检测 Windows 系统上的键盘记录器和间谍软件活动。 其名称反映了核心设计理念:每次扫描都是一个完整、可追溯的 **flow** —— 从原始系统遥测数据,经过检测逻辑,最终转化为结构化、可操作的警报。没有任何黑盒操作。 ### 为什么开发此工具 商业 EDR 工具(CrowdStrike、SentinelOne、Defender for Endpoint)每个席位的成本高达数千美元,并且作为不透明的封闭系统运行。安全研究人员、SOC 学生以及红/蓝队实践者需要一个**透明、可修改、具有教育意义的工具**,让他们能够在无需许可合同的情况下真正理解、扩展和部署它。 Flow-to-Flow 填补了这一空白。 ### 检测内容 | 威胁类别 | 示例 | |---|---| | **键盘记录器** | 基于 `SetWindowsHookEx` 的钩子、`GetAsyncKeyState` 轮询、原始输入监听器 | | **间谍软件** | 剪贴板窃取器、屏幕截图捕获器、凭据收集器 | | **无文件恶意软件** | PowerShell 编码命令、LOLBin 滥用、WMI 持久化、内存中执行 | | **持久化机制** | 注册表 Run 键、启动文件夹项、计划任务、服务、WMI 订阅 | | **可疑进程** | 已知的恶意进程名、临时路径执行、SYSTEM 权限滥用 | | **恶意文件** | 通过本地恶意哈希数据库和 VirusTotal API v3 进行 SHA-256 哈希匹配 | ## 架构 ``` Keylogger-Detection-Tool/ │ ├── main.py ← Entry point & scan orchestrator ├── config.py ← All tuneable settings (paths, thresholds, API keys) │ ├── ── DETECTION MODULES ───────────────────────────────────── │ ├── process_scanner.py ← Layer 1: Live process analysis + hook enumeration ├── registry_monitor.py ← Layer 2: Registry Run/RunOnce/Services keys ├── startup_checker.py ← Layer 3: Startup folder & .lnk target inspection ├── persistence_detector.py ← Layer 4: Scheduled tasks, services, WMI subscriptions ├── hash_checker.py ← Layer 5: SHA-256 bad-hash database lookup ├── virustotal_checker.py ← Layer 6: VirusTotal API v3 cloud reputation check │ ├── ── FILELESS / LotL MODULE ──────────────────────────────── │ ├── lolbin_detector.py ← 8-layer fileless & Living-off-the-Land detection │ ├─ Layer 1: Live process command-line scan │ ├─ Layer 2: PowerShell Script Block log (Event ID 4104) │ ├─ Layer 3: Windows Security / System event log │ ├─ Layer 4: AMSI / Windows Defender event channel │ ├─ Layer 5: WMI EventFilter subscription enumeration │ ├─ Layer 6: Parent→child process chain analyser │ ├─ Layer 7: Base64 / hex payload decoder (inline) │ └─ Layer 8: LOLBin network correlation │ ├── ── INFRASTRUCTURE ──────────────────────────────────────── │ ├── alert_engine.py ← Aggregates findings → structured alerts + JSON report ├── logger.py ← Dual text + JSON-lines structured logging ├── utils.py ← Shared helpers (hashing, PE detection, sanitize) ├── gui_dashboard.py ← Tkinter GUI dashboard (dark theme) │ ├── ── SIGNATURES ──────────────────────────────────────────── │ ├── signatures/ │ └── suspicious_names.txt ← 47 known-bad process names (keyloggers, RATs, stealers) │ ├── ── OUTPUT ──────────────────────────────────────────────── │ ├── logs/ │ ├── alerts.log ← Human-readable structured log │ └── alerts.log.jsonl ← Machine-readable JSON-lines log │ └── reports/ └── scan_report.json ← Full structured scan report ``` **总代码库:约 2,100 行 Python 代码,分布在 14 个模块中** ## 检测层 ### 第 1 层 — 进程扫描器 (`process_scanner.py`) 枚举所有正在运行的进程,并通过六个独立的信号维度对它们进行标记: ``` # 每个进程的六种检测信号: 1. Name pattern match → regex against 47 known-bad signatures 2. High CPU usage → threshold: 40% sustained (configurable) 3. High memory usage → threshold: 200 MB RSS (configurable) 4. Suspicious exe path → \Temp\, \AppData\Local\Temp\, \Recycle\ 5. SYSTEM privilege → non-system exe running as NT AUTHORITY\SYSTEM 6. Missing executable → PID exists but backing .exe does not exist on disk ``` 严重程度根据信号数量进行评分:4 个及以上信号 → `CRITICAL`,3 个 → `HIGH`,2 个 → `MEDIUM`,1 个 → `LOW` 此外还执行**键盘钩子枚举**:检查所有进程中加载的模块,以查找符合钩子特征的 DLL 名称(`hookdll`、`keyhook`、`kbdhook`、`winspy`…)。 ### 第 2 层 — 注册表监控器 (`registry_monitor.py`) 扫描 HKLM 和 HKCU 配置单元中最常被滥用的四个注册表持久化位置: ``` HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run HKLM\SYSTEM\CurrentControlSet\Services ``` 标记符合以下条件的条目: - 包含可疑的命令模式(`powershell -enc`、`certutil -decode`、`mshta http://...`) - 指向临时/AppData 路径 - 引用了磁盘上已不存在的可执行文件(幽灵持久化) ### 第 3 层 — 启动文件夹检查器 (`startup_checker.py`) 扫描单用户和所有用户的 Windows 启动文件夹: ``` %APPDATA%\Microsoft\Windows\Start Menu\Programs\Startup C:\ProgramData\Microsoft\Windows\Start Menu\Programs\StartUp ``` 检查每个条目是否存在: - 可疑的脚本扩展名:`.bat`、`.cmd`、`.vbs`、`.js`、`.ps1`、`.hta`、`.scr`、`.pif` - 匹配已知键盘记录器/RAT 命名规则的名称模式 - `.lnk` 快捷方式目标解析(读取原始二进制头 —— 无 COM 依赖) - 直接放置在启动文件夹中的 PE 可执行文件 ### 第 4 层 — 持久化检测器 (`persistence_detector.py`) 针对隐蔽的长期持久化机制的三个子扫描器: **计划任务** — 运行 `schtasks /query /fo CSV /v` 并对每个字段进行正则表达式扫描,以查找与键盘记录器和 C2 相关的关键字。 **Windows 服务** — 枚举 `HKLM\SYSTEM\CurrentControlSet\Services` 并标记名称符合恶意模式的服务。 **WMI 订阅** — 查询 `wmic path __EventFilter` 以检测由事件触发的持久化,这是 Windows 上最隐蔽的持久化机制之一(绕过大多数 AV 扫描)。 ### 第 5 层 — 哈希检查器 (`hash_checker.py`) 对于被早期层标记的每个可执行文件: 1. 计算 SHA-256(流式处理,通过 64 KB 数据块处理大文件) 2. 对照本地 `HashDatabase` 进行检查(注入了已知的恶意哈希,可扩展) 3. 结果反馈到 VirusTotal 模块进行云端信誉检查 `HashDatabase` 类从 JSON 文件加载并支持实时更新 —— 可以直接接入威胁情报源。 ### 第 6 层 — VirusTotal 集成 (`virustotal_checker.py`) 完整的 **VirusTotal API v3** 集成,具备适当的速率限制处理: ``` # Verdict 层级: malicious > 0 → "MALICIOUS" (immediate CRITICAL alert) suspicious > 0 → "SUSPICIOUS" (HIGH alert) total > 0 → "CLEAN" else → "UNKNOWN" (not in VT database) # Rate limit 处理: HTTP 429 → automatic backoff + single retry Free tier: 4 requests/minute (15s delay between calls) ``` 可通过 `VT_API_KEY` 环境变量或 `config.py` 进行配置。在没有密钥时会优雅降级并禁用。 ### 第 7 层 — 无文件 / LotL 检测器 (`lolbin_detector.py`) 技术上最复杂的模块。涵盖 **23 个 LOLBins**(Living-off-the-land Binaries,就地取材型二进制文件),具有映射到 MITRE ATT&CK 技术 ID 的按二进制文件划分的正则参数签名:
完整的 LOLBin 覆盖表(点击展开) | 二进制文件 | MITRE ATT&CK | 检测到的关键滥用模式 | |---|---|---| | `powershell.exe` | T1059.001, T1027.010 | `-EncodedCommand`、`-WindowStyle Hidden`、`IEX`、`DownloadString`、`GetAsyncKeyState`、`SetWindowsHookEx` | | `pwsh.exe` | T1059.001 | 与 PowerShell 5 相同,外加跨平台恶意加载器 | | `cmd.exe` | T1059.003 | `/c` 中的远程 URL、脱字符混淆链、双跳执行 | | `certutil.exe` | T1105, T1027 | `-decode`、`-decodehex`、`-urlcache -f http://` | | `bitsadmin.exe` | T1197 | `/transfer`、`/addfile`、`/setnotifycmdline` | | `mshta.exe` | T1218.005 | 远程 HTA、`javascript:`、`vbscript:` URI | | `wscript.exe` | T1059.005 | `.vbs`、`.js`、`.jse`、远程 URL | | `cscript.exe` | T1059.005 | 同 wscript | | `regsvr32.exe` | T1218.010 | `/s /u`、`.sct` 文件、远程 scriptlet | | `rundll32.exe` | T1218.011 | `javascript:`、`url.dll,FileProtocolHandler`、`pcwutl.dll` | | `regasm.exe` | T1218.009 | DLL 注册绕过 | | `regsvcs.exe` | T1218.009 | COM+ 应用程序绕过 | | `installutil.exe` | T1218.004 | `/logfile=` 绕过、任意 .NET 执行 | | `msiexec.exe` | T1218.007 | 静默远程 MSI 安装 | | `cmstp.exe` | T1218.003 | 基于 INF 的 COM scriptlet 执行 | | `wmic.exe` | T1047, T1546.003 | `process call create`、WMI 持久化 | | `msbuild.exe` | T1127.001 | 通过 `.csproj` 执行内联 C# 任务 | | `csc.exe` | T1027.004 | 从临时路径即时编译恶意软件 | | `expand.exe` | T1105 | 从远程 URL 解压 CAB | | `forfiles.exe` | T1059.003 | 通过逐文件执行绕过 `cmd.exe` | | `esentutl.exe` | T1105 | VSS 卷影副本文件窃取 | | `replace.exe` | T1105 | UNC 路径文件操作 | | `bitsadmin.exe` | T1197 | 后台下载 + 通知回调执行 |
**`lolbin_detector.py` 中的八个检测子层:** ``` Sub-Layer 1 Live process cmdline scan → checks all 23 LOLBins running RIGHT NOW Sub-Layer 2 PowerShell Script Block log → Event ID 4104 (last 24h by default) Sub-Layer 3 Security / System event log → Event IDs 4688, 4698, 4702, 4720, 7045 Sub-Layer 4 AMSI / Defender event channel → Event IDs 1116, 1117 Sub-Layer 5 WMI subscription enumeration → __EventFilter + WmiPrvSE child detection Sub-Layer 6 Process chain analyser → 12 suspicious parent→child relationships Sub-Layer 7 Payload decoder (inline) → Base64 UTF-16-LE, UTF-8, hex decode Sub-Layer 8 LOLBin network correlation → flags LOLBins with live external connections ``` **Payload 解码器细节:** 自动提取、解码并重新扫描嵌入在命令行或脚本块中的 Base64(优先 UTF-16-LE —— PowerShell 的原生编码 —— 然后 UTF-8 和 latin-1 回退)和十六进制编码的 payload。包含 `GetAsyncKeyState`、`SetWindowsHookEx` 或 `VirtualAlloc` 的已解码 payload 会立即将该发现提升为 `CRITICAL`。 **进程链分析涵盖 12 种可疑关系:** ``` winword.exe → powershell.exe CRITICAL (T1566.001 — macro delivery) excel.exe → cmd.exe CRITICAL (T1566.001) outlook.exe → wscript.exe CRITICAL (T1566.001) wmiprvse.exe → powershell.exe CRITICAL (T1047 — WMI spawned interpreter) explorer.exe → regsvr32.exe HIGH (T1218.010) svchost.exe → mshta.exe HIGH (T1218.005) cmd.exe → certutil.exe HIGH (T1105) ... and 5 more ``` ### 警报引擎 (`alert_engine.py`) 所有模块的发现都会汇入 `AlertEngine`,该引擎将: - 分配唯一 ID(`ALT-0001`、`ALT-0002`…) - 附加按类别的修复指导 - 写入双重日志:人类可读的 `.log` + 机器可解析的 `.jsonl` - 导出结构化的 `scan_report.json` ``` { "alert_id": "ALT-0003", "category": "LotL", "severity": "CRITICAL", "detail": "[process_chain] powershell.exe — Unexpected chain: winword.exe → powershell.exe", "evidence": { "layer": "process_chain", "lolbin": "powershell.exe", "pid": 4821, "mitre_ids": ["T1566.001"], "parent_name": "winword.exe", "decoded_payload": "" }, "remediation": "Terminate the process and investigate the originating Office document.", "timestamp": "2026-06-08T11:42:07" } ``` ## 执行流程 ``` python main.py --scan │ ▼ Load config.py (paths, thresholds, API keys, whitelist) │ ├─── [1/7] Process Scanner ──────────── scan_processes() │ + Hook Detector detect_keyboard_hooks() │ ├─── [2/7] Registry Monitor ─────────── scan_registry() │ HKLM + HKCU Run keys │ ├─── [3/7] Startup Folder Checker ───── scan_startup_folders() │ .lnk resolution included │ ├─── [4/7] Persistence Detector ──────── scan_persistence() │ Tasks + Services + WMI │ ├─── [5/7] Hash Checker ─────────────── check_paths() │ SHA-256 against local DB │ ├─── [6/7] Fileless / LotL Scan ──────── scan_lolbins() │ 8 sub-layers, 23 LOLBins │ └─── [7/7] VirusTotal (optional) ──────── check_hash() if VT_API_KEY is set │ ▼ AlertEngine.ingest_*() ┌─────────────────────┐ │ Dedup + severity │ │ sort + remediation │ └─────────────────────┘ │ ┌───────────┴───────────┐ ▼ ▼ alerts.log scan_report.json alerts.log.jsonl (structured JSON) │ ▼ Console summary ════════════════════════════════════════ CRITICAL : 2 HIGH : 3 MEDIUM : 1 ════════════════════════════════════════ ``` ## 快速开始 ### 前置条件 ``` # 需要 Python 3.9+ python --version # 安装依赖 pip install psutil requests # 仅限 Windows(以获得完整功能集) # pip install pywin32 ``` ### 运行一次性扫描 ``` python main.py --scan ``` ### 实时监控(每 30 秒重新扫描一次) ``` python main.py --monitor --interval 30 ``` ### 启动 GUI 仪表板 ``` python main.py --gui ``` ### 使用 VirusTotal 云端查询 ``` # 设置你的免费 API key(virustotal.com → 注册 → API key) export VT_API_KEY="your_key_here" python main.py --scan ``` ### 运行测试套件 ``` python test_tool.py # Core module tests (18 tests) python test_lolbin_detector.py # LotL module tests (62 tests) ``` ### 打包为独立的 Windows EXE ``` pip install pyinstaller python build.py # → dist/KeyloggerDetectionTool.exe ``` ## GUI 仪表板 基于 Tkinter 的仪表板(`gui_dashboard.py`)提供: - 带有进度指示器的**实时扫描触发** - **严重程度摘要卡片**(Critical / High / Medium / Low 计数) - **可过滤的警报表** — 按严重程度级别或类别过滤 - **警报详细信息面板** — 点击查看完整的 JSON 证据 - 带有时间戳条目的**结构化日志查看器** - **报告 JSON 查看器** — 应用内查看原始的 scan_report.json - 报告的**加载 / 导出**按钮 深色主题,无外部 UI 依赖项 — 随标准 Python 一起提供。 ## 测试 涵盖 11 个测试类的 62 个测试,包含: ``` TestPayloadDecoder 8 tests — Base64 UTF-16-LE, UTF-8, hex decode TestSignatureTable 9 tests — LOLBin table integrity, regex correctness TestSeverityScoring 10 tests — All severity scoring paths TestDeduplication 6 tests — Near-duplicate collapsing logic TestNetworkHelper 4 tests — IP locality classification TestLotLFinding 6 tests — Dataclass serialisation + truncation TestLiveScan 5 tests — Mocked psutil process enumeration TestProcessChains 3 tests — Parent→child chain detection TestPSKeywords 4 tests — Keylogger API + download cradle regex TestScanLolbinsIntegration 3 tests — Full pipeline mock, sorting, dedup TestAlertEngineIntegration 3 tests — Alert ingestion, severity, evidence ``` 所有测试仅使用**模拟数据** — 没有真实的系统调用,不需要管理员权限,可在 Linux/macOS CI 上运行。 ## 配置 (`config.py`) 每个检测参数均可集中配置: ``` # 检测阈值 SUSPICIOUS_CPU_THRESHOLD = 40.0 # % sustained CPU to flag SUSPICIOUS_MEM_THRESHOLD = 200 # MB RSS to flag # 实时监控 MONITOR_INTERVAL_SEC = 30 # seconds between scan cycles # VirusTotal VIRUSTOTAL_API_KEY = os.environ.get("VT_API_KEY", "") # 进程 whitelist — 无论行为如何都不会被标记 PROCESS_WHITELIST = { "system", "smss.exe", "csrss.exe", "svchost.exe", "explorer.exe", "lsass.exe", ... } # 扫描的 Registry keys REGISTRY_RUN_KEYS = [ r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", r"SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce", ... ] ``` ## 示例输出 ``` [2026-06-08 11:42:07] [WARNING ] process_scanner — Flagged PID 4821 (updater.exe): Suspicious name pattern; Running from suspicious path [2026-06-08 11:42:08] [WARNING ] registry_monitor — Registry hit: HKCU\...\Run → Updater [2026-06-08 11:42:09] [WARNING ] lolbin_detector — [Layer 1] LOLBin detected: certutil.exe (PID 7734) [2026-06-08 11:42:09] [WARNING ] lolbin_detector — [Layer 6] Suspicious chain: winword.exe (PID 3012) → powershell.exe (PID 5580) ════════════════════════════════════════════════════ KEYLOGGER DETECTION TOOL — SCAN COMPLETE ════════════════════════════════════════════════════ Total alerts : 6 CRITICAL : 2 HIGH : 2 MEDIUM : 1 LOW : 1 ════════════════════════════════════════════════════ 🔴 [CRITICAL] LotL — [process_chain] powershell.exe — Unexpected chain: winword.exe → powershell.exe 🔴 [CRITICAL] Hash — Known-malicious file: C:\Temp\updater.exe [aabb1234...] 🟠 [HIGH] Process — Suspicious process: updater.exe (PID 4821) 🟠 [HIGH] LotL — [live_process] certutil.exe — -urlcache -split -f http:// 🟡 [MEDIUM] Registry — HKCU\...\Run → Updater — suspicious AppData path 🔵 [LOW] Startup — startup_helper.bat — suspicious script extension ``` ## 未来路线图 以下功能已规划或正在积极开发中,按检测影响力和市场空白程度排序: ### 第 1 阶段 — 核心检测升级 #### v1.1 — AI 行为引擎 使用经过训练的 **Isolation Forest** 模型替换基于阈值的进程评分。该模型将学习 API 调用序列、钩子安装率和剪贴板访问频率的“正常”基线,然后标记统计异常值 —— 从而捕获**没有已知签名的零日键盘记录器**。 ``` Feature vector per 60-second window: - SetWindowsHookEx call rate - GetAsyncKeyState call frequency - Clipboard access count - Foreign DLL injection attempts - Low-level keyboard event rate - Outbound connection count from hook-owning process ``` 无需标记的训练数据 — Isolation Forest 是一种**无监督异常检测器**(scikit-learn,约 15 行模型代码)。 #### v1.2 — 内存扫描器 通过 `ctypes` 使用 `VirtualQueryEx` + `ReadProcessMemory` 遍历进程 VAD(Virtual Address Descriptor,虚拟地址描述符)区域。标记: - `MEM_COMMIT | PAGE_READWRITE` 区域 > 4 KB(经典的 shellcode 特征) - 嵌入在堆中的 PE 头(进程空洞化 / 反射式 DLL 注入) - 匿名可执行区域中的 XOR 解密存根 这就是企业级 EDR 工具会做,而免费工具几乎从不实现的功能。 #### v1.3 — 网络窃取检测器 将具有键盘钩子的进程与其活动的网络连接进行交叉比对。标记: - 拥有活跃外部 TCP 连接的钩子进程(潜在的 C2) - 小型的周期性 HTTPS POST 突发(典型的键盘记录上传模式) - 具有高熵子域名的 DNS 查询(DNS 隧道数据外传) - 目标 IP 与 abuse.ch 威胁情报源交叉比对(免费 API) ### 第 2 阶段 — 分析师工作流 #### v1.4 — MITRE ATT&CK 映射器 每个警报都将携带结构化的 ATT&CK 技术 ID、名称以及指向 `attack.mitre.org` 的直接链接。示例: ``` "mitre": { "technique_id": "T1056.001", "technique_name": "Input Capture: Keylogging", "tactic": "Credential Access", "url": "https://attack.mitre.org/techniques/T1056/001/" } ``` 这一新增功能使该工具能够立即在以 ATT&CK 为通用语言的企业级 SOC 工作流中使用。 #### v1.5 — 攻击时间轴构建器 将滑动时间窗口内的警报关联到可视化的杀伤链阶段: ``` Initial Access → Execution → Persistence → Defense Evasion → Credential Access → Exfiltration │ │ │ │ │ │ outlook.exe powershell HKCU\Run -WindowStyle GetAsyncKey HTTP POST (email open) -enc AAAA= [Updater] Hidden State poll 185.x.x.x 11:41:03 11:41:09 11:41:15 11:41:15 11:41:22 11:41:58 ``` 在 GUI 和 HTML 报告中渲染为 SVG 泳道图。 #### v1.6 — PDF/HTML 取证报告 一键导出包含以下内容的专业取证报告: - 带有风险评级的高管摘要 - 严重程度环形图 - 按时间排列的警报时间轴 - IOC 列表(哈希、IP、注册表路径、文件路径) - 针对每个警报的修复手册 - 可与非技术干系人共享 技术栈:Jinja2 模板 → HTML → WeasyPrint → PDF。 ### 第 3 阶段 — 集成与拓展 #### v1.7 — 实时推送通知 即时将警报发送至: - **Telegram Bot** — 免费,无需服务器,可在移动端使用 - **Slack Webhook** — 企业工作流集成 - **Email SMTP** — 适用于没有通讯应用的环境 通知格式: ``` 🔴 CRITICAL — [Flow-to-Flow] Category: LotL / Process Chain Detail: winword.exe → powershell.exe (PID 5580) MITRE: T1566.001 — Spearphishing Attachment Time: 2026-06-08 11:42:09 UTC Host: DESKTOP-ABC123 ``` #### v1.8 — 诱饵击键陷阱(蜜罐模式) 植入一个包含合成凭据字符串的隐藏 Windows 输入字段。任何轮询 `GetForegroundWindow` + `GetAsyncKeyState` 的键盘记录器都会收集此伪造凭据。一个 Canary 服务会监控出站流量中是否包含此凭据字符串 — 如果被发现,将立即触发 `CRITICAL` 警报,且**零误报**。 这是一种在任何当前开源安全工具中都找不到的原创检测原语。 #### v1.9 — SIEM 集成 JSON-lines 日志格式已兼容 SIEM。计划原生集成: - **Elastic Stack** — 预构建的索引模板 + Kibana 仪表板 - **Splunk** — forwarder 配置 + 搜索宏 - **Wazuh** — 主动响应规则 #### v2.0 — 代理模式 + 中央仪表板 将 Flow-to-Flow 作为轻量级后台服务(Windows Service 包装器)部署在多个端点上。中央 Flask 仪表板实时聚合来自所有代理的警报 — 让小型安全团队无需承受企业级 EDR 的定价,即可获得**集群级别的可见性**。 ## 贡献 欢迎在各个领域做出贡献: - **新的 LOLBin 签名** — 添加到 `lolbin_detector.py` 的 `LOLBINS` 字典中 - **签名更新** — 添加到 `signatures/suspicious_names.txt` - **新的检测模块** — 遵循 `scan_*() → List[Finding]` 模式 - **测试覆盖率** — 所有 PR 都应包含带有模拟数据的单元测试 - **平台支持** — 为非 Windows 层提供 Linux/macOS 支持 在进行大型 PR 之前,请先创建一个 issue。所有检测逻辑必须是**纯防御性的** — 本项目只检测威胁,不制造威胁。 ## 法律与道德使用 Flow-to-Flow 专为**防御性安全**目的而设计: - 在您**拥有或获得明确书面授权**进行监控的系统上检测威胁 - 在授权的实验室环境中进行安全研究、恶意软件分析和威胁狩猎 - 在网络安全课程和 CTF 练习中用于教育目的 **未经授权,请勿在系统上使用此工具。** 在几乎所有司法管辖区,未经授权访问计算机系统都是非法的。作者对滥用行为不承担任何责任。 ## 许可证 MIT 许可证 — 详见 `LICENSE`。 ## 致谢 检测逻辑参考了以下来源: - [LOLBAS 项目](https://lolbas-project.github.io/) — Living Off The Land Binaries and Scripts (就地取材型二进制文件和脚本) - [MITRE ATT&CK](https://attack.mitre.org/) — Adversarial Tactics, Techniques & Common Knowledge (对抗战术、技术和常识) - [VirusTotal](https://www.virustotal.com/) — 文件和 URL 信誉服务 - [abuse.ch](https://abuse.ch/) — 威胁情报源 **为安全社区而生。由 Abhijeet P M 构建。** *如果此工具帮助您捕获了真实的威胁,请创建一个 issue 并分享它。* *这就是签名变得更好的方式。* ⭐ 如果您觉得它有用,请给此仓库点赞 — 这有助于其他防御者发现它。
标签:Python, 威胁情报, 开发者工具, 无后门, 知识库安全, 端点检测与响应(EDR), 逆向工具