TruffleHog
Scan Git repositories and filesystems for leaked secrets, credentials, and API keys
Cloud & Assets12 commands
#secrets#credentials#git#leaks#scanning
Installation
1Install using Go
2Install using pip
3Download binary
4Verify installation
# Using Go
go install github.com/trufflesecurity/trufflehog/v3@latest
# Using pip
pip install trufflehog
# Using Docker
docker run --rm -it trufflesecurity/trufflehog:latest
# Verify
trufflehog --versionBasic Usage
Detect exposed secrets in Git repos, filesystems, and S3 buckets
# Scan a GitHub repo
trufflehog git https://github.com/user/repo
# Scan a GitLab repo
trufflehog git https://gitlab.com/user/repo --since-commit HEAD~10
# Scan filesystem recursively
trufflehog filesystem /path/to/directory
# Scan S3 bucket
trufflehog s3 --bucket=my-bucket
# Scan with JSON output
trufflehog git https://github.com/user/repo --json
# Scan for specific entropy level
trufflehog git https://github.com/user/repo --only-verifiedCommand Reference
12 commands
1Scan a Git repository
git2Scan local filesystem
filesystem3Scan AWS S3 buckets
s34Scan GitHub repos and orgs
github5Scan GitLab repos
gitlab6JSON output format
--json7Show only verified secrets
--only-verified8Number of concurrent workers
--concurrency9Scan from specific commit
--since-commit10Scan specific branch
--branch11File with paths to exclude
--exclude-paths12Skip secret verification
--no-verificationWhen to Use
1
Scanning organization repos for leaked credentials2
CI/CD pipeline integration for secret detection3
Post-compromise assessment of exposed secrets4
Third-party vendor security review5
Bug bounty recon for leaked API keysNotes & Tips
1
Uses entropy detection and pattern matching for finding secrets2
Can verify discovered secrets by attempting API calls3
Integrates with GitHub Actions, GitLab CI, and Jenkins4
Scans all commit history, not just the latest versionCommon Errors & Solutions
Too many false positives
Use --only-verified to show only confirmed secrets
Rate limited by GitHub
Reduce concurrency with --concurrency flag or use a token