Information Gatheringsecretsgitcredentialsrepositoriesscanning

TruffleHog

TruffleHog searches through git repositories for secrets, digging deep into commit history and branches. It is effective at finding secrets accidentally committed.

Description

TruffleHog is a utility designed to detect credentials and secrets within various sources, particularly git repositories. It scans commit history and branches to identify accidentally committed sensitive information, making it valuable for security audits and compliance checks.

Use cases include scanning personal or organizational git repositories, GitHub, GitLab, filesystems, S3 buckets, and more specialized sources like Docker images, Jenkins, and HuggingFace datasets. This helps prevent exposure of API keys, passwords, and other secrets in version control systems.

The tool supports multiple scan types through distinct commands, allowing targeted searches across different platforms and input methods, from stdin to multi-source configurations.

How It Works

TruffleHog finds credentials by scanning git repositories deeply into commit history and branches, as well as other sources like filesystems, cloud storage, and APIs. It uses pattern matching for known secret formats and outputs results in formats like JSON. Specialized commands handle platform-specific scans, such as GitHub experimental modules or token-authenticated GitLab searches.

Installation

bash
sudo apt install trufflehog

Flags

-h, --[no-]helpShow context-sensitive help (also try --help-long and --help-man).
--log-level=0Logging verbosity on a scale of 0 (info) to 5 (trace). Can be disabled with "-1".
--[no-]profileEnables profiling and sets a pprof and fgprof server on :18066.
-j, --[no-]jsonOutput in JSON format.
--[no-]json-legacyUse the pre-v3.0 JSON format. Only works with [...more flags — see man page...]

Examples

Show usage and help information for TruffleHog.
trufflehog -h
Find credentials in git repositories.
trufflehog git <uri>
Find credentials in GitHub repositories.
trufflehog github
Run an experimental GitHub scan. Must specify at least one experimental sub-module like object-discovery.
trufflehog github-experimental --repo=REPO
Find credentials in GitLab repositories.
trufflehog gitlab --token=TOKEN
Find credentials in a filesystem.
trufflehog filesystem <path>
Find credentials from stdin.
trufflehog stdin
Updated 2026-04-16kali.org ↗