MikeUchiha122/agente-ciberseguridad
GitHub: MikeUchiha122/agente-ciberseguridad
一个基于 Claude AI 的自动化威胁情报分析工具,能够对 IP、域名、哈希、URL 进行多源聚合分析并生成双语风险报告。
Stars: 0 | Forks: 0
# 🔐 网络安全智能体 v3.0
[](https://github.com/MikeUchiha122/agente-ciberseguridad/actions/workflows/tests.yml)



[](https://mikeuchiha122.github.io/agente-ciberseguridad/)
**作者:** Miguel Ángel Ramírez Galicia — [@MikeUchiha122](https://github.com/MikeUchiha122)
## 这是什么?
用于网络安全分析的人工智能智能体。给定一个 IP、域名、哈希或 URL,该智能体会自主查询多个安全来源,对结果进行推理并生成完整的报告——包括面向任何人的通俗语言解释。
它还允许**在输入个人数据之前验证页面是否安全**,检测钓鱼、域名仿冒、可疑证书和恶意重定向。
```
Tú escribes: 45.33.32.156
El agente: Consulta 6 fuentes → Razona → Genera reporte
Resultado: 🔴 ALTO RIESGO — IP asociada a ataques SSH en 47 países
```
## 它是如何工作的?
该智能体使用 **ReAct** 模式(推理 → 行动 → 观察 → 重复):
```
Tu input
↓
[Claude AI] → "Necesito verificar esta IP"
↓
[VirusTotal] + [AbuseIPDB] + [IPInfo] ← corre en paralelo
↓
[Claude AI] → "Necesito más contexto"
↓
[WHOIS] + [CVE/NVD]
↓
[Claude AI] → "Tengo suficiente información"
↓
Reporte técnico + Resumen para todos + Nivel de riesgo
```
## 集成工具
| 工具 | 分析内容 | API Key |
|-------------|-------------|---------|
| 🦠 **VirusTotal** | 针对 90+ 款杀毒软件检查 IP、域名、哈希或 URL | 必需(免费) |
| 🚨 **AbuseIPDB** | IP 的滥用报告历史 | 必需(免费) |
| 🌍 **IPInfo** | 地理定位、ISP、是否为 VPN 或 Tor | 不需要 |
| 🔍 **NIST NVD** | 按软件查询已知漏洞 | 不需要 |
| 📋 **WHOIS/RDAP** | 域名注册信息及年龄 | 不需要 |
| 🗺️ **子域名** | 通过 Certificate Transparency 被动映射 | 不需要 |
| 🔒 **SSL/TLS** | 证书的有效性和使用年限 | 不需要 |
| 🎣 **反钓鱼** | URL 结构中的欺诈模式 | 不需要 |
| ↪️ **重定向** | 缩短或可疑 URL 的真实目的地 | 不需要 |
## 安装
### 前置条件
- Python 3.12 或更高版本
- 一个 [Anthropic](https://console.anthropic.com) 账户(需要银行卡)
- 一个 [VirusTotal](https://virustotal.com) 账户(免费)
- 一个 [AbuseIPDB](https://abuseipdb.com) 账户(免费)
### 步骤 1 — 克隆仓库
```
git clone https://github.com/MikeUchiha122/agente-ciberseguridad.git
cd agente-ciberseguridad
```
### 步骤 2 — 安装依赖
```
pip install anthropic requests python-dotenv
```
### 步骤 3 — 配置 API keys
在项目根目录下创建一个 `.env` 文件,内容如下:
```
ANTHROPIC_API_KEY=sk-ant-api03-TU-KEY-AQUI
VIRUSTOTAL_API_KEY=TU-KEY-AQUI
ABUSEIPDB_API_KEY=TU-KEY-AQUI
```
在这里获取你的 API keys:
- **Anthropic:** [console.anthropic.com](https://console.anthropic.com) → API Keys
- **VirusTotal:** [virustotal.com](https://virustotal.com) → 你的头像 → API key
- **AbuseIPDB:** [abuseipdb.com](https://abuseipdb.com) → Account → API
### 步骤 4 — 运行
```
python agente.py
```
## 使用方法
启动后你会看到主菜单:
```
╔══════════════════════════════════════════════════════╗
║ 🔐 AGENTE DE CIBERSEGURIDAD v3.0 🔐 ║
╠══════════════════════════════════════════════════════╣
║ [1] Analizar un target (IP, dominio, hash) ║
║ [2] Verificar URL antes de ingresar datos ║
║ [3] Ver historial de análisis ║
║ [4] Salir ║
╚══════════════════════════════════════════════════════╝
```
### 选项 1 — 分析目标
输入以下任意格式:
```
IP → 8.8.8.8
Dominio → ejemplo.com
Hash → d41d8cd98f00b204e9800998ecf8427e
```
### 选项 2 — 在输入数据前验证 URL
粘贴你想在输入密码或个人数据之前检查的 URL:
```
https://bbva-login-seguro-verificar.com/acceso
paypal-account-verify.tk
http://sitio-que-me-mandaron.com
```
智能体会给出明确的判定:
```
━━━ VEREDICTO FINAL ━━━
🔴 NO ENTRES — Alto riesgo de phishing
━━━ RESUMEN PARA TODOS ━━━
Este sitio imita al banco BBVA pero el dominio real
es "verificar.com", no "bbva.com". Fue creado hace
3 días y 8 antivirus ya lo marcan como phishing.
No ingreses ningún dato aquí.
NIVEL DE RIESGO: CRÍTICO
━━━ LO QUE NO PUDIMOS VERIFICAR ━━━
• Diseño visual del sitio
• Comportamiento del formulario
• Scripts JavaScript ocultos
```
### 选项 3 — 查看历史
显示最近 10 次分析的日期和类型。
## 安全测试
该项目包含一套 **120 个测试**,会在每次提交前以及每次推送到 GitHub 时自动执行。
```
python test_agente.py
```
| 模块 | 测试数 | 验证内容 |
|--------|-------|-------------|
| 验证器 | 26 | IP、域名、哈希、类型 |
| 净化器 | 10 | SQL 注入、XSS、命令注入 |
| 反钓鱼 | 10 | 钓鱼检测、误报 |
| API Keys 安全 | 5 | 凭证安全处理 |
| 模拟工具 | 8 | 不消耗 API 配额的逻辑 |
| 恶意输入 | 6 | 16 个极端输入的模糊测试 |
| 业务逻辑 | 7 | 正确的风险阈值 |
| 响应结构 | 5 | 一致的结果格式 |
| buscar_subdominios | 7 | 解析和限制 |
| verificar_ssl | 5 | 证书处理 |
| verificar_redireccion | 7 | 域名变更检测 |
| 报告和历史 | 6 | 安全的磁盘写入 |
| validar_url | 18 | 选项 2 的输入验证 |
测试会在每次推送时通过 GitHub Actions 自动运行。上方的徽章显示当前状态。
## 安全性
- API keys 从 `.env` 文件中读取,绝不会在日志或错误中暴露
- 所有输入在处理前都会经过 `sanitizar()`(移除 `;`、`<`、`>`、`&`、`'`)
- `validar_url()` 在分析前验证 URL 是否真实
- 每次分析最多调用 10 次工具,以防止无限循环
- 每次外部 HTTP 调用超时时间为 10 秒
## 项目结构
```
agente-ciberseguridad/
├── agente.py # Agente principal (20 funciones, ~840 líneas)
├── test_agente.py # Suite de tests (120 tests, 13 bloques)
├── .env # API keys — NO se sube a GitHub
├── .gitignore # Protege .env, reportes/ y __pycache__
├── reportes/ # JSONs de análisis guardados localmente
└── .github/
└── workflows/
└── tests.yml # GitHub Actions — tests automáticos en la nube
```
## 免责声明
本项目仅供**合乎道德和防御性用途**。
它旨在让个人和安全团队能够验证互联网资源是否危险、防范钓鱼攻击并分析已知威胁。不得用于攻击系统、未经授权收集信息或任何非法活动。
*Miguel Ángel Ramírez Galicia · MikeUchiha122 · 2026*
标签:AbuseIPDB, Ask搜索, Claude, CVE检测, CVE漏洞查询, DAST, DLL 劫持, IP信誉检查, IP 地址批量处理, Python, ReAct模式, SSH攻击检测, Typosquatting检测, URL扫描, VirusTotal, WHOIS查询, 人工智能, 动态插桩, 协议探测, 域名安全, 大语言模型, 威胁情报, 安全运营, 开发者工具, 恶意软件分析, 情报报告生成, 扫描框架, 无后门, 用户模式Hook绕过, 网络安全, 自主代理, 自动化分析, 跨站脚本, 钓鱼检测, 防御性安全, 隐私保护