trufflehogregexes is a Python package that provides the core regular expressions used by the TruffleHog secrets scanner. It offers a structured list of dictionaries, each containing a regex pattern, ID, name, and tags for various sensitive information. Currently at version 0.0.7, it has a low release cadence, primarily serving as a data dependency for the main TruffleHog application.
Install & Compatibility
Where this runs
tested against v0.0.7 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.910 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibcpy 3.10–3.910 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
from truffleHogRegexes import regexes
This example demonstrates how to import and inspect the `regexes` list. It also shows a basic way to iterate and apply one of the regexes using Python's `re` module, as the package only provides the patterns, not the matching logic.
from trufflehogregexes import regexes
# The 'regexes' variable is a list of dictionaries
print(f"Total regexes available: {len(regexes)}")
if regexes:
first_regex = regexes[0]
print(f"\nExample regex entry:")
print(f" ID: {first_regex.get('id')}")
print(f" Name: {first_regex.get('name')}")
print(f" Regex: {first_regex.get('regex')}")
print(f" Tags: {first_regex.get('tags')}")
# To actually use a regex, you'd compile and run it:
import re
test_string = "My private key is: AKIAIOSFODNN7EXAMPLE"
for r_entry in regexes:
pattern = r_entry.get('regex')
if pattern:
# Note: some regexes might require 're.DOTALL' or other flags
match = re.search(pattern, test_string)
if match:
print(f"\nMatch found for '{r_entry.get('name')}': {match.group(0)}")
break # Found one match for demonstration
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.