dsixta/brute_force_detector

GitHub: dsixta/brute_force_detector

一款通过分析认证日志检测SSH/RDP多种暴力破解攻击模式的Python工具,支持MITRE ATT&CK映射和防火墙脚本生成。

Stars: 0 | Forks: 0

# 暴力破解检测器 一个用于通过分析身份验证日志来检测 SSH 和 RDP 暴力破解攻击的 Python 工具。深入分析登录攻击模式——远超一般的事件日志分析——涵盖 MITRE ATT&CK、防火墙封锁脚本生成以及实时监控。 ## 功能特性 - **暴力破解检测** (T1110.001) — 针对单个 IP 的滑动窗口分析 - **撞库攻击检测** (T1110.004) — 单个 IP 尝试大量用户名 - **密码喷洒检测** (T1110.003) — 大量 IP 攻击同一个账户 - **分布式攻击检测** (T1110) — 协同的“慢速隐蔽”攻击 - **失陷指标** (T1078) — 失败后登录成功(严重告警) - **攻击情报** — 反向 DNS、本地黑名单交叉引用、置信度评分 - **防火墙封锁脚本** — 生成可直接运行的 iptables (Linux) 或 netsh (Windows) 脚本 - **实时监控** — tail 模式下越过阈值时立即告警 - **CSV/TXT 报告** — 可导出用于事件工单或进一步分析 ## 使用方法 ``` # 演示模式 — 无需日志,可在任何地方运行 python brute_force_detector.py --demo # 分析真实日志文件 python brute_force_detector.py --logfile /var/log/auth.log # 过去 48 小时,降低阈值 python brute_force_detector.py --logfile /var/log/auth.log --hours 48 --threshold 3 # 保存报告 python brute_force_detector.py --logfile auth.log --output report.csv # 导出防火墙拦截脚本 python brute_force_detector.py --logfile auth.log --export-blocklist block.sh # Linux iptables python brute_force_detector.py --logfile auth.log --export-blocklist block.bat # Windows netsh # 实时监控 python brute_force_detector.py --logfile /var/log/auth.log --watch ``` ## 检测到的攻击模式 | 模式 | MITRE ID | 描述 | |---------|----------|-------------| | 暴力破解 | T1110.001 | 单个 IP 在时间窗口内超过失败登录阈值 | | 撞库攻击 | T1110.004 | 单个 IP 尝试许多不同的用户名 | | 密码喷洒 | T1110.003 | 大量 IP 针对同一账户 | | 分布式攻击 | T1110 | 多个 IP 协同攻击且低于单 IP 阈值 | | 失陷指标 | T1078 | 之前的失败尝试后出现成功登录 | ## 日志来源 | 平台 | 来源 | |----------|--------| | Debian/Ubuntu | `/var/log/auth.log` | | RHEL/CentOS | `/var/log/secure` | | Windows | Security Event Log (IDs 4624, 4625, 4648) via pywin32 | | 任意 | 通过 `--logfile` 指定自定义文件 | ## 安装 ``` git clone https://github.com/dsixta/brute_force_detector.git cd brute_force_detector # 立即运行演示 python brute_force_detector.py --demo # 可选依赖 pip install -r requirements.txt ``` ## 系统要求 - Python 3.8+ - 无必需依赖 - 可选:`pywin32` (Windows Event Log)、`colorama` (彩色输出) ## 展示的技能 - SSH/RDP 攻击模式识别 (CompTIA Security+) - MITRE ATT&CK 框架应用 - 日志解析与威胁检测算法 - 事件响应工作流 - 防火墙规则生成 (Linux iptables, Windows netsh) - 实时日志监控
标签:Cloudflare, Conpot, DInvoke, iptables, Linux运维, Log Parser, MITRE ATT&CK, netsh, Python, RDP安全, SSH安全, Windows安全, WSL, 免杀技术, 凭证滥用, 分布式攻击, 威胁情报, 密码喷洒, 开发者工具, 异常检测, 撞库检测, 无后门, 暴力破解检测, 红队行动, 网络安全, 防火墙集成, 隐私保护