AirdropLaura/mimo-sentinel

GitHub: AirdropLaura/mimo-sentinel

一个基于小米MiMo V2.5的AI驱动链上威胁情报工具,用于实时检测和解释EVM区块链上的安全威胁。

Stars: 0 | Forks: 0

# MiMo Sentinel **AI驱动的链上威胁情报 — 由小米 MiMo V2.5 提供技术支持** [![由 MiMo V2.5 提供支持](https://img.shields.io/badge/reasoning-MiMo%20V2.5-9f1239?style=flat-square)](https://mimo.xiaomi.com/) [![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue?style=flat-square)](https://python.org) [![License: MIT](https://img.shields.io/badge/license-MIT-green?style=flat-square)](LICENSE) ## 功能介绍 MiMo Sentinel 监控 EVM 链上的活动,并利用 **MiMo V2.5 的深度推理能力**,实时检测、分类和解释威胁 — 生成分析师级别的事件报告,说明*发生了什么、为什么重要以及该怎么做*。 它不是区块浏览器,也不是警报机器人。它是一个**推理层**,能将原始交易数据转化为可操作的威胁情报。 ### 威胁类别 | 类别 | 示例 | MiMo 作用 | |---|---|---| | **闪电贷攻击** | 价格预言机操纵、流动性耗尽 | 多步骤攻击链推理 | | **拉地毯跑路** | 移除流动性、铸造抛售、蜜罐合约 | 合约模式 + 行为分析 | | **鲸鱼动向** | 向交易所大额转账、积累模式 | 上下文感知风险评估 | | **合约漏洞利用** | 重入、访问控制失败、逻辑炸弹 | 从交易追踪推断代码行为 | | **治理攻击** | 闪电贷投票、提案操纵 | 时间 + 经济推理 | | **MEV 利用** | 三明治攻击、抢跑、时间劫持 | 排序模式分析 | ## 架构设计 ``` ┌─────────────────────────────────────────────────────────────┐ │ EVENT INGESTION LAYER │ │ (RPC Listeners · Event Filters · Mempool Watch) │ └──────────┬──────────────────┬──────────────────┬─────────────┘ │ │ │ ▼ ▼ ▼ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ PATTERN ENGINE │ │ ANOMALY ENGINE │ │ CONTEXT ENGINE │ │ │ │ │ │ │ │ • Known exploit │ │ • Statistical │ │ • Historical tx │ │ signatures │ │ deviation │ │ correlation │ │ • Contract │ │ • Volume spikes │ │ • Protocol state │ │ bytecode match │ │ • Gas anomalies │ │ analysis │ │ • Tx sequence │ │ • Timing │ │ • Cross-chain │ │ patterns │ │ patterns │ │ signal fusion │ └────────┬─────────┘ └────────┬─────────┘ └────────┬─────────┘ │ │ │ ▼ ▼ ▼ ┌─────────────────────────────────────────────────────────────┐ │ MiMo V2.5 REASONING ENGINE │ │ │ │ ┌─────────────┐ ┌──────────────┐ ┌─────────────────────┐ │ │ │ THREAT │ │ SEVERITY │ │ INCIDENT REPORT │ │ │ │ CLASSIFIER │ │ ASSESSOR │ │ GENERATOR │ │ │ │ │ │ │ │ │ │ │ │ Multi-step │ │ Economic │ │ Structured brief: │ │ │ │ chain-of- │ │ impact + │ │ • Executive summary │ │ │ │ thought │ │ exploit │ │ • Attack vector │ │ │ │ reasoning │ │ feasibility │ │ • Affected assets │ │ │ │ │ │ scoring │ │ • Recommended action│ │ │ └─────────────┘ └──────────────┘ └─────────────────────┘ │ └──────────────────────────┬──────────────────────────────────┘ │ ▼ ┌─────────────────────────────────────────────────────────────┐ │ OUTPUT LAYER │ │ JSON Reports · Console Alerts · Webhook Dispatch · CLI │ └─────────────────────────────────────────────────────────────┘ ``` ### 为什么选择 MiMo V2.5? 威胁分析需要**深度多步推理**,而非模式匹配。MiMo V2.5 擅长: 1. **思维链威胁分类** — 追踪跨多笔交易的攻击逻辑 2. **经济影响推理** — 计算潜在损失、受影响用户、协议风险敞口 3. **时间模式分析** — 理解基于时间的攻击序列(闪电贷具有时间约束性) 4. **上下文感知严重性** — 相同行为(大额转账)对鲸鱼是良性的,对协议金库却是致命的 其他模型通过关键词分类威胁。MiMo **推理攻击机制**。 ## 快速开始 ``` # 克隆 git clone https://github.com/AirdropLaura/mimo-sentinel.git cd mimo-sentinel # 安装 pip install -r requirements.txt # 配置 cp .env.example .env # 编辑 .env 文件,填入你的 MiMo API key 和 RPC 端点 # 运行演示(无需实时连接) python -m src.sentinel --demo # 运行实时监控 python -m src.sentinel --chain ethereum --mode live ``` ## 配置说明 ``` # MiMo API MIMO_API_KEY=your_key_here MIMO_API_URL=https://token-plan-sgp.xiaomimimo.com/v1 MIMO_MODEL=mimo-v2.5-pro # 区块链 RPC ETH_RPC_URL=https://eth-mainnet.g.alchemy.com/v2/YOUR_KEY ARB_RPC_URL=https://arb-mainnet.g.alchemy.com/v2/YOUR_KEY BSC_RPC_URL=https://bsc-dataseed.binance.org/ # 警报 ALERT_WEBHOOK_URL=https://hooks.slack.com/services/... ALERT_DISCORD_URL=https://discord.com/api/webhooks/... ``` ## 输出示例 ``` { "incident_id": "SENT-2026-0518-001", "timestamp": "2026-05-18T04:23:15Z", "chain": "ethereum", "threat_type": "flash_loan_attack", "severity": "critical", "confidence": 0.94, "summary": "Flash loan attack detected on Uniswap V3 ETH/USDC pool. Attacker borrowed 50,000 WETH via Aave, manipulated TWAP oracle, extracted $2.3M from lending protocol.", "attack_vector": "Oracle manipulation via TWAP price skew on concentrated liquidity pool", "affected_entities": { "protocol": "LendingProtocolX", "pools": ["Uniswap V3 ETH/USDC", "Aave V3 WETH"], "estimated_loss": "$2.3M", "affected_users": 847 }, "transactions": [ "0xabc...123 (borrow 50K WETH from Aave)", "0xdef...456 (swap manipulation on Uni V3)", "0x789...ghi (liquidation exploit)" ], "recommended_action": "IMMEDIATE: Pause protocol contracts. Freeze affected pools. Contact security team. Preserve on-chain evidence.", "reasoning_trace": "Step 1: Large WETH borrow from Aave flash loan detected. Step 2: Subsequent swap on Uni V3 moved TWAP price by 12% (abnormal). Step 3: Liquidation triggered on LendingProtocolX at manipulated price. Step 4: Attacker repaid flash loan with profit. Pattern matches known oracle manipulation attack class." } ``` ## 项目结构 ``` mimo-sentinel/ ├── src/ │ ├── __init__.py │ ├── sentinel.py # Main orchestrator │ ├── mimo_client.py # MiMo V2.5 API integration │ ├── event_listener.py # Blockchain event monitoring │ ├── threat_engine.py # Pattern + anomaly detection │ ├── report_generator.py # Incident report formatting │ └── models.py # Data models (Threat, Incident, etc.) ├── examples/ │ ├── flash_loan_demo.py # Flash loan attack detection demo │ ├── rug_pull_demo.py # Rug pull detection demo │ └── whale_tracker_demo.py # Whale movement analysis demo ├── tests/ │ ├── test_threat_engine.py │ └── test_mimo_client.py ├── docs/ │ └── MIMO_CASE_STUDY.md # How MiMo reasoning outperforms alternatives ├── .env.example ├── requirements.txt ├── setup.py └── README.md ``` ## 许可证 MIT
标签:AI 分析, AI 驱动安全, EVM 链, MEV 漏洞利用, Python 开发, Rug Pull 检测, WSL, 事件报告生成, 加密货币安全, 区块链威胁, 区块链安全, 威胁分类, 威胁情报, 开发者工具, 智能合约安全, 智能合约漏洞, 治理攻击分析, 深度推理, 逆向工具, 链上活动监控, 闪电贷攻击检测