Titus 是一个高性能秘密扫描器,可检测源代码、文件和 Git 历史中的凭据、API 密钥和令牌。它内置 487 条检测规则,覆盖数百种服务和凭据类型,规则来源于 NoseyParker 和 Kingfisher。Titus 可以以 CLI、Go 库、Burp Suite 扩展和 Chrome 浏览器扩展的形式运行——所有接口共享相同的检测引擎和规则集。
专为安全工程师、渗透测试人员和 DevSecOps 团队设计,Titus 结合了 Hyperscan/Vectorscan 加速的正则表达式匹配与实时凭据验证功能,可在整个代码库中查找并验证泄露的秘密。
从 Releases 页面下载预编译二进制文件,或从源码构建:```bash make build
The binary will be at `dist/titus`.
## 快速开始```bash
# Scan a file for secrets
titus scan path/to/file.txt
# Scan a directory for leaked credentials
titus scan path/to/directory
# Scan a public GitHub repository (no token needed)
titus scan github.com/org/repo
# Scan a public GitLab project (no token needed)
titus scan gitlab.com/namespace/project
# Scan git history for secrets in past commits
titus scan --git path/to/repo
# Scan a Docker / OCI image (pulled from a registry — no docker daemon required)
titus scan --docker alpine:latest
# Validate detected secrets against source APIs
titus scan path/to/code --validate
结果写入数据存储(默认为 titus.ds)并输出到控制台。
通过URL直接扫描公共仓库——无需API令牌:```bash
titus scan github.com/kubernetes/kubernetes
titus scan gitlab.com/gitlab-org/cli
titus scan https://github.com/org/repo titus scan https://gitlab.com/namespace/project.git
对于组织范围或用户范围的扫描,请使用专门子命令:```bash
# Scan all public repos in a GitHub org
titus github --org kubernetes
# Scan all repos in a GitHub org with a token (private repos + higher rate limits)
titus github --org kubernetes --token $GITHUB_TOKEN
# Scan all repos for a GitHub user
titus github --user octocat
# Scan all projects in a GitLab group
titus gitlab scan --group mygroup --token $GITLAB_TOKEN
# Scan a single repo with git history (finds deleted secrets)
titus github owner/repo --git
令牌对于公共仓库是可选的。对于私有仓库访问和更高的API速率限制,请设置GITHUB_TOKEN或GITLAB_TOKEN(或使用--token)。
直接扫描容器镜像——无需docker守护进程,无需docker二进制文件。Titus直接从任何OCI注册表通过HTTPS拉取镜像(使用~/.docker/config.json中的凭据),或从本地docker save的tarball或OCI镜像布局目录读取镜像。然后它扫描镜像清单/配置元数据以及每一层的每个常规文件,包括被后续层删除的低层文件(因为秘密可能仍然可以从镜像历史中恢复)。```bash
titus scan --docker alpine:latest titus scan docker://ghcr.io/owner/repo:tag
titus scan --docker ./my-app.tar
titus scan --docker ./img/
认证使用您现有的 Docker / Podman 配置(`~/.docker/config.json`、`${XDG_RUNTIME_DIR}/containers/auth.json`)。需要重新登录的私有仓库应首先通过 `docker login`(或 `podman login`、`crane auth login`)进行认证——titus 不会提示输入凭据。
### 查看扫描结果
使用 `report` 重新读取之前扫描的发现:```bash
# Human-readable summary of detected secrets
titus report
# JSON output for programmatic processing
titus report --format json
# SARIF output for CI/CD integration with GitHub Advanced Security
titus report --format sarif
# Report from a specific datastore
titus report --datastore path/to/titus.ds
你可以在扫描时使用 --format 控制输出格式。```bash
titus scan path/to/code --format json
### 验证检测到的秘密
在扫描时传递 `--validate` 以针对其源 API 检查检测到的秘密:```bash
titus scan path/to/code --validate
验证并行运行(默认4个工作线程,可通过--validate-workers配置),并将每个发现标记为已确认、已拒绝或未知。
titus rules list
titus scan path/to/code --rules-include "aws,gcp"
titus scan path/to/code --rules-exclude "kingfisher.generic"
titus scan path/to/code --rules path/to/custom-rules.yaml
titus scan path/to/code --include-noisy
### 从二进制文件中提取秘密
Titus 可以从二进制文件格式中提取文本并扫描其中的秘密:```bash
# Extract and scan all supported binary formats
titus scan path/to/files --extract=all
# Target specific formats
titus scan path/to/files --extract=xlsx,docx,pdf,zip
支持的格式包括 Office 文档(xlsx, docx, pptx, odp, ods, odt)、PDF、Jupyter 笔记本、SQLite 数据库、电子邮件(eml, rtf)以及归档文件(zip, tar, tar.gz, jar, war, ear, apk, ipa, crx, xpi, 7z)。归档文件会递归解压,深度和大小限制可配置。```bash
titus scan path/to/files --extract=all
--extract-max-size 10MB
--extract-max-total 100MB
--extract-max-depth 5
对于SQLite数据库,Titus从所有表中提取文本(默认每个表1000行)。使用 `--sqlite-row-limit` 来调整:```bash
# Full dump of all SQLite tables (no row limit)
titus scan path/to/files --extract=all --sqlite-row-limit 0
# Custom row limit per table
titus scan path/to/files --extract=all --sqlite-row-limit 5000
Titus 生成的每个发现都带有一个 0–100 的数字分数和一个严重级别等级:
| 分数 | 严重级别 |
|---|---|
| 0–20 | 信息 |
| 21–40 | 低 |
| 41–60 | 中等 |
| 61–80 | 高 |
| 81–100 | 严重 |
分数从规则的 base_score 开始,并通过 modifiers 进行调整——这些条件会根据关于凭证的已知信息来提高或降低分数:```bash
titus scan path/to/code
titus scan path/to/code --score-scope
titus scan path/to/code --accessibility public # no penalty for public repos titus scan path/to/code --accessibility private # -25 penalty (default for local scans)
Titus 附带用于 AWS 凭证、GitHub PAT 和 Slack 令牌的 YAML 评分器,以及基于 Go 的 SDK 评分器,当启用 `--score-scope` 时,这些评分器可执行实时 IAM 策略枚举(AWS)和仓库权限检查(GitHub 细粒度 PAT)。
请参阅 [docs/scoring.md](https://github.com/praetorian-inc/titus/blob/HEAD/docs/scoring.md) 获取完整参考:严重性级别、修饰符类型、内置评分器详情,以及如何编写您自己的 YAML 或 Go 评分器。
## 用于秘密检测的 Go 库
Titus 可以作为 Go 库导入,为您的自有工具和管道添加秘密检测功能。```bash
go get github.com/praetorian-inc/titus
import ( "fmt" "log"
"github.com/praetorian-inc/titus"
)
func main() { // Initialize the secrets scanner with default rules scanner, err := titus.NewScanner() if err != nil { log.Fatal(err) } defer scanner.Close()
// Scan a string for API keys, tokens, and credentials
matches, err := scanner.ScanString(`aws_access_key_id = AKIAIOSFODNN7EXAMPLE`)
if err != nil {
log.Fatal(err)
}
for _, match := range matches {
fmt.Printf("%s (rule: %s) at line %d\n",
match.RuleName, match.RuleID,
match.Location.SourceSpan.Start.Line,
)
}
}
该库还支持扫描字节和文件、验证检测到的秘密以及加载自定义规则:```go
// Scan a file for leaked credentials
matches, err := scanner.ScanFile("/path/to/config.json")
// Enable validation to check if detected secrets are live
scanner, err := titus.NewScanner(titus.WithValidation())
// Load custom detection rules for organization-specific secrets
rules, err := titus.LoadRulesFromFile("/path/to/rules.yaml")
scanner, err := titus.NewScanner(titus.WithRules(rules))
请参阅 docs/library-usage.md 获取完整的API参考、并发模式及更多示例。
该Burp扩展在代理流量和主动渗透测试期间扫描HTTP响应中的秘密。
make install-burp
然后在 Burp Suite 的 Extensions > Add 中加载 `dist/titus-burp-1.0.0-all.jar`。
#### Windows (从 Releases 下载)
1. 从 [Releases](https://raw.githubusercontent.com/praetorian-inc/releases) 下载 `titus-windows-amd64.exe` 和 `titus-burp-<version>.jar`
2. 创建 Titus 目录并安装二进制文件: ```powershell
mkdir %USERPROFILE%\.titus
copy titus-windows-amd64.exe %USERPROFILE%\.titus\titus.exe
titus-burp-<version>.jar from Releases:
titus-linux-amd64 or titus-linux-arm64 for Linuxtitus-darwin-amd64 or titus-darwin-arm64 for macOS该扩展会在后台启动一个 titus serve 进程,并通过 NDJSON 格式在标准输入/输出上进行通信。检测规则在启动时一次性加载。
该扩展在 Burp 中添加了一个 Titus 标签页,包含三个子标签页:
Secrets: 所有检测到的秘密,可按类型、主机和验证状态进行筛选。
Titus Burp Suite 扩展秘密标签页,显示检测到的 API 密钥和凭据及其验证状态
Statistics: 按类型和主机分组的秘密聚合视图。
Settings: 配置扫描选项、验证和严重级别映射。
Titus Burp Suite 扩展设置标签页,包含扫描配置选项
在 Burp 中查看任何请求时,如果检测到秘密,响应检查器会出现一个 Titus 标签页,方便快速访问发现结果,而无需切换到主 Titus 标签页。
Burp Suite 响应检查器中的 Titus 标签页,高亮显示 HTTP 响应中检测到的秘密
Chrome 扩展程序在 Web 应用程序安全评估期间扫描网页中的秘密。
make build-extension
1. 导航到 `chrome://extensions/`
2. 启用 **开发者模式**
3. 点击 **加载已解压的扩展程序**,然后选择 `extension/` 目录
### 浏览器扩展功能
- 扫描内联和外部 JavaScript 及样式表,查找 API 密钥和令牌
- 扫描 localStorage 和 sessionStorage 中泄露的凭据
- 可选网络响应捕获,用于全面检测秘密信息
- 结果显示在弹出窗口和仪表板中
<img width="1719" height="958" alt="Titus Chrome 扩展弹出窗口,显示在网页上检测到的秘密信息" src="https://assets.kitploit.com/production/public/readmes/11969/057a24e2746412ceabe1aac0292a2de463de1efee5bca2489ca34b59d8b0dc2c.png" />
<img width="1744" height="827" alt="Titus Chrome 扩展仪表板,汇总显示秘密检测结果" src="https://assets.kitploit.com/production/public/readmes/11969/265d972fadcc7f212944d7a1d8fd58a43446e7199d1209900e83b96a546ffb00.png" />
### 安全说明
该浏览器扩展会移除所访问页面的内容安全策略和 CORS 标头,以便扫描外部资源。这会在扩展处于活动状态时削弱访问网站的安全状况。**请仅在主动进行安全测试时启用。**
## 从源码构建
### 标准构建(Vectorscan 加速)
默认情况下,Titus 使用 [Vectorscan](https://github.com/VectorCamp/vectorscan)(ARM)或 [Hyperscan](https://github.com/intel/hyperscan)(x86)编译,以实现 SIMD 加速的正则匹配。这需要 CGO、C 库以及 `pkg-config`(cgo 用它来定位库)。`make build` 会检查这些依赖,并尝试通过 Homebrew / apt / dnf 安装缺失的组件:```bash
# Build the CLI binary with vectorscan acceleration (outputs to dist/titus)
make build
# Build the Burp Suite extension JAR
make build-burp
# Build the Chrome browser extension
make build-extension
# Run unit tests
make test
# Run integration tests
make integration-test
您会在启动时看到 [vectorscan] N/N rules compiled for Hyperscan,表示加速引擎已激活。
要自行安装 C 库而不是依赖自动安装:```bash
brew install pkg-config vectorscan
sudo apt-get install pkg-config libhyperscan-dev
sudo dnf install pkgconf-pkg-config vectorscan-devel
git clone --depth 1 --branch vectorscan/5.4.11 https://github.com/VectorCamp/vectorscan.git cd vectorscan && cmake -B build -DCMAKE_INSTALL_PREFIX=/usr/local && cmake --build build && sudo cmake --install build
如果你直接调用 `go build`(例如,在嵌入 Titus 时),请传递标签并启用 CGO:```bash
# macOS (Homebrew) — adjust PKG_CONFIG_PATH to your installed version
CGO_ENABLED=1 PKG_CONFIG_PATH="$(brew --prefix vectorscan)/lib/pkgconfig" \
go build -tags vectorscan -o dist/titus ./cmd/titus
# Linux (system-installed)
CGO_ENABLED=1 go build -tags vectorscan -o dist/titus ./cmd/titus
如果你无法安装C库——或者想要一个完全可移植的静态二进制文件——请改为构建纯Go引擎。每当vectorscan未被编译进来时,Titus在运行时会自动回退到该引擎:```bash
make build-pure
make build-static
## 贡献
欢迎贡献!请参阅 [CONTRIBUTING.md](https://github.com/praetorian-inc/titus/blob/HEAD/CONTRIBUTING.md) 了解如何为 Titus 做出贡献的指南。
## 许可证
Apache License 2.0 — 参见 [LICENSE](https://github.com/praetorian-inc/titus/blob/HEAD/LICENSE)。
检测规则源自 [NoseyParker](https://github.com/praetorian-inc/noseyparker)(Praetorian Security, Inc.)和 [Kingfisher](https://github.com/mongodb/kingfisher)(MongoDB, Inc.),两者均采用 Apache 2.0 许可证。完整署名信息请参见 [NOTICE](https://github.com/praetorian-inc/titus/blob/HEAD/NOTICE)。