praetorian-inc/nerva
GitHub: praetorian-inc/nerva
Nerva 是一款支持 120+ 协议的快速服务指纹识别 CLI 工具,用于对开放端口进行协议检测和元数据提取。
Stars: 157 | Forks: 14
Nerva
Nerva: Fast Service Fingerprinting CLI
Nerva 快速检测并识别开放网络端口上运行的服务。将其与 [Naabu](https://github.com/projectdiscovery/naabu) 等端口扫描器配合使用,对发现的服务进行指纹识别,或将其集成到您的安全管道中进行自动化侦查。
## 功能
- **120+ 协议插件** — 数据库、远程访问、Web 服务、消息传递、工业和电信协议
- **多传输支持** — TCP(默认)、UDP(`--udp`)和 SCTP(`--sctp`,仅限 Linux)
- **丰富的元数据** — 从每个服务中提取版本、配置和安全相关的详细信息
- **快速模式** — 仅扫描默认端口以进行快速侦查(`--fast`)
- **灵活的输出** — JSON、CSV 或人类可读格式
- **管道友好** — 支持从 Naabu、Nmap 或任何输出 `host:port` 的工具通过管道传入
- **Go 库** — 直接导入到您的 Go 应用程序中
## 安装
### 发布版本
从 [Releases](https://github.com/praetorian-inc/nerva/releases) 页面下载预构建的二进制文件。
### 从 GitHub
```
go install github.com/praetorian-inc/nerva/cmd/nerva@latest
```
### 从源码
```
git clone https://github.com/praetorian-inc/nerva.git
cd nerva
go build ./cmd/nerva
./nerva -h
```
### Docker
```
git clone https://github.com/praetorian-inc/nerva.git
cd nerva
docker build -t nerva .
docker run --rm nerva -h
docker run --rm nerva -t example.com:80 --json
```
## 快速开始
对单个目标进行指纹识别:
```
nerva -t example.com:22
# ssh://example.com:22
```
获取详细的 JSON 元数据:
```
nerva -t example.com:22 --json
# {"host":"example.com","ip":"93.184.216.34","port":22,"protocol":"ssh","transport":"tcp","metadata":{...}}
```
从端口扫描器通过管道传入:
```
naabu -host example.com -silent | nerva
# http://example.com:80
# ssh://example.com:22
# https://example.com:443
```
## 用法
```
nerva [flags]
TARGET SPECIFICATION:
Requires host:port or ip:port format. Assumes ports are open.
EXAMPLES:
nerva -t example.com:80
nerva -t example.com:80,example.com:443
nerva -l targets.txt
nerva --json -t example.com:80
cat targets.txt | nerva
```
### 参数标志
| Flag | Short | Description | Default |
|------|-------|-------------|---------|
| `--targets` | `-t` | 目标或逗号分隔的目标列表 | — |
| `--list` | `-l` | 包含目标的输入文件 | — |
| `--output` | `-o` | 输出文件路径 | stdout |
| `--json` | | 以 JSON 格式输出 | false |
| `--csv` | | 以 CSV 格式输出 | false |
| `--fast` | `-f` | 快速模式(仅扫描默认端口) | false |
| `--capabilities` | `-c` | 列出可用功能并退出 | false |
| `--udp` | `-U` | 运行 UDP 插件 | false |
| `--sctp` | `-S` | 运行 SCTP 插件(仅限 Linux) | false |
| `--timeout` | `-w` | 超时时间(毫秒) | 2000 |
| `--verbose` | `-v` | 详细输出到 stderr | false |
### 示例
**多个目标:**
```
nerva -t example.com:22,example.com:80,example.com:443
```
**从文件:**
```
nerva -l targets.txt --json -o results.json
```
**UDP 扫描**(可能需要 root 权限):
```
sudo nerva -t example.com:53 -U
# dns://example.com:53
```
**SCTP 扫描**(仅限 Linux):
```
nerva -t telecom-server:3868 -S
# diameter://telecom-server:3868
```
**快速模式**(仅默认端口):
```
nerva -l large-target-list.txt --fast --json
```
## 支持的协议
跨 TCP、UDP 和 SCTP 的 **120+ 服务检测插件**:
### HTTP 指纹模块 (24)
Web 服务的技术检测:
| Module | Description |
|--------|-------------|
| AnyConnect | Cisco AnyConnect SSL VPN |
| ArangoDB | 多模型数据库 |
| Artifactory | JFrog 制品仓库 |
| BigIP | F5 BIG-IP 负载均衡器 |
| ChromaDB | 向量数据库 |
| Consul | HashiCorp 服务网格 |
| CouchDB | Apache 文档数据库 |
| Elasticsearch | 搜索引擎 |
| etcd | 分布式键值存储 |
| FortiGate | Fortinet 防火墙/VPN |
| GlobalProtect | Palo Alto VPN |
| Grafana | 可观测性平台 |
| Jaeger | 分布式追踪 |
| Jenkins | CI/CD 自动化 |
| Kubernetes | 容器编排 API |
| NATS | 消息代理 |
| Pinecone | 向量数据库 |
| Prometheus | 监控系统 |
| QNAP QTS | NAS 管理 |
| SOAP | Web 服务 |
| TeamCity | CI/CD 服务器 |
| UPnP | 通用即插即用 |
| Vault | HashiCorp 密钥管理 |
| WinRM | Windows 远程管理 |
### 数据库 (20)
| Protocol | Transport | Default Ports |
|----------|-----------|---------------|
| PostgreSQL | TCP | 5432 |
| MySQL | TCP | 3306 |
| MSSQL | TCP | 1433 |
| Oracle | TCP | 1521 |
| MongoDB | TCP | 27017 |
| Redis | TCP/TLS | 6379, 6380 |
| Cassandra | TCP | 9042 |
| InfluxDB | TCP | 8086 |
| Neo4j | TCP/TLS | 7687 |
| DB2 | TCP | 446, 50000 |
| Sybase | TCP | 5000 |
| Firebird | TCP | 3050 |
| Memcached | TCP | 11211 |
| ZooKeeper | TCP | 2181 |
| Milvus | TCP | 19530, 9091 |
| CouchDB | HTTP | 5984 |
| Elasticsearch | HTTP | 9200 |
| ArangoDB | HTTP | 8529 |
| ChromaDB | HTTP | 8000 |
| Pinecone | HTTP | 443 |
### 远程访问 (4)
| Protocol | Transport |
|----------|-----------|
| SSH | TCP |
| RDP | TCP |
| Telnet | TCP |
| VNC | TCP |
### Web & API (2)
| Protocol | Transport | Notes |
|----------|-----------|-------|
| HTTP/HTTPS | TCP | HTTP/2,通过 Wappalyzer 进行技术检测 |
| Kubernetes | TCP | API 服务器检测 |
### 消息与队列 (10)
| Protocol | Transport | Default Ports |
|----------|-----------|---------------|
| Kafka | TCP/TLS | 9092, 9093 |
| MQTT 3/5 | TCP/TLS | 1883, 8883 |
| AMQP | TCP/TLS | 5672, 5671 |
| ActiveMQ | TCP/TLS | 61616, 61617 |
| NATS | TCP/TLS | 4222, 6222 |
| Pulsar | TCP/TLS | 6650, 6651 |
| SMTP | TCP/TLS | 25, 465, 587 |
| POP3 | TCP/TLS | 110, 995 |
| IMAP | TCP/TLS | 143, 993 |
| SMPP | TCP | 2775, 2776 |
### 文件与目录服务 (7)
| Protocol | Transport | Default Ports |
|----------|-----------|---------------|
| FTP | TCP | 21 |
| SMB | TCP | 445 |
| NFS | TCP/UDP | 2049 |
| Rsync | TCP | 873 |
| TFTP | UDP | 69 |
| SVN | TCP | 3690 |
| LDAP | TCP/TLS | 389, 636 |
### 网络服务 (10 UDP)
| Protocol | Transport |
|----------|-----------|
| DNS | TCP/UDP |
| DHCP | UDP |
| NTP | UDP |
| SNMP | UDP |
| NetBIOS-NS | UDP |
| STUN | UDP |
| OpenVPN | UDP |
| IPsec | UDP |
| IPMI | UDP |
| Echo | TCP/UDP |
### 工业控制系统 (15)
| Protocol | Transport | Default Ports | Notes |
|----------|-----------|---------------|-------|
| Modbus | TCP | 502 | SCADA/PLC |
| S7comm | TCP | 102 | Siemens PLC |
| EtherNet/IP | TCP | 44818 | Rockwell/Allen-Bradley |
| PROFINET | TCP | 34962-34964 | Siemens industrial |
| BACnet | UDP | 47808 | 楼宇自动化 |
| OPC UA | TCP | 4840 | 工业互操作性 |
| OMRON FINS | TCP/UDP | 9600 | OMRON PLC |
| MELSEC-Q | TCP | 5006, 5007 | Mitsubishi PLC |
| KNXnet/IP | UDP | 3671 | 楼宇自动化 |
| IEC 104 | TCP | 2404 | 电网 SCADA |
| Fox | TCP | 1911 | Tridium Niagara |
| PC WORX | TCP | 1962 | Phoenix Contact |
| ProConOS | TCP | 20547 | PLC 运行时 |
| HART-IP | TCP | 5094 | 过程自动化 |
| EtherCAT | UDP | 34980 | 运动控制 |
| Crimson v3 | TCP | 789 | Red Lion HMI |
| PCOM | TCP | 20256 | Unitronics PLC |
| GE SRTP | TCP | 18245 | GE PLC |
| ATG | TCP | 10001 | 储罐计量 |
### 电信与 VoIP (15)
| Protocol | Transport | Default Ports | Notes |
|----------|-----------|---------------|-------|
| Diameter | TCP/SCTP | 3868 | LTE/5G AAA |
| M3UA | SCTP | 2905 | SS7 over IP |
| SGsAP | SCTP | 29118 | 电路域回退 |
| X2AP | SCTP | 36422 | LTE inter-eNodeB |
| IUA | SCTP | 9900 | ISDN over IP |
| SIP | TCP/UDP/TLS | 5060, 5061 | VoIP 信令 |
| MEGACO/H.248 | UDP | 2944, 2945 | 媒体网关 |
| MGCP | UDP | 2427, 2727 | 媒体网关 |
| H.323 | TCP | 1720 | 视频会议 |
| SCCP/Skinny | TCP | 2000, 2443 | Cisco IP 电话 |
| IAX2 | UDP | 4569 | Asterisk 协议 |
| GTP-C | UDP | 2123 | GPRS 控制 |
| GTP-U | UDP | 2152 | GPRS 用户面 |
| GTP' | UDP | 3386 | GPRS 计费 |
| PFCP | UDP | 8805 | 5G 用户面 |
### VPN 与安全 (10)
| Protocol | Transport | Default Ports |
|----------|-----------|---------------|
| SSH | TCP | 22, 2222 |
| OpenVPN | UDP | 1194 |
| WireGuard | UDP | 51820 |
| IPsec/IKEv2 | UDP | 500, 4500 |
| L2TP | UDP | 1701 |
| GlobalProtect | HTTP | 443 |
| AnyConnect | HTTP | 443 |
| FortiGate | HTTP | 443 |
| STUN/TURN | UDP | 3478, 5349 |
| Kerberos | TCP | 88 |
### 远程访问与管理 (10)
| Protocol | Transport | Default Ports |
|----------|-----------|---------------|
| RDP | TCP/TLS | 3389 |
| VNC | TCP | 5900 |
| Telnet | TCP | 23 |
| WinRM | HTTP | 5985, 5986 |
| IPMI | UDP | 623 |
| SNMP | UDP | 161 |
| Zabbix Agent | TCP | 10050 |
| NRPE | TCP/TLS | 5666 |
| Docker | TCP/TLS | 2375, 2376 |
| X11 | TCP | 6000-6063 |
### 开发者工具 (8)
| Protocol | Transport | Default Ports |
|----------|-----------|---------------|
| HTTP/HTTPS | TCP | 80, 443, 8080, 8443 |
| Java RMI | TCP | 1099 |
| JDWP | TCP | 5005 |
| RTSP | TCP | 554 |
| Linux RPC | TCP | 111 |
| JetDirect | TCP | 9100 |
| CUPS/IPP | TCP | 631 |
| SonarQube | TCP | 9000 |
## 库用法
将 Nerva 导入您的 Go 应用程序:
```
package main
import (
"fmt"
"log"
"net/netip"
"time"
"github.com/praetorian-inc/nerva/pkg/plugins"
"github.com/praetorian-inc/nerva/pkg/scan"
)
func main() {
// Configure scan
config := scan.Config{
DefaultTimeout: 2 * time.Second,
FastMode: false,
UDP: false,
}
// Create target
ip, _ := netip.ParseAddr("93.184.216.34")
target := plugins.Target{
Address: netip.AddrPortFrom(ip, 22),
Host: "example.com",
}
// Run scan
results, err := scan.ScanTargets([]plugins.Target{target}, config)
if err != nil {
log.Fatal(err)
}
// Process results
for _, result := range results {
fmt.Printf("%s:%d - %s (%s)\n",
result.Host, result.Port,
result.Protocol, result.Transport)
}
}
```
有关完整的工作示例,请参见 [examples/service-fingerprinting-example.go](examples/service-fingerprinting-example.go)。
## 用例
### 渗透测试
快速对侦查期间发现的服务进行指纹识别,以识别潜在的攻击向量。
### 资产发现管道
与 Naabu 或 Masscan 结合进行大规模资产清单盘点:
```
naabu -host 10.0.0.0/24 -silent | nerva --json | jq '.protocol'
```
### CI/CD 安全扫描
集成到部署管道中,以仅暴露了预期的服务。
### Bug Bounty 侦查
快速枚举范围内的目标服务,以发现有趣的端点。
### 电信网络分析
使用 SCTP 传输(Linux)对 LTE/5G 网络中的 Diameter 节点进行指纹识别:
```
nerva -t mme.telecom.local:3868 -S --json
```
## 架构
```
graph LR
A[host:port input] --> B[Target Parser]
B --> C[Scan Engine]
C --> D{Transport}
D -->|TCP| E[TCP Plugins]
D -->|UDP| F[UDP Plugins]
D -->|SCTP| G[SCTP Plugins]
E --> H[Service Detection]
F --> H
G --> H
H --> I[Metadata Extraction]
I --> J[JSON/CSV/Text Output]
```
## 为什么选择 Nerva?
### 对比 Nmap
- **更智能的默认值**:Nerva 根据端口号首先检查最可能的协议
- **结构化输出**:原生支持 JSON/CSV,易于解析和管道集成
- **专注性**:仅专注于服务指纹识别 — 与专用端口扫描器配合进行发现
### 对比 zgrab2
- **自动检测**:无需提前指定协议
- **更简单的用法**:`nerva -t host:port` 对比 `echo host | zgrab2 http -p port`
## 故障排除
### 无输出
**原因**:端口关闭或未检测到支持的服务。
**解决方案**:验证端口是否开放:
```
nc -zv example.com 80
```
### 超时错误
**原因**:对于慢速服务,默认的 2 秒超时时间太短。
**解决方案**:增加超时时间:
```
nerva -t example.com:80 -w 5000 # 5 seconds
```
### 未检测到 UDP 服务
**原因**:默认禁用 UDP 扫描。
**解决方案**:使用 `-U` 标志启用(可能需要 root 权限):
```
sudo nerva -t example.com:53 -U
```
### SCTP 不工作
**原因**:仅 Linux 支持 SCTP。
**解决方案**:在 Linux 系统或容器上运行:
```
docker run --rm nerva -t telecom:3868 -S
```
## 术语
- **服务**:运行在端口上的网络服务(如 SSH、HTTP、PostgreSQL 等)
- **指纹识别**:检测并识别服务类型、版本和配置
- **插件**:特定协议的检测模块
- **快速模式**:仅扫描每个协议的默认端口(80/20 优化)
- **传输层**:网络层协议(TCP、UDP 或 SCTP)
## 支持
如果您觉得 Nerva 有用,请考虑给它一个 star:
[](https://github.com/praetorian-inc/nerva)
## 贡献
我们欢迎您的贡献!有关指南,请参阅 [CONTRIBUTING.md](CONTRIBUTING.md)。
## 许可证
Apache 2.0 — 详情见 [LICENSE](LICENSE)。
## 致谢
Nerva 是 [fingerprintx](https://github.com/praetorian-inc/fingerprintx) 的一个维护分支,最初由 Praetorian 的 2022 届实习生班级开发:
* [Soham Roy](https://github.com/praetorian-sohamroy)
* [Jue Huang](https://github.com/jue-huang)
* [Henry Jung](https://github.com/henryjung64)
* [Tristan Wiesepape](https://github.com/qwetboy10)
* [Joseph Henry](https://github.com/jwhenry28)
* [Noah Tutt](https://github.com/noahtutt)
* [Nathan Sportsman](https://github.com/nsportsman)标签:C2日志可视化, EVTX分析, EVTX分析, Go语言, Nerva, Praetorian, SCTP, TCP, UDP, URL短链接分析, 协议分析, 威胁情报, 密码管理, 工业协议, 应用层协议, 开发者工具, 指纹库, 指纹识别, 插件系统, 数据统计, 文档结构分析, 日志审计, 服务探测, 权限提升, 程序破解, 端口扫描, 结构化查询, 网络安全, 网络资产, 自动化安全, 请求拦截, 隐私保护