Sherlock 项目使用教程
1. 项目的目录结构及介绍
sherlock/
├── .github/
│ └── workflows/
├── data/
│ └── user_agents.json
├── sherlock/
│ ├── __init__.py
│ ├── analyze_data.py
│ ├── const.py
│ ├── result_serializer.py
│ ├── sherlock.py
│ ├── sites.py
│ └── utils.py
├── tests/
│ ├── __init__.py
│ ├── test_analyze_data.py
│ ├── test_const.py
│ ├── test_result_serializer.py
│ ├── test_sherlock.py
│ ├── test_sites.py
│ └── test_utils.py
├── .gitignore
├── LICENSE
├── README.md
├── requirements.txt
├── setup.py
└── sherlock.py
- .github/workflows/: 包含 GitHub Actions 的工作流配置文件。
- data/: 包含用户代理字符串的 JSON 文件。
- sherlock/: 包含项目的主要代码文件。
- tests/: 包含项目的测试代码文件。
- .gitignore: Git 忽略文件配置。
- LICENSE: 项目许可证。
- README.md: 项目说明文档。
- requirements.txt: 项目依赖包列表。
- setup.py: 项目安装脚本。
- sherlock.py: 项目的主启动文件。
2. 项目的启动文件介绍
sherlock.py
是 Sherlock 项目的主启动文件。它包含了主要的逻辑和命令行接口。用户可以通过运行此文件来启动 Sherlock 项目,进行用户名搜索。
# sherlock.py
import argparse
import os
import sys
import json
import time
import requests
from sherlock import Sherlock
def main():
parser = argparse.ArgumentParser(description="Sherlock: Find Usernames Across Social Networks")
parser.add_argument("username", nargs="+", help="Username(s) to search for")
parser.add_argument("--site", action="append", default=[], help="Specific site(s) to search on")
parser.add_argument("--proxy", help="Proxy to use for requests")
parser.add_argument("--tor", action="store_true", help="Use Tor for requests")
parser.add_argument("--unique-tor", action="store_true", help="Use a new Tor circuit for each request")
parser.add_argument("--json", help="Output results to a JSON file")
parser.add_argument("--folderoutput", help="Folder to store text files with the results")
parser.add_argument("--csv", help="Output results to a CSV file")
parser.add_argument("--xlsx", help="Output results to a XLSX file")
parser.add_argument("--timeout", type=int, default=60, help="Timeout in seconds")
parser.add_argument("--print-all", action="store_true", help="Print results for all sites")
parser.add_argument("--print-found", action="store_true", help="Print results for found sites only")
parser.add_argument("--no-color", action="store_true", help="Don't color terminal output")
parser.add_argument("--browse", action="store_true", help="Browse to sites with found usernames")
parser.add_argument("--local", action="store_true", help="Force the use of the local data.json file")
parser.add_argument("--nsfw", action="store_true", help="Include NSFW sites")
parser.add_argument("--verbose", action="store_true", help="Display extra information about the search")
args = parser.parse_args()
sherlock = Sherlock(args)
sherlock.run()
if __name__ == "__main__":
main()
3. 项目的配置文件介绍
Sherlock 项目的主要配置文件是 data/user_agents.json
,它包含了用于请求的用户代理字符串列表。这个文件用于随机选择用户代理字符串,以避免被网站识别为机器人。
{
"user_agents": [
"Mozilla/5.0 (Windows NT 10.0; Win