Himanshu-0726/WatchDog

GitHub: Himanshu-0726/WatchDog

WatchDog 通过部署诱饵金丝雀文件,在文件被未授权打开时自动采集系统与环境信息并向 Discord、Telegram 或邮件推送告警,帮助用户及时发现入侵行为。

Stars: 19 | Forks: 1

# WatchDog - 安全金丝雀工具 ![Python](https://img.shields.io/badge/Python-3.8+-blue.svg) ![License](https://img.shields.io/badge/License-MIT-green.svg) ![Platform](https://img.shields.io/badge/Platform-Windows%20%7C%20Linux%20%7C%20macOS-lightgrey.svg) ![Status](https://img.shields.io/badge/Status-Active-brightgreen.svg) **仅供授权使用的防御性安全金丝雀/触发式预警工具。** ## 什么是 WatchDog? WatchDog 是一款**防御性安全工具**,可帮助您检测对您计算机的未经授权访问。它通过创建“金丝雀文件”(诱饵文件)来工作——当有人打开这些文件时,它们会向您发出警报。 ``` ┌─────────────────────────────────────────────────────────────┐ │ HOW IT WORKS │ ├─────────────────────────────────────────────────────────────┤ │ │ │ 1. You create a canary file (e.g., "passwords.txt") │ │ 2. You place it on your system │ │ 3. Someone opens the file │ │ 4. WatchDog collects system info │ │ 5. You get an alert via Discord/Telegram/Email │ │ │ └─────────────────────────────────────────────────────────────┘ ``` ## 快速开始 ### 步骤 1:安装 ``` # Clone repository git clone https://github.com/Himanshu-0726/WatchDog.git cd watchdog # 安装依赖 pip install -r requirements.txt ``` ### 步骤 2:设置(30秒) ``` # 快速设置 - 仅 Discord 或 Telegram python watchdog.py setup ``` 这仅会询问: 1. 您希望通过何种方式接收警报?(Discord/Telegram/两者皆可) 2. 粘贴您的 webhook URL ### 步骤 3:部署 ``` # 创建并部署到桌面 python watchdog.py deploy --location desktop ``` 大功告成!当有人打开该文件时,您就会收到警报。 ### 其他命令 ``` python watchdog.py test # Send test alert python watchdog.py status # View alerts python watchdog.py advanced # Full setup wizard (geofencing, threat intel, etc.) ``` 当有人打开文件时,您将收到如下警报: ``` WatchDog Alert - Canary File Opened Hostname: JOHNS-PC Username: JohnDoe Public IP: 203.0.113.45 OS: Windows 11 WiFi Network: HomeNetwork Geolocation: New York, United States ``` ## 功能
### 通知 - Discord webhooks - Telegram bots - 邮件 (SMTP) - 本地 SQLite 日志记录 ### 检测 - 系统指纹识别 - 地理围栏 - 威胁情报 - VPN/代理/Tor 检测
### 安全 - 文件完整性校验 - 进程监控 - 事件管理 - 加密支持 ### 内容 - 诱饵文件生成器 - Honeytokens - DNS 金丝雀 - 网络指纹识别
## 使用示例 ### 示例 1:保护您的密码 ``` # 创建一个打开时会发出警报的虚假密码文件 python build/build.py --type bat --name passwords --decoy passwords # 输出: # [+] 已创建:build\passwords.bat # [+] 已创建诱饵:build\passwords.txt # [+] 完整性 hash 已保存到 config ``` ### 示例 2:监控财务文档 ``` # 为财务记录创建 canary python build/build.py --type ps1 --name tax_returns --decoy financial ``` ### 示例 3:创建多个金丝雀 ``` # 创建 BAT 和 PS1 两个版本 python build/build.py --type all --name secret_document --decoy documents ``` ### 示例 4:检查 DNS 金丝雀 ``` # 检查是否有 DNS canary 被触发 python sentinel.py --dns-check ``` ## 配置 ### 基础配置 编辑 `config.yaml`: ``` # 通知 notifications: discord: enabled: true webhook_url: "https://discord.com/api/webhooks/YOUR_WEBHOOK" telegram: enabled: false bot_token: "" chat_id: "" # 加密 encryption: enabled: false key: "" # Rate limiting(警报之间的分钟数) rate_limit: 5 ``` ### 高级配置 ``` # Geofencing - 仅对意外位置发出警报 geofencing: enabled: true allowed_countries: ["US", "CA", "GB"] blocked_countries: [] allowed_ips: ["203.0.113.0/24"] # Threat Intelligence threat_intel: enabled: true virustotal_api_key: "YOUR_API_KEY" abuseipdb_api_key: "YOUR_API_KEY" # Process Monitoring process_monitor: enabled: true # SMTP 电子邮件报告 smtp: enabled: false server: "smtp.gmail.com" port: 587 username: "" password: "" from_email: "" to_emails: [] ``` ## 诱饵类型 | 类型 | 描述 | 示例内容 | |------|-------------|-----------------| | `passwords` | 虚假密码列表 | 电子邮件、银行、WiFi 密码 | | `financial` | 虚假财务记录 | 银行账户、信用卡、税务信息 | | `credentials` | 虚假服务器凭证 | SSH keys、API keys、数据库密码 | | `crypto` | 虚假加密钱包 | Bitcoin、Ethereum、助记词 | | `personal` | 虚假个人笔记 | 旅行计划、医疗信息 | | `documents` | 虚假文档索引 | 文件哈希、文档列表 | ## 项目结构 ``` watchdog/ ├── watchdog.py # Simple CLI entry point (START HERE) ├── sentinel.py # Main script (runs when canary is opened) ├── config.yaml # Configuration file ├── installer.py # Advanced setup wizard ├── build/ │ └── build.py # Creates canary files ├── config/ │ └── suspicious_processes.json # Process detection signatures ├── modules/ │ ├── fingerprint.py # System info collection │ ├── notifier.py # Discord/Telegram alerts │ ├── crypto.py # Encryption │ ├── logger.py # SQLite logging │ ├── decoy.py # Decoy content generator │ ├── geofencing.py # Location filtering │ ├── threatintel.py # Threat intelligence │ ├── incidents.py # Incident management │ ├── process_monitor.py # Process detection │ ├── honeytokens.py # Credential honeytokens │ ├── reports.py # Email reports │ ├── network_fingerprint.py # VPN/proxy detection │ └── dns_canary.py # DNS hijacking detection ├── DISCLAIMER.md # Authorized use guidelines ├── SECURITY.md # Security policy ├── LICENSE # MIT License └── requirements.txt # Python dependencies ``` ## 管理 ### 查看警报 ``` # 查看警报计数 python -c "from modules.logger import Logger; l = Logger(); print(f'Alerts: {l.get_alert_count()}')" # 查看最近警报 python -c "from modules.logger import Logger; l = Logger(); [print(f'[{a[\"id\"]}] {a[\"timestamp\"]} - {a[\"username\"]}@{a[\"hostname\"]}') for a in l.get_alerts(5)]" ``` ### 管理事件 ``` # 查看事件统计 python -c "from modules.incidents import IncidentManager; im = IncidentManager(); print(im.get_incident_stats())" ``` ### 创建 Honeytokens ``` # 创建虚假 AWS key honeytoken python -c "from modules.honeytokens import HoneytokenManager; hm = HoneytokenManager(); print(hm.generate_token('aws_key', 'Production AWS'))" ``` ## 收集的数据 当金丝雀文件被打开时,WatchDog 会收集: | 数据 | 用途 | |------|---------| | 主机名 | 识别哪台计算机被访问 | | 用户名 | 识别谁登录了系统 | | 公共 IP | 网络位置 | | 私有 IP | 本地网络信息 | | MAC 地址 | 设备标识符 | | OS 详情 | 操作系统版本 | | WiFi 网络 | 网络名称 (SSID) | | 地理位置 | 国家、城市、ISP | | 进程 | 正在运行的应用程序 | | 威胁评分 | 恶意 IP 检测 | ## 安全 - **文件完整性**:检测金丝雀文件是否被篡改 - **地理围栏**:仅针对异常位置发出警报 - **加密**:可选的警报数据加密 - **速率限制**:防止警报垃圾信息轰炸 - **本地存储**:数据始终保留在您的系统上 详情请参阅 [SECURITY.md](SECURITY.md)。 ## 常见问题 **问:这是恶意软件吗?** 答:不是。WatchDog 是一款用于监控您自己系统的防御性安全工具。请参阅 [DISCLAIMER.md](DISCLAIMER.md)。 **问:这会导致我的 GitHub 账号被封禁吗?** 答:不会。WatchDog 是一款合法的安全工具,拥有完善的文档和授权使用指南。 **问:我可以在我不拥有的系统上使用它吗?** 答:不可以。这是被禁止且违法的。 **问:它可以在 Mac/Linux 上运行吗?** 答:可以。WatchDog 是跨平台的。 ## 许可证 MIT 许可证 - 请参阅 [LICENSE](LICENSE) ## 免责声明 本软件仅供**授权的安全监控**使用。用户有责任遵守所有适用法律。完整详情请参阅 [DISCLAIMER.md](DISCLAIMER.md)。
标签:Python, StruQ, 威胁情报, 开发者工具, 无后门, 蜜罐, 证书利用, 逆向工具