osint-services/scan
GitHub: osint-services/scan
基于 WhatsMyName 数据集通过用户名在各网站搜索匹配结果的 Python OSINT 微服务,支持缓存和轮询机制。
Stars: 2 | Forks: 0
# 扫描
scan 是一个 OSINT 微服务,用于在 [WhatsMyName](https://github.com/WebBreacher/WhatsMyName) 数据集中搜索用户名在各网站上的匹配结果。
该服务使用数据库缓存搜索结果,因为验证用户名的成本较高且耗时。重复查询时会复用缓存结果,并提供刷新选项来重新构建结果。
该服务暴露了一个状态端点,以便客户端可以轮询长时间运行的搜索,而不必依赖单一的请求超时。
## 需求
- Python 3.9 或更高版本
### 技术栈
- 正在使用的 REST API 框架是 [FastAPI](https://fastapi.tiangolo.com/)
- 数据库引擎是 [SQLite](https://www.sqlite.org/index.html)
- 正在使用的 REST 客户端是 [httpx](https://www.python-httpx.org/)
### 设置
1. 创建 Python 虚拟环境。`python -m venv venv`
2. 激活虚拟环境。`source venv/bin/activate`
3. 安装依赖。`pip install -r requirements.txt`
4. 启动服务器。`fastapi dev main.py`
### 端点
- GET `/scan/{username}`
- 如果用户名尚未被缓存,则开始新的搜索。
- 当新的后台搜索启动时,返回 `202 Accepted`。
- 当用户名的搜索已在等待中或正在进行时,返回 `102 Processing`。
- 如果已搜索过该用户名且未请求刷新,则返回带有 `200 OK` 的缓存结果。
- 查询参数:
- `refresh`(`true` 或 `false`,默认为 `false`)——当设置为 `true` 时,缓存失效并重新构建用户名搜索。
- GET `/scan/status/{username}`
- 返回后台搜索的当前状态。
- 使用此端点轮询进度,直到搜索达到 `completed`。
### `/scan/{username}` 缓存时的示例响应
```
[
{
"title": "GitHub",
"uri": "https://github.com/osint-services",
"profile_url": "https://github.com/osint-services",
"category": "coding",
"search_timestamp": "2024-11-02 17:01:27",
"found_timestamp": "2024-11-02 17:01:28"
},
{
"title": "Facebook",
"uri": "https://facebook.com/osint-services",
"profile_url": "https://facebook.com/osint-services",
"category": "social",
"search_timestamp": "2024-11-02 17:01:27",
"found_timestamp": "2024-11-02 17:01:28"
}
]
```
### `/scan/status/{username}` 的示例响应
```
{
"status": "in_progress",
"found_sites": [
{
"title": "GitHub",
"uri": "https://github.com/osint-services",
"profile_url": "https://github.com/osint-services",
"category": "coding",
"search_timestamp": "2024-11-02 17:01:27",
"found_timestamp": "2024-11-02 17:01:28"
}
],
"total_sites": 200,
"checked_sites": 50
}
```
### 注意事项
- 该服务使用后台处理和轮询,而不是长时间运行的请求超时。
- 结果验证步骤会检查页面内容和常见的个人资料信号,以减少来自登录、未找到或通用着陆页的误报。
- 如果搜索失败,`GET /scan/status/{username}` 将返回 `failed` 状态,且响应中可能包含 `error` 字段。
标签:API服务, AV绕过, BeEF, ESC4, FastAPI, GitHub, httpx, OSINT, Python, SQLite, WhatsMyName, 个人信息收集, 侦察工具, 公开情报, 密码管理, 无后门, 爬虫, 用户名搜索, 缓存服务, 账户枚举, 运行时操纵, 逆向工具, 钓鱼信息收集, 防御框架