Maigret 是一款强大的开源 OSINT(开源情报)工具,仅凭一个用户名就能在 3000+ 网站上查找对应账号,并从公开页面提取个人信息、链接等数据,生成完整档案。它是 Sherlock 的增强版,无需任何 API 密钥,支持递归搜索、标签过滤、多种报告格式、Web 界面、AI 分析等功能。

重要声明:本工具仅供教育与合法用途。使用时请严格遵守当地法律法规(如 GDPR、CCPA 等)。作者不对任何滥用行为负责。

官方仓库:https://github.com/soxoj/maigret 文档:https://maigret.readthedocs.io/en/latest/


1. 核心特性

  • 支持 3000+ 站点(完整列表见仓库 sites.md)。默认只扫描流量排名前 500 的热门站点,加 -a 可全量扫描。
  • 从个人主页和 API 中提取详细信息(头像、注册时间、粉丝数、简介、其他社交链接等)。
  • 递归搜索:发现新用户名或 ID 后自动继续搜索。
  • 支持按标签(分类/国家)过滤站点。
  • 检测并部分绕过封锁、审查、CAPTCHA。
  • 自动从 GitHub 更新站点数据库(每 24 小时一次)。
  • 支持 Tor / I2P 站点、域名检查。
  • 内置 Web 界面,可查看结果图谱并下载多种报告。
  • 可选 AI 分析模式(–ai),生成简短调查摘要。
  • 可作为 Python 库嵌入其他项目。

2. 安装方法

要求:Python 3.10 或更高(推荐 3.11)。

2.1 一分钟快速安装(推荐)

1
2
pip install maigret
maigret YOUR_USERNAME

如需 PDF 报告支持:

1
pip install 'maigret[pdf]'

2.2 Windows 独立可执行文件

Releases 下载 maigret_standalone.exe:

  • 双击运行:输入用户名即可。
  • 命令行运行:
1
2
3
4
cd %USERPROFILE%\Downloads
maigret_standalone.exe USERNAME
maigret_standalone.exe USERNAME --html
maigret_standalone.exe --help

视频教程:https://youtu.be/qIgwTZOmMmM

2.3 从源码安装

1
2
3
git clone https://github.com/soxoj/maigret && cd maigret
pip3 install .
maigret username

或直接:

1
pip3 install git+https://github.com/soxoj/maigret.git

2.4 Docker 方式

1
2
3
4
5
6
7
8
9
10
11
# 拉取官方镜像
docker pull soxoj/maigret

# CLI 使用(报告保存到本地目录)
docker run -v /mydir:/app/reports soxoj/maigret:latest username --html

# Web 界面(访问 http://localhost:5000)
docker run -p 5000:5000 soxoj/maigret:web

# 自定义端口
docker run -e PORT=8080 -p 8080:8080 soxoj/maigret:web

2.5 无需安装的替代方案

2.6 常见安装问题

  • 命令找不到:将 ~/.local/bin(Linux/macOS)或 %APPDATA%\Python\Scripts(Windows)加入 PATH,或使用 python3 -m maigret。
  • PDF 相关错误:安装系统依赖(Debian/Ubuntu:sudo apt install libcairo2-dev pkg-config python3-dev build-essential 等),详见官方安装文档。
  • 更多故障排除见仓库 TROUBLESHOOTING.md。

3. 基本使用

最简单命令:

1
maigret username

同时搜索多个用户名:

1
maigret user1 user2 user3

全量扫描所有站点:

1
maigret username -a

只扫描前 N 个热门站点:

1
maigret username --top-sites 1000

4. 常用命令与参数详解

4.1 报告生成

1
2
3
4
5
6
7
8
9
maigret user --html          # HTML 报告
maigret user --pdf # PDF 报告(需安装 pdf 额外包)
maigret user --xmind # XMind 思维导图(XMind 8 格式)
maigret user --csv # CSV
maigret user --txt # 纯文本
maigret user --json ndjson # 换行分隔 JSON(或 --json simple)
maigret user --md # Markdown(适合喂给 AI)
maigret user --graph # 交互式 D3 图谱(HTML)
maigret user --neo4j # Neo4j Cypher 脚本

指定输出目录:

1
maigret user --html -fo ./my_reports

4.2 标签过滤

1
2
3
4
5
6
7
8
# 只搜索带 photo 和 dating 标签的站点
maigret user --tags photo,dating

