cognis-digital/txgraph

GitHub: cognis-digital/txgraph

从账本/账户数据构建交易图谱并自动识别结构化、分层和骡子账户等洗钱模式的 CLI 工具,用于 AML 分流排查。

Stars: 0 | Forks: 0

TXGRAPH # TXGRAPH ### 从账本/账户数据构建交易图谱,并揭示结构化、分层和骡子账户网络模式,用于 AML 分流排查。 [![PyPI](https://img.shields.io/pypi/v/cognis-txgraph.svg?color=6b46c1)](https://pypi.org/project/cognis-txgraph/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/955a1faaec053406.svg)](https://github.com/cognis-digital/txgraph/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) *金融科技与支付安全 — PCI、欺诈、AML 和支付网络。*
``` pip install cognis-txgraph txgraph scan . # → prioritized findings in seconds ``` ## 使用说明 — 分步指南 1. **安装** (Python 3.9+): pip install txgraph 2. **扫描交易 CSV** 以检测 AML 模式(结构化、分层等): txgraph scan transactions.csv 3. **调整检测参数。** 设置结构化报告的阈值,并选择何种严重级别会导致运行失败: txgraph scan transactions.csv --threshold 10000 --fail-on high 4. **查看输出。** 输出 JSON 供工具使用,或为分析师打印 SAR 叙述报告: txgraph scan transactions.csv --format json | jq '.findings[]' txgraph scan transactions.csv --sar 5. **在 CI 中进行拦截。** 使用 `--fail-on` 时,如果存在匹配的发现结果,退出码将为非零: txgraph scan transactions.csv --fail-on any || echo "AML findings detected" ## 目录 - [为什么选择 txgraph?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI 技术栈](#ai-stack) · [对比分析](#how-it-compares) · [集成](#integrations) · [任意平台安装](#install-anywhere) · [相关工具](#related) · [贡献指南](#contributing) ## 为什么选择 txgraph? 基于图谱的洗钱检测在学术界非常热门,但缺乏即插即用的 CLI;通过导入 CSV、无需任何基础设施即可输出可疑子图和可直接用于 SAR 的摘要,这是一个极具病毒传播性的 AML 演示。 `txgraph` 是单一用途、可脚本化且可自托管的:将其指向目标,以您的工作流已适配的格式(表格 · JSON · SARIF)获取优先排序的结果,在 CI 中对其进行拦截,并允许 agent 通过 MCP 驱动它。
↑ 返回顶部
## 功能 - ✅ 加载交易数据 - ✅ 构建图谱 - ✅ 检测结构化 - ✅ 检测分层 - ✅ 检测骡子账户 - ✅ 分析 - ✅ SAR 摘要 - ✅ 支持 Linux/macOS/Windows · Docker · devcontainer 运行 - ✅ 提供 Python, JavaScript, Go 和 Rust 的多语言版本 (`ports/`)
↑ 返回顶部
## 快速开始 ``` pip install cognis-txgraph txgraph --version txgraph scan . # scan current project txgraph scan . --format json # machine-readable txgraph scan . --fail-on high # CI gate (non-zero exit) ```
↑ 返回顶部
## 示例 ``` $ txgraph scan . [HIGH ] TXG-001 example finding (./src/app.py) [MEDIUM ] TXG-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 返回顶部
## 架构 ``` flowchart LR IN[addresses + transactions] --> P[txgraph
cluster + trace] P --> OUT[sanctions xref / report] ```
↑ 返回顶部
## 从任何 AI 技术栈中使用 `txgraph` 可以与所有流行的 AI 使用方式互操作: - **MCP 服务器** — `txgraph mcp` (Claude Desktop, Cursor, Cognis.Studio, [uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **兼容 OpenAI / JSON** — 将 `txgraph scan . --format json` 管道传输给任何 agent 或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** — 一行代码即可将 CLI/JSON 封装为工具 - **CI / 脚本** — 为非 AI 流水线提供退出码 + SARIF
↑ 返回顶部
## 对比分析 | | **Cognis txgraph** | AMLSim | |---|:---:|:---:| | 可自托管,无需账户 | ✅ | 视情况而定 | | 单条命令,零配置 | ✅ | ⚠️ | | 适用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | MCP 原生支持(AI agent) | ✅ | ❌ | | 多语言端口(JS/Go/Rust) | ✅ | ❌ | | 开源许可 | ✅ COCL | 视情况而定 | *秉承 **AMLSim / Neo4j 欺诈图谱**的精神,以 Cognis 的方式重新构建。如果遗漏了鸣谢?欢迎提交 PR。*
↑ 返回顶部
## 集成 可接入您的技术栈:用于代码扫描的 **SARIF**,适用于任何场景的 **JSON**,面向 AI agent 的 **MCP 服务器**(`txgraph mcp`),以及用于 SIEM/Slack/Jira 的 webhook 转发器。详情请参阅 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 返回顶部
## 安装 — 各种方式、各个平台 ``` pip install "git+https://github.com/cognis-digital/txgraph.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/txgraph.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/txgraph.git" # uv pip install cognis-txgraph # PyPI (when published) docker run --rm ghcr.io/cognis-digital/txgraph:latest --help # Docker brew install cognis-digital/tap/txgraph # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/txgraph/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/txgraph` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 返回顶部
## 相关 Cognis 工具 - [`panhound`](https://github.com/cognis-digital/panhound) — 扫描代码、日志、测试数据和 S3 存储桶,在泄露的 PAN(Luhn 校验的卡号)和 CVV 进入生产环境之前将其找出。 - [`fraudlens`](https://github.com/cognis-digital/fraudlens) — 针对可插拔的欺诈规则和 ML 评分器重放交易流,并从终端输出精确率/召回率和警报量。 - [`obscan`](https://github.com/cognis-digital/obscan) — 针对 Open Banking / FAPI API 的一致性和安全 linter:根据规范验证 OAuth 流程、同意范围和 PSD2 endpoint。 - [`ledgerproof`](https://github.com/cognis-digital/ledgerproof) — 通过检查余额不变量和哈希链式日记账分录,验证复式记账账本的完整性和防篡改性。 - [`iso20022`](https://github.com/cognis-digital/iso20022) — 验证、lint 并比对 ISO 20022 / pacs / camt 支付消息,并通过具备 schema 感知的错误提示将传统的 MT 格式转换为 MX 格式。 - [`tokenvault`](https://github.com/cognis-digital/tokenvault) — 可自托管的 PCI token 化微服务和 CLI,将 PAN 替换为保持格式的 token,并证明不存在持久化的原始卡数据。 **探索完整工具套件 →** [🗂️ 全部 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 · 包含 170+ 工具的 Cognis Neural Suite 之一 · Making Tomorrow Better Today
标签:LNA, 交易图谱, 代码示例, 反洗钱, 可视化界面, 数据分析, 数据可视化, 日志审计, 欺诈检测, 请求拦截, 逆向工具, 金融科技