cognis-digital/oraclewatch

GitHub: cognis-digital/oraclewatch

OracleWatch 监控 DeFi 价格预言机数据流的异常与操纵风险,并按资金池模拟攻击收益以评估协议安全暴露面。

Stars: 0 | Forks: 0

ORACLEWATCH # ORACLEWATCH ### 监控价格预言机数据流的滞后、偏离和操纵风险,模拟每个资金池的 TWAP/现货攻击收益。 [![PyPI](https://img.shields.io/pypi/v/cognis-oraclewatch.svg?color=6b46c1)](https://pypi.org/project/cognis-oraclewatch/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/82b82d7cc1163411.svg)](https://github.com/cognis-digital/oraclewatch/actions) [![License: COCL 1.0](https://img.shields.io/badge/License-COCL%201.0-2b6cb0.svg)](LICENSE) [![Suite](https://img.shields.io/badge/Cognis-Neural%20Suite-6b46c1.svg)](https://github.com/cognis-digital) *Web3 与智能合约安全 —— 链上安全与分析。*
``` pip install cognis-oraclewatch oraclewatch scan . # → prioritized findings in seconds ``` ## 使用说明 —— 分步指南 `oraclewatch` 通过解析一个或多个数据流的 JSON 描述文件,来监控价格预言机数据流是否存在滞后、偏离及其他异常情况。 1. **安装**: pip install -e . oraclewatch --version 2. **检查** JSON 数据流文件(可以是列表,或 `{"feeds": [...]}` 格式): oraclewatch check feeds.json 3. **固定评估时间**,以便在固定的 epoch 时间重现滞后检查: oraclewatch check feeds.json --now 1718200000 4. **读取输出**:以 JSON 格式输出以便接入告警流水线(顶层包含 `reports[]`,并在发现任何 WARNING 及以上级别的问题时设置 `blocking` 标志): oraclewatch --format json check feeds.json | jq '.reports[] | select(.findings | length > 0)' 5. **自动化** —— 设置 cron 定时任务,并将 JSON 结果路由到你的监控系统中: oraclewatch --format json check feeds.json > oracle-health.json ## 目录 - [为什么选择 oraclewatch?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI 技术栈](#ai-stack) · [对比分析](#how-it-compares) · [集成](#integrations) · [随处安装](#install-anywhere) · [相关工具](#related) · [贡献指南](#contributing) ## 为什么选择 oraclewatch? 预言机操纵是 DeFi 漏洞利用的第一大根因;一款能够为每个资金池计算攻击成本的工具,能够为协议提供一个具有防御力的度量指标。 `oraclewatch` 是单一用途、可脚本化且可自托管的:将其指向目标,即可获取符合你现有工作流格式的优先级排序结果(表格 · JSON · SARIF),将其设置为 CI 的门禁,并允许 AI 智能体通过 MCP 进行调用。
↑ 回到顶部
## 功能 - ✅ 加载数据流 - ✅ 共识价格 - ✅ 分析单一数据流 - ✅ 分析多组数据流 - ✅ 阻断机制 - ✅ 支持 Linux/macOS/Windows · Docker · devcontainer 运行 - ✅ 支持 Python, JavaScript, Go, 和 Rust 多语言移植版本 (`ports/`)
↑ 回到顶部
## 快速开始 ``` pip install cognis-oraclewatch oraclewatch --version oraclewatch scan . # scan current project oraclewatch scan . --format json # machine-readable oraclewatch scan . --fail-on high # CI gate (non-zero exit) ```
↑ 回到顶部
## 示例 ``` $ oraclewatch scan . [HIGH ] ORA-001 example finding (./src/app.py) [MEDIUM ] ORA-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 回到顶部
## 架构 ``` flowchart LR IN[input] --> P[oraclewatch
analyze + score] P --> OUT[report] ```
↑ 回到顶部
## 从任何 AI 技术栈中调用 `oraclewatch` 可以与所有主流的 AI 使用方式实现互操作: - **MCP server** —— `oraclewatch mcp` (支持 Claude Desktop, Cursor, Cognis.Studio, [uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **兼容 OpenAI / JSON** —— 可将 `oraclewatch scan . --format json` 的输出通过管道传递给任何 agent 或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** —— 只需一行代码即可将 CLI/JSON 封装为工具 - **CI / 脚本** —— 提供退出代码 + SARIF 格式支持,适用于非 AI 流水线
↑ 回到顶部
## 对比分析 | | **Cognis oraclewatch** | Chainlink 监控 | |---|:---:|:---:| | 支持自托管,无需账户 | ✅ | 视情况而定 | | 单条命令,零配置 | ✅ | ⚠️ | | 支持用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | MCP 原生支持 (AI agents) | ✅ | ❌ | | 多语言移植版本 (JS/Go/Rust) | ✅ | ❌ | | 开源协议 | ✅ COCL | 视情况而定 | *秉承 **Chainlink 监控 / Tellor watchdogs** 的精神,并以 Cognis 的方式重新构建。如果遗漏了致谢?欢迎提交 PR。*
↑ 回到顶部
## 集成 可无缝接入你的技术栈:**SARIF** 用于代码扫描,**JSON** 用于任何场景,**MCP server** (`oraclewatch mcp`) 用于 AI agents,以及用于 SIEM/Slack/Jira 的 webhook 转发器。详见 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 回到顶部
## 安装 —— 各种方式,全平台支持 ``` pip install "git+https://github.com/cognis-digital/oraclewatch.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/oraclewatch.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/oraclewatch.git" # uv pip install cognis-oraclewatch # PyPI (when published) docker run --rm ghcr.io/cognis-digital/oraclewatch:latest --help # Docker brew install cognis-digital/tap/oraclewatch # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/oraclewatch/main/install.sh | sh ``` | Linux | macOS | Windows | Docker | 云平台 | |---|---|---|---|---| | `scripts/setup-linux.sh` | `scripts/setup-macos.sh` | `scripts/setup-windows.ps1` | `docker run ghcr.io/cognis-digital/oraclewatch` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 回到顶部
## 相关 Cognis 工具 - [`reentryx`](https://github.com/cognis-digital/reentryx) —— 静态 + 符号执行检测器,用于标记 Solidity/Vyper 中的重入、跨函数和只读重入路径,并输出用于 CI 门禁的 SARIF 结果。 - [`forkfuzz`](https://github.com/cognis-digital/forkfuzz) —— 主网分叉不变性模糊测试工具,通过针对实时状态和有状态序列重放你的合约,以便在部署前破坏协议不变性。 - [`approvewarden`](https://github.com/cognis-digital/approvewarden) —— 扫描任何钱包中的危险 ERC-20/721/1155 代币授权和无限额度,评估资产被盗风险并生成撤销授权的交易。 - [`mevscope`](https://github.com/cognis-digital/mevscope) —— 重放交易或地址历史,以归因三明治攻击、抢先交易和尾随交易等 MEV 提取行为,并计算每笔交易的损失。 - [`rugradar`](https://github.com/cognis-digital/approvewarden) —— 代币合约风险扫描器,在你盲目投资前检测蜜罐、隐藏的铸币/黑名单函数、所有者后门以及未锁定的流动性。 - [`storagelens`](https://github.com/cognis-digital/storagelens) —— 对比并解码跨代理升级的合约存储布局,以捕获存储冲突和未初始化的插槽漏洞。 **探索全套工具 →** [🗂️ 查看所有 170+ 工具](https://github.com/cognis-digital/cognis-neural-suite) · [⭐ awesome-cognis](https://github.com/cognis-digital/awesome-cognis) · [🔗 cognis-sources](https://github.com/cognis-digital/cognis-sources) · [🤖 uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet) · [🧠 engram](https://github.com/cognis-digital/engram)
↑ 回到顶部
## 互操作性 `{}` 与包含 300+ 工具的 Cognis 套件无缝组合 —— 采用 JSON 输入/输出以及共享的兼容 OpenAI 的 `/v1` 核心。请参阅 **[INTEROP.md](INTEROP.md)** 获取套件图谱、组合模式和参考技术栈。 ## 许可证 在 **Cognis Open Collaboration License (COCL) v1.0** 下提供源代码可见 —— 个人使用、内部评估、研究和教育用途免费;**商业 / 生产环境使用需要授权** (licensing@cognis.digital)。详见 [LICENSE](LICENSE)。
Cognis Digital · Cognis Neural Suite 中 170+ 工具之一 · 让明天更美好
标签:Python, Web3安全, 价格操纵检测, 可视化界面, 数据可视化, 无后门, 日志审计, 智能合约审计, 请求拦截, 逆向工具, 链上数据分析, 预言机监控