Chocapikk/cewlai

GitHub: Chocapikk/cewlai

一款将 CeWL 与 CUPP 能力合并并增强 AI 的 Go 二进制工具,用于自动化爬取、秘密扫描与智能生成攻击单词表。

Stars: 1 | Forks: 0

# CeWL AI [![Go CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/04/2b935a0fa3051830.svg)](https://github.com/Chocapikk/cewlai/actions/workflows/go.yml) [![Release](https://img.shields.io/github/v/release/Chocapikk/cewlai)](https://github.com/Chocapikk/cewlai/releases) [![Go Report Card](https://goreportcard.com/badge/github.com/Chocapikk/cewlai)](https://goreportcard.com/report/github.com/Chocapikk/cewlai) [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT) 将 CeWL + CUPP 合并为单个 Go 二进制文件。爬取 HTTP、FTP、SFTP、SMB 和 S3 目标,解析 10+ 种内容格式,提取电子邮件、元数据和秘密(800+ trufflehog 检测器),使用 6 个提供者或本地模型生成 AI 增强的单词列表,并对密码进行变异——所有功能通过一条命令完成。 基于经典的 [CeWL](https://github.com/digininja/CeWL) 概念,从头用 Go 重写。 ## 安装 ``` go install github.com/Chocapikk/cewlai/cmd/cewlai@latest ``` 或者从源码构建: ``` git clone https://github.com/Chocapikk/cewlai.git cd cewlai go build -o cewlai ./cmd/cewlai ``` ## 用法 ### 单词列表生成 ``` # 基本爬取(经典 CeWL 模式) cewlai -u https://example.com # 使用 AI 增强 cewlai -u https://example.com --ai -p groq # 使用密码变异(类似 CUPP) cewlai -u https://example.com --ai -p groq --mutate ``` ### 秘密扫描 ``` # 扫描网站以泄露 API 密钥、令牌、凭据 cewlai -u https://example.com --secrets # 扫描内部文件共享 cewlai -u smb://user:pass@192.168.1.10/data --secrets --secrets-file findings.txt # 扫描 FTP 服务器 cewlai -u ftp://anonymous@ftp.example.com --secrets ``` ### 多协议爬取 ``` # FTP cewlai -u ftp://anonymous@ftp.example.com cewlai -u ftp://user:pass@ftp.example.com/share/docs # SMB cewlai -u smb://user:pass@192.168.1.10/data cewlai -u smb://DOMAIN\\user:pass@host/share/path # SFTP cewlai -u sftp://user:pass@host/path/to/files cewlai -u sftp://user:pass@host:2222/home/user/data # S3(AWS、MinIO、任何 S3 兼容) cewlai -u s3://bucket-name cewlai -u s3://bucket-name/prefix?region=eu-west-1 cewlai -u 's3://bucket?endpoint=http://minio:9000' --auth-user KEY --auth-pass SECRET ``` ### 文件导出 ``` # 将 S3 存储桶中的所有文件转储到磁盘 cewlai -u s3://bucket-name --dump /tmp/loot --secrets # 镜像文件共享 cewlai -u smb://user:pass@192.168.1.10/data --dump /tmp/share # 转储网站(保存所有响应) cewlai -u https://example.com --dump /tmp/site ``` ### 电子邮件和元数据提取 ``` cewlai -u https://example.com --email --email-file emails.txt cewlai -u https://example.com --meta --meta-file metadata.txt ``` ### AI 增强 ``` export GROQ_API_KEY=gsk_... cewlai -u https://example.com --ai -p groq ``` ### 完整示例 ``` cewlai -u https://example.com -d 3 --ai -p anthropic -m haiku \ --lowercase --email --meta --secrets --mutate \ -o wordlist.txt --email-file emails.txt --secrets-file secrets.txt ``` ## 参数 ``` Usage: cewlai [] [flags] AI-Powered Wordlist Generator & Target Recon Tool Arguments: [] Target URL to crawl Flags: -h, --help Show context-sensitive help. Target -u, --url=STRING Target URL to crawl -d, --depth=2 Crawl depth -o, --output=STRING Output file (default: stdout) -v, --verbose Verbose output --version Print version and exit --update Self-update to latest release Crawling --user-agent="cewlai/1.0" User agent for crawler --offsite Follow offsite links --proxy=STRING HTTP proxy URL --auth-type=STRING Auth type: basic --auth-user=STRING Auth username --auth-pass=STRING Auth password --header=HEADER,... Custom header (repeatable, Key: Value) --exclude=STRING File with paths to exclude --max-pages=0 Maximum pages to crawl (0 = no limit) --max-files=0 Maximum files to process for FTP/SFTP/SMB (0 = no limit) -t, --threads=2 Number of concurrent crawl threads --no-cache Disable crawl cache --cache-ttl=60 Cache TTL in minutes --dump=STRING Dump all crawled files to directory Extraction -e, --email Extract email addresses --email-file=STRING Write emails to file -a, --meta Extract document metadata --meta-file=STRING Write metadata to file -s, --secrets Extract secrets (API keys, tokens, passwords) via trufflehog detectors --secrets-file=STRING Write secrets to file --capture-paths Add URL path components to wordlist --capture-subdomains Add subdomains to wordlist --capture-domain Add domain to wordlist Words --min-word-length=3 Minimum word length --max-word-length=0 Maximum word length (0 = no limit) --lowercase Lowercase all words --with-numbers Include words with numbers -c, --count Show word frequency count -g, --groups=0 Generate word groups of N --mutate Generate word mutations (leet, reverse, suffixes like CUPP) --mutate-config=STRING Custom mutation config file (JSON) AI --ai Enable AI enrichment -p, --provider=STRING AI provider: anthropic, openai, groq, openrouter, cerebras, huggingface -m, --model=STRING Model name or shorthand --api-key=STRING API key (or use env vars) --base-url=STRING Custom API base URL for OpenAI-compatible endpoints --list-models List available models for the selected provider --mode="default" AI prompt mode: default, passwords, dirs, subdomains, geo --prompt=STRING Custom AI system prompt (overrides --mode) --ai-words=200 Number of AI-generated words --ai-context=4000 Max characters of context sent to LLM ``` ## 安全与隐私 ## AI 提供商 ### 付费 | 提供商 | 标志 | 模型 | | --------- | ---------------- | ---------------------------------------------------------------------------------------------- | | Anthropic | `-p anthropic` | `haiku`, `sonnet`, `opus` | | OpenAI | `-p openai` | `gpt-4.1-mini`, `gpt-4.1`, `gpt-4.1-nano`, `gpt-4o-mini`, `gpt-4o`, `o3-mini`, `o3`, `o4-mini` | ### 免费(无需信用卡) | 提供商 | 标志 | 默认模型 | 环境变量 | | --------- | ---------------- | ------------------- | -------------------- | | Groq | `-p groq` | llama-3.3-70b-versatile | `GROQ_API_KEY` | | OpenRouter | `-p openrouter` | openrouter/free | `OPENROUTER_API_KEY` | | Cerebras | `-p cerebras` | llama-3.3-70b | `CEREBRAS_API_KEY` | | HuggingFace | `-p huggingface` | Llama-3.3-70B-Instruct | `HF_TOKEN` | ### 本地(Ollama、LM Studio、vLLM) ``` cewlai -u https://example.com --ai -p openai -m llama3 --base-url http://localhost:11434/v1 --api-key dummy ``` ### 代理与 Tor `--proxy` 参数原生支持 HTTP、HTTPS 和 SOCKS5 代理: ``` # HTTP 代理 cewlai -u https://example.com --proxy http://127.0.0.1:8080 # Tor(SOCKS5) cewlai -u https://example.com --proxy socks5://127.0.0.1:9050 ``` ## AI 模式 | 模式 | 描述 | | ------------ | ----------------------------------------------------------- | | `default` | 通用上下文词、行业术语、密码模式 | | `passwords` | 基于组织上下文的可能密码 | | `dirs` | 隐藏目录、端点、备份文件 | | `subdomains` | 目标的可能子域名 | | `geo` | 基于位置的地理密码模式 | 自定义提示:`--prompt "Your custom system prompt here"` ## AI 增强如何工作 1. 爬虫访问页面并从所有来源(HTML、JS、XML、JSON、CSS、元数据、子标题)收集每页文本 2. 通过从所有爬取的页面中均匀采样文本来构建上下文摘要(随机顺序,默认 4000 字符,可通过 `--ai-context` 配置)。这确保了 LLM 能看到站点的完整范围,而不仅仅是前几页 3. 将上下文与专用提示一起发送给 LLM(逗号分隔输出以节省令牌)。工具会重试直到达到精确的请求单词数(`--ai-words`),并在各次尝试间去重 4. LLM 生成与上下文相关但**不在站点上**的单词:行业术语、可能密码、角色名称、产品名称、日期模式、地点词汇 5. 爬取结果会本地缓存(默认 60 分钟 TTL,`--no-cache` 可绕过)。对同一目标运行不同的 AI 模式会立即重用缓存的爬取结果 6. 爬取结果与 AI 生成的单词合并、去重并排序 ## 与 CeWL 的功能对比 | 功能 | CeWL | CeWL AI | | -------------------------- | ---------------- | ------------------------------------------- | | Web 爬取 | 是 | 是 | | 单词提取 | 是 | 是(goquery、更佳解析) | | 电子邮件提取 | 是 | 是(+ 解混淆:`[at]`、`(at)` 等) | | 文档元数据 | 是(exiftool) | 是(原生 Go,无外部依赖) | | URL 组件捕获 | 是 | 是 | | 单词分组 | 是 | 是 | | 单词计数 | 是 | 是 | | 代理/认证/头部 | 是 | 是 | | AI 增强 | 否 | 是(6 个提供者 + 本地) | | AI 提示模式 | 否 | 是(5 种模式 + 自定义) | | 单一二进制 | 否(Ruby + gems) | 是(Go) | | 自动更新 | 否 | 是 | | 跳过 TLS | 否 | 是 | | 模糊电子邮件检测 | 否 | 是 | | JavaScript 解析 | 否 | 是(jsluice、内联 + 外部 .js) | | XML/RSS/Atom/SVG 解析 | 否 | 是(站点地图、Feed、SVG 文本) | | JSON 解析 | 否 | 是(API、清单、配置) | | CSS 解析 | 否 | 是(选择器、变量、URL、注释) | | 音频/视频 元数据 | 否 | 是(ID3、MP4、OGG - 标题、艺术家、专辑) | | 字幕提取 | 否 | 是(VTT + SRT 转录文本) | | 单词变异(CUPP 类似) | 否 | 是(leet、反转、后缀、自定义 JSON) | | AI 单词计数控制 | 否 | 是(`--ai-words` 带重试循环) | | AI 上下文控制 | 否 | 是(`--ai-context` 可配置) | | Token 优化 | 否 | 是(逗号分隔输出) | | 模型列表 | 否 | 是(`--list-models` 查询提供者 API) | | API 密钥验证 | 否 | 是(提示设置哪个环境变量) | | Tor/SOCKS5 代理 | 否 | 是(`--proxy socks5://...`) | | 并发爬取 | 否(顺序) | 是(`-t` 可配置线程) | | FTP 爬取 | 否 | 是(匿名 + 认证、并行下载) | | SMB 爬取 | 否 | 是(SMB2/3、NTLMv2 认证、URL 凭证) | | SFTP 爬取 | 否 | 是(SSH 密码认证、自定义端口) | | S3 爬取 | 否 | 是(AWS、MinIO、S3 兼容、前缀过滤) | | 资源跟随 | `` 仅 | `` 导航 + 独立收集器用于 `