# 只搜索美国相关站点
maigret user --tags us

# 排除某些标签
maigret user --exclude-tags porn,dating

4.3 网络与代理

1
2
3
4
5
6
7
8
9
10
11
12
# 使用代理
maigret user --proxy socks5://127.0.0.1:1080
maigret user --proxy http://user:pass@proxy:port

# Tor(仅 .onion 站点)
maigret user --tor-proxy socks5://127.0.0.1:9050

# I2P
maigret user --i2p-proxy http://127.0.0.1:4444

# 整个流量走 Tor
maigret user --proxy socks5://127.0.0.1:9050 --timeout 60 --retries 2

4.4 其他实用参数

1
2
3
4
5
6
7
8
9
10
11
12
13
14
maigret user --timeout 60              # 超时时间(默认 30 秒)
maigret user -n 20 # 最大并发连接数(默认 100)
maigret user --retries 2 # 重试次数
maigret user --no-recursion # 关闭递归搜索
maigret user --print-not-found # 显示未找到的站点
maigret user --print-errors # 显示错误信息
maigret user --keywords python rust # 高亮包含关键词的页面
maigret user --permute # 生成用户名变体(需多个输入)
maigret --parse https://example.com/profile # 从页面提取 ID 并搜索
maigret --web 5000 # 启动 Web 界面
maigret user --ai # AI 分析(需 OPENAI_API_KEY)
maigret user --ai --ai-model gpt-4o-mini
maigret --self-check # 自检站点数据库
maigret --cloudflare-bypass username # 实验性 Cloudflare 绕过(需 FlareSolverr)

查看全部选项:

1
maigret --help

5. Web 界面使用

1
maigret --web 5000

浏览器打开 http://127.0.0.1:5000,输入用户名即可搜索,结果以图谱和表格展示,支持下载所有格式报告。

Docker 方式更方便:

1
docker run -p 5000:5000 soxoj/maigret:web

6. AI 分析模式

设置 API Key 后:

1
2
export OPENAI_API_KEY=sk-...
maigret username --ai

可在 settings.json 中配置 openai_api_key、openai_model、openai_api_base_url(支持任何 OpenAI 兼容接口)。AI 会输出姓名推测、地点、职业、兴趣、置信度及后续线索等摘要。


7. 高级技巧与最佳实践

  1. 结果不理想时:
    • 提高 –timeout 和 –retries。
    • 降低并发 -n 20。
    • 使用住宅代理(数据中心 IP 容易被 WAF 拦截)。
    • 换网络测试(手机热点通常效果最好)。
  2. 递归与提取:默认开启,能发现更多关联账号。可用 –no-recursion 关闭。
  3. 用户名变体
1
maigret --permute john doe

会生成 johndoe、j.doe、john_doe 等变体并搜索。

  1. 自定义数据库
1
maigret user --db /path/to/custom_data.json --no-autoupdate -a
  1. 作为库使用(Python):
1
2
3
4
5
6
7
8
import asyncio
from maigret import search

async def main():
results = await search(["username"])
print(results)

asyncio.run(main())

详见官方库使用文档。

  1. 维护相关:–self-check –auto-disable 可自动禁用失效站点。

8. 常见问题排查

问题 解决方法
大量超时 / 403 换网络、加代理、提高 timeout、降低并发
命令找不到 使用 python3 -m maigret 或配置 PATH
SSL 错误 pip install –upgrade certifi
PDF 生成失败 安装系统图形库 + pip install ‘maigret[pdf]’
数据库过旧 maigret user –force-update
Tor 无效 使用 –proxy 而非 torsocks

完整排查指南见:https://github.com/soxoj/maigret/blob/main/TROUBLESHOOTING.md


9. 参与贡献与商业使用

  • 贡献新站点:编辑 data.json,运行更新脚本后提交 PR。详见 CONTRIBUTING.md。
  • 商业用途:MIT 许可免费使用。如需每日更新的私有数据库或 API,可联系 maigret@soxoj.com

10. 总结与建议

Maigret 是目前功能最全面的用户名搜索工具之一,适合 OSINT 调查、渗透测试信息收集等场景。建议从默认前 500 站点开始,结合标签过滤和代理使用,再根据需要开启全量扫描和 AI 分析。

官方资源:

开始使用吧:

1
2
pip install maigret
maigret your_target_username --html