cognis-digital/asnmap

GitHub: cognis-digital/asnmap

从 whois/RIR 导出数据中映射 ASN 与 CIDR 归属及邻接关系的轻量级命令行工具。

Stars: 0 | Forks: 0

ASNMAP # ASNMAP ### 从 whois/RIR 导出中映射 ASN/CIDR 归属及邻接关系 [![PyPI](https://img.shields.io/pypi/v/cognis-asnmap.svg?color=6b46c1)](https://pypi.org/project/cognis-asnmap/) [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/3bee9b3cfb060557.svg)](https://github.com/cognis-digital/asnmap/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) *Cognis Neural Suite 的一部分。*
``` pip install cognis-asnmap asnmap scan . # → prioritized findings in seconds ``` ## 使用说明 — 分步指南 1. **安装** CLI(控制台脚本 `asnmap`): pip install cognis-asnmap 2. 从 whois/RIR 导出中**打印 ASN -> CIDR 归属映射**(`-` 读取 stdin): asnmap map export.txt 3. **运行完整的分诊分析**以呈现邻接对和发现结果: asnmap analyze export.txt 4. 以 JSON 格式**读取结果**,或编写可共享的 HTML 报告(`-o` 写入文件): asnmap analyze export.txt --format json asnmap analyze export.txt --format html -o asnmap-report.html 5. **在 CI 中实现自动化** — 退出码 0 = 正常,1 = IO 错误,2 = 存在中级及以上发现(流水线门禁): - run: pip install cognis-asnmap - run: asnmap analyze export.txt --format json -o asnmap.json ## 目录 - [为何使用 asnmap?](#why) · [功能](#features) · [快速开始](#quick-start) · [示例](#example) · [架构](#architecture) · [AI 技术栈](#ai-stack) · [对比分析](#how-it-compares) · [集成](#integrations) · [随处安装](#install-anywhere) · [相关项目](#related) · [贡献](#contributing) ## 为何使用 asnmap? 从 whois/RIR 导出中映射 ASN/CIDR 归属及邻接关系 — 无需搭建重量级基础设施。 `asnmap` 是单一用途、可脚本化且可自托管的:将其指向目标,即可获取符合您现有工作流格式的优先排序结果(表格 · JSON · SARIF),将其作为 CI 门禁,并允许 agent 通过 MCP 驱动它。
↑ 回到顶部
## 功能 - ✅ 解析导出文件 - ✅ 构建 Asn 映射 - ✅ 查找邻接关系 - ✅ 分析 - ✅ 可在 Linux/macOS/Windows · Docker · devcontainer 上运行 - ✅ 提供 Python、JavaScript、Go 和 Rust 移植版 (`ports/`)
↑ 回到顶部
## 快速开始 ``` pip install cognis-asnmap asnmap --version asnmap scan . # scan current project asnmap scan . --format json # machine-readable asnmap scan . --fail-on high # CI gate (non-zero exit) ```
↑ 回到顶部
## 示例 ``` $ asnmap scan . [HIGH ] ASN-001 example finding (./src/app.py) [MEDIUM ] ASN-002 another signal (./config.yaml) 2 findings · risk score 5 · 38ms ```
↑ 回到顶部
## 架构 ``` flowchart LR IN[target / export] --> P[asnmap
collect + correlate] P --> OUT[ranked findings] ```
↑ 回到顶部
## 从任何 AI 技术栈中使用 `asnmap` 可与所有流行的 AI 使用方式互操作: - **MCP server** — `asnmap mcp` (Claude Desktop, Cursor, Cognis.Studio, [uncensored-fleet](https://github.com/cognis-digital/uncensored-fleet)) - **兼容 OpenAI / JSON** — 将 `asnmap scan . --format json` 管道传输至任何 agent 或 LLM - **LangChain · CrewAI · AutoGen · LlamaIndex** — 一行代码将 CLI/JSON 封装为工具 - **CI / 脚本** — 为非 AI pipeline 提供退出码 + SARIF
↑ 回到顶部
## 对比分析 | | **Cognis asnmap** | 典型工具 | |---|:---:|:---:| | 可自托管,无需账户 | ✅ | 视情况而定 | | 单条命令,零配置 | ✅ | ⚠️ | | 用于 CI 的 JSON + SARIF | ✅ | 视情况而定 | | MCP 原生(AI agent) | ✅ | ❌ | | 多语言移植版 (JS/Go/Rust) | ✅ | ❌ | | 开源许可证 | ✅ COCL | 视情况而定 |
↑ 回到顶部
## 集成 可接入您的技术栈:用于代码扫描的 **SARIF**,用于所有内容的 **JSON**,用于 AI agent 的 **MCP server** (`asnmap mcp`),以及用于 SIEM/Slack/Jira 的 webhook 转发器。参见 [`docs/INTEGRATIONS.md`](docs/INTEGRATIONS.md)。
↑ 回到顶部
## 安装 — 各种方式,所有平台 ``` pip install "git+https://github.com/cognis-digital/asnmap.git" # pip (works today) pipx install "git+https://github.com/cognis-digital/asnmap.git" # isolated CLI uv tool install "git+https://github.com/cognis-digital/asnmap.git" # uv pip install cognis-asnmap # PyPI (when published) docker run --rm ghcr.io/cognis-digital/asnmap:latest --help # Docker brew install cognis-digital/tap/asnmap # Homebrew tap curl -fsSL https://raw.githubusercontent.com/cognis-digital/asnmap/main/install.sh | sh ``` | Linux | macOS | Windows | Docker | Cloud | |---|---|---|---|---| | `scripts/setup-linux.sh` | `scripts/setup-macos.sh` | `scripts/setup-windows.ps1` | `docker run ghcr.io/cognis-digital/asnmap` | [DEPLOY.md](docs/DEPLOY.md) (AWS/Azure/GCP/k8s) |
↑ 回到顶部
## 相关的 Cognis 工具 **探索套件 →** [🗂️ 全部 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+ 工具之一 · Making Tomorrow Better Today
标签:ASN, CIDR, GitHub, Python, 可视化界面, 数据可视化, 无后门, 日志审计, 检测规则, 网络资产发现, 请求拦截, 逆向工具