Gourav224/subdomain-enumeration
GitHub: Gourav224/subdomain-enumeration
基于 OWASP Amass 的子域名枚举 API 服务,提供自动化被动侦察与子域名存活验证,并通过 RESTful 接口返回结构化结果。
Stars: 1 | Forks: 0
# 子域名枚举 API
一个使用 OWASP Amass、Python 和 Express.js 的综合子域名枚举解决方案。本项目可自动对域名进行被动侦察,验证发现的子域名,并提供 RESTful API 以便集成。
## 🏗️ 架构
```
┌─────────────┐
│ Client │
└──────┬──────┘
│ HTTP/REST
▼
┌─────────────┐ ┌──────────────┐
│ Express API │────▶│ Python Script│
│ (Bun/TS) │ │ (enumerate) │
└──────┬──────┘ └──────┬───────┘
│ │
│ ▼
│ ┌──────────────┐
│ │ OWASP Amass │
│ │ (Docker) │
│ └──────────────┘
│
▼
┌─────────────┐
│ Outputs │
│ (JSON) │
└─────────────┘
```
## 🚀 安装说明
### 前置条件
- Docker 和 Docker Compose
- Bun runtime(或 Node.js 18+)
### 如何运行
**步骤 1:启动 Amass 容器**
```
cd docker
docker compose up -d
```
这将构建并启动包含所有必需依赖项的 Amass 容器。
**步骤 2:运行 API 服务器**
打开一个新终端,并使用 Bun 运行:
```
cd api
bun run src/index.ts
```
或者使用 Node.js:
```
cd api
npm install
npm run start
```
API 服务器将在 `http://localhost:3000` 上启动
**步骤 3:测试 API**
```
curl http://localhost:3000/health
```
你应该会看到:
```
{
"status": "healthy",
"timestamp": "2026-01-01T12:00:00.000Z",
"service": "subdomain-enumeration-api"
}
```
### 停止服务
要停止 Amass 容器:
```
cd docker
docker compose down
```
要停止 API 服务器,请在运行它的终端中按 `Ctrl+C`。
## 📚 API 文档
### Endpoint:`POST /enumerate`
开始对某个域名的子域名枚举。
#### 请求
```
curl -X POST http://localhost:3000/enumerate \
-H "Content-Type: application/json" \
-d '{"domain": "example.com"}'
```
**Request Body:**
```
{
"domain": "example.com"
}
```
#### 响应
```
{
"success": true,
"data": {
"domain": "example.com",
"timestamp": "2026-01-01T12:00:00.000Z",
"total_subdomains": 15,
"active_subdomains": 8,
"subdomains": [...],
"active": [...],
"inactive": [...]
},
"metadata": {
/* Processing metadata */
}
}
```
**Response Codes:**
- `200 OK` - 枚举成功完成
- `400 Bad Request` - 域名格式无效或缺少域名
- `500 Internal Server Error` - 枚举失败
标签:Docker, Express, OWASP Amass, Python, RESTful API, 主机安全, 子域名枚举, 安全侦察, 安全防御评估, 提示词优化, 无后门, 系统安全, 自动化攻击, 请求拦截, 逆向工具