0xDexFi/pentern
GitHub: 0xDexFi/pentern
一个基于 LLM 的自主被动侦察 Agent,能在运行时动态编写代码串联 WHOIS、DNS、TLS、证书透明度和 CVE 查询等侦察原语,输出结构化摘要。
Stars: 0 | Forks: 0
```
██████╗ ███████╗███╗ ██╗████████╗███████╗██████╗ ███╗ ██╗
██╔══██╗██╔════╝████╗ ██║╚══██╔══╝██╔════╝██╔══██╗████╗ ██║
██████╔╝█████╗ ██╔██╗ ██║ ██║ █████╗ ██████╔╝██╔██╗ ██║
██╔═══╝ ██╔══╝ ██║╚██╗██║ ██║ ██╔══╝ ██╔══██╗██║╚██╗██║
██║ ███████╗██║ ╚████║ ██║ ███████╗██║ ██║██║ ╚████║
╚═╝ ╚══════╝╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝
autonomous code-writing recon agent · passive-only
```
[](LICENSE)
[](https://www.python.org/)
[](https://github.com/0xDexFi/pentern/actions/workflows/ci.yml)
[](https://github.com/0xDexFi/pentern/commits/main)
[](https://github.com/0xDexFi/pentern/stargazers)
`pentern` 是一个用于攻击性安全侦察的最小化自主 Agent。它会在运行时编写 Python 代码,将被动侦察原语——WHOIS、DNS、HTTP 指纹识别、TLS 检查、证书透明度子域名枚举以及 CVE 查询——串联起来,并报告其发现的结果。
它的设计初衷只有一个:投入一个目标,输出一份结构化的侦察摘要。
## 运行效果
```
$ pentern example.com
██████╗ ███████╗███╗ ██╗████████╗███████╗██████╗ ███╗ ██╗
... banner ...
╚═╝ ╚══════╝╚═╝ ╚═╝ ╚═══╝ ╚═╝ ╚══════╝╚═╝ ╚═╝╚═╝ ╚═══╝
[pentern] target: example.com · model: gpt-4o-mini
[step 1] whois_lookup("example.com") → Reserved (IANA)
[step 2] dns_records("example.com") → A: 93.184.216.34
[step 3] tls_certificate("example.com") → DigiCert · valid until 2026-12-23
[step 4] subdomain_enum_ct("example.com") → 47 subdomains
[step 5] http_fingerprint("https://example.com")
[step 6] cve_search("ECS (Edgecast)") → 0 matches
== summary ==
- 47 subdomains in CT logs; dev.example.com and mail.example.com worth a closer look
- Cert SAN list does not include cross-org hostnames
- No matching CVEs against observed banners
```
## 为什么
大多数 Agent 演示都只是玩具。大多数侦察脚本都是线性且脆弱的。`pentern` 在运行时编写自己的调用链——如果 TLS 握手揭示了不同的主机名,它会继续追踪。如果 CVE 搜索返回了有趣的 CPE,它会进行 pivoting。相同的 prompt 针对不同的目标会产生不同(且更优)的执行路径。
## 它*不*做什么
- 没有主动扫描。没有端口扫描,没有模糊测试,没有漏洞利用。
- 没有任何工具会以超出一个合规请求的代价去触碰目标。
- `pentern` 所做的一切,针对公共互联网上的任何主机运行都是合法的。
## 安装
```
pip install -r requirements.txt
```
## 运行
```
export OPENAI_API_KEY=sk-... # or ANTHROPIC_API_KEY, or any LiteLLM-supported provider
pentern example.com
pentern example.com --out report.md # new in v0.2: write a markdown report
```
你也可以通过编程方式驱动它:
```
from pentern import build_agent
agent = build_agent()
agent.run("Recon example.com and tell me anything interesting about its perimeter.")
```
## 模型后端
默认通过 LiteLLM 使用 `gpt-4o-mini`。可以这样覆盖:
```
pentern example.com --model anthropic/claude-sonnet-4-5
pentern example.com --model ollama_chat/qwen2.5-coder:7b
```
任何 [LiteLLM 支持的模型](https://docs.litellm.ai/docs/providers)均可使用。
## 工具清单
| 工具 | 功能描述 |
|------|--------------|
| `whois_lookup` | 注册商,创建日期,域名服务器 |
| `dns_records` | 域名的 A / AAAA / MX / NS / TXT 记录 |
| `http_fingerprint` | 一次 GET 请求,返回状态码 + 响应头 + Server 标识 |
| `tls_certificate` | TLS 握手元数据:颁发者,有效期,SAN 列表 |
| `subdomain_enum_ct` | 通过 crt.sh 证书透明度日志获取子域名 |
| `cve_search` | NVD 关键字搜索,返回最佳匹配结果及 CVSS 评分 |
## 来自 0xDexFi 的更多项目
- [**orbital**](https://github.com/0xDexFi/orbital) — 被动子域名接管扫描器
- [**brief**](https://github.com/0xDexFi/brief) — 每日 CVE/安全公告摘要 Agent
- [**secmcp**](https://github.com/0xDexFi/secmcp) — 用于被动安全工具的 MCP 服务器
- [**vibe-init**](https://github.com/0xDexFi/vibe-init) — 针对AI编程工具配置的一键脚手架
- [**agentlint**](https://github.com/0xDexFi/agentlint) — AI Agent 配置文件的 Linter
## 许可证
MIT。请参阅 `LICENSE`。
标签:AI智能体, AI风险缓解, ASM, C2日志可视化, CVE查询, DNS解析, ESC4, GitHub, OSINT, Petitpotam, Python, TLS检查, WHOIS查询, 代码生成, 协议探测, 子域名枚举, 安全工具库, 实时处理, 开源项目, 指纹识别, 数据展示, 无后门, 渗透测试工具, 系统安全, 红队, 网络安全, 自动化代理, 被动侦察, 资产测绘, 逆向工具, 隐私保护