Ramkumar2545/threat-hunt-browser

GitHub: Ramkumar2545/threat-hunt-browser

实时监控跨平台浏览器历史记录,结合威胁情报自动检测恶意URL,以提升企业端点安全防护能力。

Stars: 0 | Forks: 0

# 浏览器威胁狩猎工具 每 **1 分钟**静默读取 Chrome、Firefox、Edge 和 Brave 的浏览器历史记录。每个 URL 被记录为结构化 JSON 事件,由 **Wazuh 代理**捕获,并通过 **OpenCTI** 威胁情报实时增强——一旦用户访问已知恶意域,即触发警报。 ## 一键安装 ### Linux(以 root 身份) ``` sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ramkumar2545/threat-hunt-browser/main/install-linux.sh)" ``` ### macOS(以 root 身份) ``` sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ramkumar2545/threat-hunt-browser/main/install-macos.sh)" ``` ### Windows(管理员 PowerShell) ``` # 步骤一 — 清除旧缓存副本并从 GitHub 下载最新版本 Remove-Item "$env:TEMP\install-windows.ps1" -Force -ErrorAction SilentlyContinue Invoke-RestMethod -Uri "https://raw.githubusercontent.com/Ramkumar2545/threat-hunt-browser/main/install-windows.ps1" -OutFile "$env:TEMP\install-windows.ps1" # 步骤二 — 从磁盘运行 Set-ExecutionPolicy Bypass -Scope Process -Force & "$env:TEMP\install-windows.ps1" ``` ## 一键卸载 ### Linux(以 root 身份运行) ``` sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ramkumar2545/threat-hunt-browser/main/uninstall-linux.sh)" ``` 自动移除的内容: - **定时任务:** `/etc/cron.d/threat-hunt-browser` - **安装目录:** `/opt/threat-hunt-browser/`(采集器 + 监视器脚本) - **日志:** `/var/log/threat-hunt-browser/` - **Wazuh 配置:** 安全地从 `/var/ossec/etc/ossec.conf` 中移除 `` 代码块 - **服务重启:** 自动重启 `wazuh-agent` *(无需手动重启)* ### macOS(以 root 身份运行) ``` sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/Ramkumar2545/threat-hunt-browser/main/uninstall-macos.sh)" ``` 自动移除的内容: - **启动守护进程:** `/Library/LaunchDaemons/com.itfortress.threathuntbrowser.plist` - **安装目录:** `/opt/threat-hunt-browser/` - **日志:** `/var/log/threat-hunt-browser/` - **Wazuh 配置:** 安全地从 `/Library/Ossec/etc/ossec.conf` 中移除 `` 代码块 - **服务重启:** 通过 `launchctl` 重启 `com.wazuh.agent` *(无需手动重启)* ### Windows(管理员 PowerShell) ``` # 步骤一 — 清除旧缓存副本并从 GitHub 下载最新版本 Remove-Item "$env:TEMP\install-windows.ps1" -Force -ErrorAction SilentlyContinue Invoke-RestMethod -Uri "https://raw.githubusercontent.com/Ramkumar2545/threat-hunt-browser/main/install-windows.ps1" -OutFile "$env:TEMP\install-windows.ps1" # 步骤二 — 使用 -Uninstall 标志运行 Set-ExecutionPolicy Bypass -Scope Process -Force & "$env:TEMP\install-windows.ps1" -Uninstall ``` 自动移除的内容: - **计划任务:** `ThreatHuntBrowser` - **安装目录:** `C:\ThreatHuntBrowser\`(采集器、`sqlite3.exe`、所有日志) - **Wazuh 配置:** 安全地从 `C:\Program Files (x86)\ossec-agent\ossec.conf` 中移除 `` 代码块 - **服务重启:** 对 `WazuhSvc` 执行健壮的停止-终止-启动序列 *(无需手动重启)* ## 架构 ``` +---------------------------------------------------------------------+ | ENDPOINT (Linux / Windows / macOS) | | | | Browser SQLite DBs --> browser_collector (bash/ps1, no Python) | | | | | v | | /var/log/threat-hunt-browser/browser_history.log (JSON) | | | | | v | | Wazuh Agent (localfile, log_format json) | +---------------------------------------------------------------------+ | v (encrypted) +---------------------------------------------------------------------+ | WAZUH MANAGER | | | | Rules: threat_hunt_browser_rules.xml (902000-902020) | | | | | v | | Active Response / Integrations | +---------------------------------------------------------------------+ | v +---------------------------------------------------------------------+ | THREAT INTELLIGENCE | | | | OpenCTI <--> MISP <--> AbuseIPDB <--> AlienVault OTX | | | | Indicators: Domains, URLs, IPs, File Hashes | +---------------------------------------------------------------------+ ``` ## 仓库结构 ``` threat-hunt-browser/ ├── install-linux.sh One-click Linux installer ├── install-macos.sh One-click macOS installer ├── install-windows.ps1 One-click Windows installer ├── install.sh Generic quick-install wrapper ├── install.ps1 Generic quick-install wrapper (Windows) ├── uninstall-linux.sh One-click Linux uninstaller ├── uninstall-macos.sh One-click macOS uninstaller ├── uninstall-windows.ps1 One-click Windows uninstaller ├── scripts/ │ ├── browser_collector.py DEPRECATED stub (do not run directly) │ ├── browser_collector.ps1 DEPRECATED stub (do not run directly) │ ├── linux/ │ │ ├── browser_collector.sh Linux SQLite collector (bash, no Python) │ │ └── watcher.sh inotifywait real-time trigger │ ├── macos/ │ │ └── browser_collector.sh macOS SQLite collector (bash, no Python) │ └── windows/ │ ├── browser_collector.ps1 Windows PowerShell SQLite collector │ └── realtime_watcher.ps1 FileSystemWatcher real-time trigger ├── wazuh/ │ ├── config/ │ │ ├── agent-linux.conf │ │ ├── agent-macos.conf │ │ ├── agent-windows.conf │ │ ├── ossec_agent_linux.conf │ │ ├── ossec_agent_windows.conf │ │ └── ossec_manager_integration.conf │ └── rules/ │ └── threat_hunt_browser_rules.xml └── README.md ``` ## Wazuh 规则 ID 下面的规则 ID 与 `wazuh/rules/threat_hunt_browser_rules.xml` 中部署的内容完全匹配。 | 规则 ID | 级别 | 触发条件 | 描述 | |---------|------|----------|------| | 902000 | 3 | `integration=browser-threat-hunt` + `event_type=browser_visit` | 基础浏览器访问(任意平台) | | 902001 | 3 | 902000 + `platform=linux` | 浏览器访问 — Linux 端点 | | 902002 | 3 | 902000 + `platform=windows` | 浏览器访问 — Windows 端点 | | 902003 | 3 | 902000 + `platform=macos` | 浏览器访问 — macOS 端点 | | 902010 | 12 | OpenCTI 增强 + `source.rule_id` 匹配 902001/902002/902003 | 检测到恶意 URL/域(基础) | | 902011 | 13 | 902010 + `source.rule_id=902001` | 恶意 — Linux 端点 | | 902012 | 13 | 902010 + `source.rule_id=902002` | 恶意 — Windows 端点 | | 902013 | 13 | 902010 + `source.rule_id=902003` | 恶意 — macOS 端点 | | 902020 | 7 | OpenCTI `observable_with_related_indicator`(中等置信度) | 可疑 URL/域 | ## Wazuh 管理器设置 ### 1. 部署规则 将 `wazuh/rules/threat_hunt_browser_rules.xml` 复制到: ``` /var/ossec/etc/rules/threat_hunt_browser_rules.xml ``` ### 2. 配置 Wazuh 代理 `ossec.conf` 安装程序会自动修补 `ossec.conf`。如果需要手动操作,请在 `` 内添加以下代码块并重启代理。 **Linux / macOS** (`/var/ossec/etc/ossec.conf` 或 `/Library/Ossec/etc/ossec.conf`): ``` json /var/log/threat-hunt-browser/browser_history.log ``` **Windows** (`C:\Program Files (x86)\ossec-agent\ossec.conf`): ``` json C:\ThreatHuntBrowser\logs\browser_history.log ``` 然后重启代理: ``` # Linux / macOS systemctl restart wazuh-agent # Windows (管理员 PowerShell) Restart-Service -Name WazuhSvc ``` ### 3. 重启 Wazuh 管理器(部署规则后) ``` systemctl restart wazuh-manager ``` ## 验证采集器工作正常 ``` # Linux — 强制手动运行 sudo bash /opt/threat-hunt-browser/browser_collector.sh # 检查日志是否正在写入 tail -f /var/log/threat-hunt-browser/browser_history.log # 检查 cron 是否每分钟运行 tail -f /var/log/threat-hunt-browser/cron.log ``` ``` # Windows — 强制手动运行 & "C:\ThreatHuntBrowser\browser_collector.ps1" # 检查日志 Get-Content 'C:\ThreatHuntBrowser\logs\browser_history.log' -Tail 20 -Wait ``` ## 兼容性 | 浏览器 | Linux | macOS | Windows | 备注 | |--------|-------|-------|---------|------| | Chrome | ✅ | ✅ | ✅ | | | Firefox| ✅ | ✅ | ✅ | | | Edge | ✅ | ✅ | ✅ | | | Brave | ✅ | ✅ | ✅ | | | Opera | ❌ | ❌ | ❌ | 不支持 — 使用尚未实现的自定义配置文件路径 | | Vivaldi| ❌ | ❌ | ❌ | 不支持 — 使用尚未实现的自定义配置文件路径 | ## 支持的平台 | 步骤 | Linux | macOS | Windows | |------|-------|-------|---------| | 安装 | `install-linux.sh` | `install-macos.sh` | `install-windows.ps1` | | 采集 | `scripts/linux/browser_collector.sh` | `scripts/macos/browser_collector.sh` | `scripts/windows/browser_collector.ps1` | | 实时触发 | `watcher.sh` (inotifywait) | cron 回退(60 秒) | `realtime_watcher.ps1` (FileSystemWatcher) | | 调度 | cron.d(每 1 分钟) | LaunchDaemon(60 秒) | 任务计划程序(1 分钟) | | 日志 | `/var/log/threat-hunt-browser/` | `/var/log/threat-hunt-browser/` | `C:\ThreatHuntBrowser\logs\` | | 卸载 | `uninstall-linux.sh` | `uninstall-macos.sh` | `install-windows.ps1 -Uninstall` | ## 各卸载程序移除内容 | 组件 | Linux | macOS | Windows | |------|-------|-------|---------| | 采集器脚本 | `/opt/threat-hunt-browser/` | `/opt/threat-hunt-browser/` | `C:\ThreatHuntBrowser\` | | 日志 | `/var/log/threat-hunt-browser/` | `/var/log/threat-hunt-browser/` | `C:\ThreatHuntBrowser\logs\` | | 调度器 | `/etc/cron.d/threat-hunt-browser` | `/Library/LaunchDaemons/*.plist` | 计划任务 | | ossec.conf 代码块 | `` 移除(自动) | `` 移除(自动) | `` 移除(自动) | | 代理重启 | `systemctl restart wazuh-agent` | `launchctl stop/start com.wazuh.agent` | 健壮的 WazuhSvc 重启 | ## 许可证 MIT 许可证 — Ram Kumar G (IT Fortress)
标签:AI合规, ETW劫持, OpenCTI威胁情报, Wazuh SIEM, 卸载工具, 威胁hunting, 威胁情报集成, 安全警报, 安装脚本, 实时威胁检测, 应用安全, 恶意URL检测, 恶意域名监控, 日志记录, 浏览器历史监控, 端点监控, 结构化日志, 网络安全, 跨平台端点安全, 隐私保护