Skip to content
KitploitKITPLOIT
FerramentasBlog
Enviar
FerramentasBlog
Enviar

Ferramentas de Hacking, PenTest e Cibersegurança para o seu Arsenal de Segurança!

Kitploit é um diretório de ferramentas de hacking, cibersegurança e pentesting. Descubra as últimas atualizações de projetos para encontrar vulnerabilidades, analisar sistemas, automatizar testes e fortalecer sua segurança.

··Feeds·Contato·Privacidade·© 2026 Kitploit

Diretório de Ferramentas

Categorias

Ver todas as categorias
Loading categories
keyhog — Open-source secret scanner in Rust | Kitploit
Ferramentas/GitHubGitHub/santhreal/keyhog
Static AnalysisVulnerability ScannersContainer SecurityCode AnalysisConfiguration AuditingCloud SecurityDevSecOpsSecret DetectionThreat IntelligenceSupply Chain SecurityIncident Response
8813há 1 diaRevisado pelo Kitploit

Mais Populares

Ver todos →

Descubra as ferramentas mais usadas pela nossa comunidade.

Explore todas as ferramentas

Navegue pela nossa coleção de ferramentas

Ver todas as ferramentas →
Compartilhar
GitHub
santhreal/keyhog

keyhog

Open-source secret scanner in Rust

Ver RepositórioSite
Conteúdo não disponível no idioma solicitado. Mostrando versão em inglês.

KeyHog GPU-accelerated open-source secret scanner for code, Git history, cloud, containers, browser assets, and CI

KeyHog on crates.io  KeyHog documentation  CI  MIT OR Apache-2.0  GitHub stars and repository-owned star history

Website · Documentation · Architecture · Vyre GPU engine

KeyHog: GPU-accelerated secret scanner for code, cloud, and CI

KeyHog is an open-source secret scanner in Rust that finds and verifies leaked API keys, tokens, passwords, and credentials across source code, Git history, containers, cloud storage, browser assets, collaboration content, and running systems.

Most secret scanners stop at CPU regex matches in a repository checkout. KeyHog combines 926 service-specific detectors, decode-through for concealed credentials, context-aware evidence and suppression, live provider verification, and first-class CUDA, Metal, and WGPU execution through Vyre. Calibration measures every eligible pure-Rust CPU, Hyperscan/SIMD, and GPU backend. Automatic routing then uses the fastest parity-proven route for the exact host and workload class.

GPU is a real backendScan the actual attack surfaceSeparate signal from noiseAct on the result
CUDA, native Metal, and WGPU are measured peers, not a silent fallback chain.Scan Git history, Docker layers, archives, cloud buckets, source maps, WASM, HAR captures, hosted Git collections, and whole systems.Decode base64, hex, URL, protobuf, multiline, and structured configuration before applying evidence, example suppression, and baselines.Verify eligible credentials with provider APIs, emit SARIF or structured envelopes, and preserve exact coverage and exit semantics.
root@kitploit:~
cargo install --locked keyhog
keyhog scan .

KeyHog scan showing severity, evidence, file and line, remediation, results, and coverage status

A secret scanner built around the GPU

KeyHog does not hand a few regular expressions to a generic compute shader. Its GPU path is built on Vyre, a Rust GPU compute substrate developed alongside KeyHog. Detector triggers compile into immutable GPU-resident tables. Bounded source batches produce complete match positions for the same confirmation, suppression, evidence, and reporting pipeline used by CPU and Hyperscan routes.

  • Three physical GPU peers. CUDA, native Metal, and portable WGPU are acquired, measured, and reported independently.
  • Exact result parity. Calibration rejects a candidate whose finding identity differs from the reference route. A faster wrong answer never enters the routing table.
  • Persistent route evidence. KeyHog records the binary, detector corpus, configuration, workload class, host, accelerator, driver, and measured timing evidence. Normal scans do not benchmark in the hot path.
  • Resident execution. Daemon workers keep compiled detector and accelerator state warm for repeated file, archive, history, remote, and cloud batches.
  • No hidden CPU escape hatch. An explicitly selected accelerator that cannot initialize or dispatch fails visibly instead of returning CPU findings under a GPU label.

The default crates.io install uses the portable pure-Rust CPU route so it works on a clean Rust host. Enable the three GPU peers without acquiring Hyperscan:

root@kitploit:~
cargo install --locked keyhog --no-default-features --features portable,gpu

Run the production backend diagnostic, then inspect the measured route:

root@kitploit:~
keyhog backend --self-test
keyhog calibrate-autoroute --policy all
keyhog backend --autoroute --json

The backend guide documents the resident tables, bounded dispatch model, parity contract, and reproducible crossover evidence.

Get started

Install and run your first scan

The two commands above install the latest crates.io release and scan the current tree with the portable pure-Rust route.

Pin a CI environment to one exact release with cargo install --locked --version '=0.5.79' keyhog. KeyHog requires Rust 1.89 or newer. See the installation guide for GPU, Hyperscan, CI, portable, and source-build profiles.

KeyHog exits 1 when a finding blocks the active evidence policy. The default policy blocks likely and confirmed findings while keeping review findings visible with exit 0; --evidence-policy paranoid blocks every tier. Review each finding's exact evidence tier, reason code, file, line, detector, and remediation. Other nonzero codes describe input, system, verification, or coverage failures; see the exit-code reference.

The complete process contract is:

Filter, format, gate:

Create a baseline before using it as a filter:

root@kitploit:~
keyhog scan . --create-baseline .keyhog-baseline.json
keyhog scan . --baseline .keyhog-baseline.json --format json-envelope --output keyhog.json

The first command snapshots reviewed findings and exits 0 without printing them. Commit that file, then use the second command to report only new finding identities. A baseline entry matches on the detector and the credential value, never on the file path, so moving a recorded secret does not fail the gate but rotating it does. Changed credentials and incomplete coverage remain visible. The complete path, including monorepo partitions, is Fail only on new secrets.

For the next scan, use the recipes cookbook or the copyable commands in Choose the right workflow. You can scan Git history, container images, cloud buckets, repository collections, URLs, and a whole machine without changing tools.

Guard repositories for fast pre-commit scans

Register a repository with the perpetual KeyHog daemon for fast pre-commit secret detection (requires Unix; on Windows use in-process keyhog scan):

root@kitploit:~
# 1. Start the daemon (accelerated by CUDA, Metal, WGPU, or SIMD)
keyhog guard up

# 2. Guard your repository (indexes baseline and installs pre-commit hook in one step)
keyhog guard add /path/to/repo

# 3. Every staged commit checks only changed blobs against in-memory attestations
keyhog scan --git-staged

# 4. View all active guarded repositories and their states
keyhog guard list

# 5. Turn the daemon on and off cleanly without losing registrations or durable index
keyhog guard down

See the perpetual guard guide and pre-commit workflow for full configuration, state machine lifecycle, and hook automation.

Add it to GitHub Actions

Create .github/workflows/keyhog.yml:

root@kitploit:~
name: keyhog
on:
  push:
    branches: [main]
  pull_request:
permissions:
  contents: read
  security-events: write
jobs:
  scan:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
      - uses: santhreal/keyhog@v0
        with:
          path: .
          severity: high

The Action scans the checked-out tree, fails on findings at high or critical, uploads SARIF to Code Scanning, and retains the report as a workflow artifact. Installation, coverage, backend, and report-publication failures also fail the job.

Use the GitHub Action guide for inputs, outputs, baseline adoption, monorepo partitions, verification, and failure behavior. Use the CI guide for GitLab, CircleCI, Jenkins, Buildkite, and generic shell jobs. Use the mass-scanning guide for repository organizations, hosted Git groups, cloud buckets, and partitioned inventories.

Scan surfaces other tools treat as separate products

KeyHog scans bytes at the boundary where they can leak, not only tracked source files. Use one report per boundary so CI retains exact coverage and failure state.

These routes share one detection and reporting contract. A source-specific failure cannot silently turn into a narrower local scan.

Choose the right workflow

Choose the source boundary first. A preset changes detection work, while a backend changes execution. Neither one expands a working-tree scan into Git history, a provider inventory, cloud storage, or a host audit.

There is no honest scan everything shortcut. A complete estate review runs the relevant boundaries below as separate jobs and retains each json-envelope report with its raw exit code.

Scan every supported source boundary

Use one command per boundary. Keep a json-envelope report and the raw exit status for each inventory partition.

A plain directory scan does not read native binaries. Each one becomes a binary (extension or content sniff) coverage gap, the scan still exits 0, and --no-default-excludes does not change it, so pass --binary when compiled artifacts are in scope. That flag needs a build with the binary feature, which the default crates.io install has and the lean ci feature does not.

Native binary extraction reports complete credentials that satisfy a named detector's explicit shape contract. It suppresses short prefix fragments and generic assignment-shaped strings from compiled data sections because those bytes do not retain source context.

Endpoint fetching is bounded and SSRF-screened. It is not a crawler. Private cloud endpoints and credential forwarding require their explicit trust flags. Provider tokens belong in the documented environment variables, not process arguments.

Use the workflow chooser for source and policy details, the GitHub Action guide for the maintained repository gate, the direct CI guide for durable reports and exit handling, and the mass-scanning guide for partitioning and aggregation. The recipes cookbook covers containers, archives, URLs, GitHub collaboration content, and cloud sources.

Speed and concurrency without guesswork

Start with the defaults. The historical verified binary-asset installer runs calibration itself. Cargo cannot execute KeyHog after cargo install, so run the commands below once after installing a multi-backend Cargo build and again after the host, binary, detector corpus, driver, or workload classes change:

root@kitploit:~
keyhog calibrate-autoroute --policy all
keyhog backend --autoroute --json

Inspect the resolved policy with keyhog config --effective. Use --profile to measure fixed scanner stages and the complete operator run before you change reader, batch, or channel-depth controls. The low-overhead report records source, backend, cache, workload, thread, input, state-transition, CPU-time, peak memory, exact binary SHA-256, enabled-feature SHA-256, target triple, build profile, compiler, allocator, linked-backend SHA-256, detector-corpus SHA-256, enabled-detector BLAKE3, compiled-plan BLAKE3, hashed detector-provenance, complete resolved-configuration BLAKE3, performance-policy BLAKE3, preset, applied protection state, source adapters, hashed source-target BLAKE3, hashed source-partition BLAKE3, raw source bytes, source-unit fanout, decode-derived bytes, completed backend-dispatch bytes, and stable size/fanout buckets. Byte domains that their source adapter cannot yet distinguish remain explicitly unavailable instead of becoming measured zeroes. The report does not record source content, credential values, raw paths, raw URLs, or raw configuration values. Use --perf-trace only for expensive per-pattern and backend diagnostic counters. Keep advanced pipeline controls unset unless a reproducible measurement on the target worker shows an improvement.

For a recurring full repository scan:

root@kitploit:~
keyhog scan . --incremental \
  --format json-envelope --output keyhog.json

For a shared runner where the job is allocated four scanner workers and one reader worker:

root@kitploit:~
keyhog scan . --threads 4 --reader-threads 1 \
  --format json-envelope --output keyhog.json

The second command is a resource budget, not a universal optimum. Measure the target host before choosing explicit worker counts.

For deep recovery and system-wide triage, use their dedicated guides because their coverage and completion rules differ from a normal repository scan.

Secret scanner benchmarks

These panels compare detection policy, CPU and GPU execution requests, incremental cache behavior, and warm daemon requests. Every value is generated from the checked benchmark snapshot. The snapshot binds the scanner version, executable digest, detector digest, corpus, host, and run timestamp. Use the full benchmark evidence for competitor provenance and per-category recall.

Detection accuracy

KeyHog KeyHog v0.5.70 scanned the mirror corpus: 15,000 fixtures, 3,000 labeled positives, and 2,431,242 input bytes. The answer-key manifest was excluded from the scan tree. The row uses the default policy on the explicit Hyperscan/SIMD route on AMD Ryzen 9 9950X 16-Core Processor.

PrecisionRecallF1True positivesFalse positivesFalse negatives
0.96510.90270.93282,70898292

The tracked source tree was clean.

Execution routes, presets, and cache

Measured on AMD Ryzen 9 9950X 16-Core Processor with NVIDIA GeForce RTX 5090, 32 logical cores, 15,000 fixtures, 3,000 labeled positives, and 2,431,242 input bytes. Scanner: KeyHog v0.5.70. The tracked source tree was clean.

Full scan by execution route

All rows use the default detection policy with incremental cache and daemon off. The automatic row records the requested policy, but the benchmark result does not bind the selected persisted route, so it is not routing proof. GPU rows include acquisition and full scanner startup on this small corpus; they are not GPU kernel crossover measurements.

Detection policy on Hyperscan/SIMD

The route, cache, daemon state, corpus, and host remain fixed. Presets change detection work, so compare precision and recall as well as time.

Incremental warm rerun

The benchmark populates the BLAKE3 Merkle index, then times the second identical scan. The small synthetic tree changes little because scanner startup dominates; measure your repository before claiming a speedup.

Hyperscan/SIMD default policyWallThroughputPeak RSS
Cache off860 ms2.70 MB/s416 MiB
Warm incremental cache617 ms3.76 MB/s

Warm daemon requests

One deterministic 8 MiB regular file (sha256:afafbe7b6487fd62866f510e7c281a9e7bfeaa8dc585d7b0478c92ee6c4f5ef5) was scanned once in process and once through an owned daemon after one warmup request. Daemon time is the client request; daemon RSS belongs to the resident server.

These rows cover the warm single-file route. The mass route also accepts bounded directory and remote-source batches; its incremental filesystem path is measured separately.

CPU, reader, storage, size, and partition scaling

Generated by make -C benchmarks readme-scaling from benchmarks/reports/readme-scaling.json. The harness ran 3 measured trials after 1 warm-up with explicit simd and daemon routing off. Worker scaling uses a warm client page cache to isolate CPU work. Reader, corpus-size, storage, and partition rows request clean-page eviction with posix_fadvise where the platform supports it; the snapshot records the policy on every row. Every workload is byte-deterministic and finding-free.

Host: AMD Ryzen 9 9950X 16-Core Processor, 32 effective logical cores, 94,140 MiB RAM, Linux 6.17.0-19-generic. Evidence: clean, binary 274b045489c4.

Scan worker scaling

Filesystem reader scaling

Corpus-size scaling

Storage scaling

Concurrent partition scaling

These rows are measurements, not universal tuning constants. Run the generator on the target host and storage. Use the knee where throughput stops improving, then reserve CPU and memory for the CI runner or orchestration layer.

Reproduce all four benchmark groups with make -C benchmarks readme-matrix. The command measures the required matrix and fails if any requested CPU, Hyperscan, CUDA, Metal, WGPU, preset, cache, daemon, thread, reader, storage, corpus size, or partition row is unavailable. Use make -C benchmarks readme-matrix-check to verify that both snapshots, reports, and README agree.

Choose a scan configuration

Start with the default policy and calibrated automatic routing. Change one axis only when the workflow requires it:

--fast, --deep, and --precision are mutually exclusive detection presets. --lockdown is a fail-closed execution mode, not a fourth preset. Explicit --backend values are diagnostics and benchmark overrides. They do not replace the persisted fastest-correct evidence used by automatic routing. See Configuration, autoroute calibration, daemon and warm scans, and hardening for the full contracts.

How KeyHog works

KeyHog compiles its 926 detectors into a shared trigger and extraction plan, decodes nested encodings before matching, and applies per-detector scoring, evidence, and suppression. Pure-Rust CPU (cpu-fallback) is always available. The Hyperscan route (simd-regex) uses Hyperscan when that feature is present; portable builds use the CPU route. CUDA (gpu-cuda-region-presence), Metal (gpu-metal-region-presence), and WGPU (gpu-wgpu-region-presence) are peers in a proof-backed autoroute selector, not a fallback chain. Calibration measures every eligible peer and persists the fastest route whose complete findings match the reference route for the exact binary, detector and configuration state, host, accelerator, and workload class. A missing, stale, invalid, or incomplete decision stops an automatic scan before execution and reports how to recalibrate. It never silently substitutes another backend.

See Architecture for the repository map, dependency direction, bytes-to-finding pipeline, and profiling entrypoints. See Backends and routing for execution contracts and Autoroute calibration for parity, workload identity, cache lifecycle, and repair procedures.

Full documentation: santhreal.github.io/keyhog - install, first scan, output formats, detection internals, suppressions, verification, pre-commit + CI integration, CLI reference, autoroute, exit codes, env vars, and contributing. Source under docs/.


Install KeyHog

Install the current crates.io release:

root@kitploit:~
cargo install keyhog --locked

Build the repository checkout when you need an unreleased change:

root@kitploit:~
cargo install --path crates/cli --locked

Confirm the installed build:

root@kitploit:~
keyhog --version --full
keyhog doctor

Use the install guide for Rust toolchain requirements, feature profiles, and platform-specific runtime dependencies.

What it catches

926 embedded detectors with detector-owned offline validation and companions:

  • Cloud providers: AWS (access key + secret + STS verification), Azure (subscription key, storage account key, SAS), GCP (service account, API key), Cloudflare, Heroku, Vercel, Supabase.
  • Payment processors: Stripe, Braintree, Razorpay, Paddle, Plaid, Square, and PayPal, with detector-owned checks and optional or required companions. A Razorpay key secret requires its nearby key ID.
  • Source forges: GitHub PATs (with CRC32 checksum), GitLab tokens, Bitbucket app passwords, npm tokens (with checksum), Gitea / Forgejo / Codeberg.
  • Auth / SSO: Okta, Auth0, Clerk, JumpCloud, Kinde.
  • Comms: Slack, Discord, Twilio, SendGrid, Postmark, Mailgun, Resend, Loops.
  • AI / ML: OpenAI (sk-/sk-proj-), Anthropic, Google AI Studio, Cohere, Mistral, HuggingFace, Replicate. HuggingFace organization credentials include both the current hf_ form and legacy api_org_ tokens.
  • Password managers: 1Password account secret keys (A3- followed by five or six segmented uppercase alpha-numeric components).
  • Databases: Postgres connection strings, MongoDB Atlas, Supabase service-role, PlanetScale, Neon, Turso, MySQL, Redis URLs.
  • Generic + entropy discovery: API_KEY=<high-entropy-blob> catches credentials with no named detector, gated by per-context entropy thresholds + ML scoring.
  • Cryptographic material: RSA / EC / SSH private keys, PGP private blocks, JWT signing secrets.

Each detector ships as a TOML file (data, not code): service metadata, regex patterns, keywords, offline validators, entropy and ML policy, companion fields, and verification handler. Adding a new detector is a single reviewable TOML change; the contributor guide walks through it.

keyhog explain <id> dumps any detector's full spec: patterns, keywords, verification endpoint, plus a service-keyed rotation and step-by-step remediation guide, so a finding is never a black box:

keyhog explain github-classic-pat: detector spec dump (pattern ghp_[A-Za-z0-9]{36}, keyword, verification URL) followed by the github rotation guide and step-by-step remediation

Browse detector authoring and inspection in the detector reference, or query the installed corpus with keyhog detectors --search <term> --verbose.

Why higher recall, fewer false positives

  • Decode-through scanning. Kubernetes Secret manifests, Jupyter notebooks, JWT payloads, base64-wrapped envs, Helm values, and docker-config auth: blobs. The structured preprocessor treats balanced Helm actions as inert render-time values and closes missing Jupyter delimiters at end of file, so literal bytes and complete code cells remain covered. It decodes structured values in place and feeds every downstream detector the plaintext. Detectors do not each need to re-implement decoding. Decode-enabled scans also recover side-effect-free JavaScript byte-array XOR and AES-256-CBC expressions when all recovery material is embedded, including strict CryptoJS/OpenSSL salted passphrase wrappers. KeyHog never executes the source.
  • Multiline reassembly. "sk-proj-" + \ continuation in JavaScript, YAML multi-line strings, Makefile backslash-continuation, Helm / Jinja templated outputs, all reassembled before regex matching.
  • Companion validation. Required companions gate high-noise detectors. A Twilio API key without its API secret is skipped. Optional companions enrich evidence scoring or verification. AWS access-key detection does not require its secret, but the secret is needed for live verification.
  • Cross-detector resolution. Detector TOML can require, reject, or subsume bounded findings from another detector. Resolution stays deterministic across input order, and invalid targets, contradictions, or dependency cycles fail corpus compilation.
  • Evidence verdicts. Every finding carries an exact review, likely, or confirmed tier plus a canonical reason code. Intrinsic checksum or grammar proof, required companions, and live verification produce confirmed evidence; strong vendor-specific shape in a credential-bearing role produces likely evidence; weak anchors, generic assignments, entropy-only candidates, and test, documentation, rule, or identifier contexts remain review evidence. An optional supplements the verdict when measured. Default threshold controls the scanner's internal confidence floor and remains configurable with .

Performance

Use the reproducible harness in benchmarks/ to compare KeyHog, Betterleaks, Kingfisher, Nosey Parker, TruffleHog, and Titus under one scoring contract. The harness excludes the ground-truth manifest from every scan tree. The generated tables remain empty until current-schema runs exist. Run make -C benchmarks report after measurement. Do not edit generated tables by hand.

Detection leaderboard

Corpus: mirror - 15000 fixtures, 3000 labeled positives. Every scanner scored identically (SecretBench overlap rule); the answer-key manifest is excluded from the scan tree.

Result provenance

Speed & memory

Per-category recall comparison

Diagnostic recall slice only. Overall precision and F1 remain the comparison contract; false positives are counted in their scored categories.

CategoryKeyHog P/R/F1KeyHog TP/FNBest competitor P/R/F1Recall gap
generic-high-entropy-string1.000 / 0.434 / 0.60673/95Betterleaks 1.000 / 0.798 / 0.887+0.363

Bounded static recovery telemetry

Selected run: scanner KeyHog KeyHog v0.5.70<br>Commit: d1eb2e09eb2c289181d93d719ce3f62411aeaf2c<br>Detector Set: 926 (926-4168e2c6c93a16ca)<br>Build Target: x86_64-linux<br>ML Model Version: moe-v1-246a05b92bec9aa3<br>ML Model Card: recorded 2026-07-15; features 55; synthetic F1 0.971 / P 0.945 / R 0.999; real F1 0.832 / P 0.753 / R 0.931 / [email protected] 0.938; zero-recall detectors 2/32; six-scanner differential unavailable; corpus mirror (15,000 fixtures, 2,431,242 bytes); generated 2026-08-11T01:29:39Z; artifact mirror-keyhog-simd-nocache-nodaemon-full.json.

Telemetry schema: static-recovery-v1.

DispositionExact count
Supported0
Unsupported0
Erroneous0
Rejection reasonExact count
none0

Bigram Bloom evidence

Evidence schema: bloom-evidence-v1.

Finding identity binds detector, file, line, byte span, and credential SHA-256; plaintext credentials are never recorded.

Reproduce: make -C benchmarks canonical KEYHOG_BIN=/absolute/path/to/keyhog reruns the exact KeyHog, Betterleaks, Kingfisher, Nosey Parker, TruffleHog, and Titus mirror run set, including the executable-bound CredData Bloom differential, make -C benchmarks report regenerates the tables above and benchmarks/reports/. See benchmarks/README.md for the corpora (mirror, competitor home-turf, Samsung/CredData) and the backend/cache/daemon/OS/GPU matrix.

GPU-backed mass daemon workers

The optional Unix mass daemon keeps one compiled scanner and its calibrated backend state warm. Local filesystem scans send only canonical root and source-policy metadata; the daemon reads and batches the files in its own process. Git, binary, remote, and cloud sources that require client-side credentials use protected bounded chunk frames.

root@kitploit:~
# Terminal 1
keyhog calibrate-autoroute --policy default
keyhog daemon start --mass

# Terminal 2, after the daemon prints its ready line
keyhog scan --daemon=mass /srv/inventory/team-a \
  --format json-envelope --output team-a.json
keyhog daemon stop

--daemon=mass is a required route. It never retries in process. Each batch is bounded to 8 MiB and 1,024 chunks, independent of total input size. Preserve the coverage envelope, exit status, and terminal execution receipt for every inventory partition.

See daemon lifecycle, routing, and receipts and inventory partitioning.

System-wide credential triage

root@kitploit:~
sudo keyhog scan-system --space 50G
sudo keyhog scan-system --include-network --output system-findings.json

scan-system is a bounded local-host audit, not a replacement for repository or cloud inventory partitioning. It bounds itself by total bytes scanned rather than by path: --space is the ceiling, and network-mounted filesystems are skipped unless you pass --include-network. Review mount, network-filesystem, space-ceiling, and privilege behavior before running it. See system-wide triage.

Lock down sensitive local scans

Linux --lockdown is a fail-closed process-protection mode:

root@kitploit:~
keyhog scan . --daemon=off --lockdown

It locks current and future memory, disables core dumps and the incremental cache, remains in process, and refuses verification, plaintext output, fast mode, and completeness-reducing switches. It fails on unsupported platforms or insufficient locked-memory capacity. See hardening and data handling.

Use KeyHog as a Rust library

root@kitploit:~
use keyhog_core::{Chunk, ChunkMetadata, RawMatch};
use keyhog_scanner::CompiledScanner;

let detectors = keyhog_core::load_embedded_detectors_or_fail()?;
let scanner = CompiledScanner::compile(detectors)?;
let findings = scanner.scan(&Chunk {
    data: "TOKEN=sk_live_EXAMPLE…".into(),
    metadata: ChunkMetadata::default(),
})?;
let report_safe: Vec<_> = findings.iter().map(RawMatch::to_redacted).collect();

The default library methods are deterministic portable CPU references. Explicit backend methods return typed errors instead of terminating the process or silently substituting another engine. Raw chunks and matches can contain plaintext. Convert them with RawMatch::to_redacted, or use final VerifiedFinding values, before JSON, logs, disk, or network boundaries.

The architecture guide defines crate ownership, backend contracts, recovery receipts, source helpers, and safe reporting boundaries. Crate-level Rust documentation owns the complete API.

Configure policy with explicit precedence

Repository policy lives in .keyhog.toml:

root@kitploit:~
verify = false

[scan]
severity = "high"
incremental = true

[system]
gpu = "auto"

Resolution order is built-in defaults, user configuration, repository configuration, environment where documented, then explicit CLI overrides. Unknown keys and invalid combinations fail before scanning. Run keyhog config --effective to inspect the resolved policy without exposing proxy credentials. Entries past expires fail allowlist load before scanning.

See configuration and precedence for every key and environment variables for credential and runtime inputs.

Architecture

KeyHog keeps orchestration at the edge and domain behavior in libraries:

root@kitploit:~
sources -> scanner -> suppression/evidence -> reporting
                 \-> optional verifier
CLI and Action own process, transport, and exit semantics.

Detector definitions remain data under detectors/. keyhog-core owns detector and finding types, keyhog-scanner owns matching and execution backends, keyhog-sources owns input acquisition, keyhog-verifier owns live checks, and keyhog-cli owns operator workflows.

Start with the architecture guide for the repository map, dependency direction, bytes-to-finding pipeline, routing ownership, and profiling entrypoints.

Inspect and extend the installation

root@kitploit:~
keyhog detectors --search aws --verbose
keyhog explain aws-access-key
keyhog backend --autoroute --json
keyhog completion zsh

The CLI reference lists every command, flag, generated default, and exit status. Use keyhog --help and keyhog <command> --help for the exact installed version.

Contributing

  • New detector? Drop a TOML in detectors/, open a PR. The contributor guide (CONTRIBUTING.md) has the schema and a worked example.
  • Bug / missed secret / false positive? File an issue with the redacted credential shape and detector id; each report becomes a permanent test fixture under crates/scanner/tests/contracts/.
  • Release behavior? Every successful main CI run increments the patch version, generates changelogs, and publishes all six crates to crates.io. Add an optional fragment under changes/ for a precise note. The release guide covers the automatic transaction and failed-upload recovery.
  • Security issue in KeyHog itself? Don't open a public issue; use GitHub private vulnerability reporting. If that form is unavailable, email [email protected]; PGP is not required.

Changelog. Open issues.

Credits

KeyHog stands on prior secret-scanning work. Ideas borrowed from:

  • TruffleHog: detector breadth and verification semantics
  • Betterleaks: token-efficiency and false-positive suppression
  • Titus: scanning ergonomics and severity calibration

Thanks to these projects and their contributors.

License

License: MIT OR Apache-2.0.

Terms: MIT and Apache-2.0. This dual license covers the code and detector TOMLs. Commercial use, embedding, forks, and hosted services are permitted under either license.


Star history

KeyHog GitHub star history from repository-owned observations

Generated from UTC observations of GitHub's public star count. The repository stores the first point and each later count transition. Same-day reruns replace that day's point, and unchanged counts create no commit.

Baixar ferramenta
ExitMeaning
0 successNo finding blocks the active evidence policy, and no coverage failure occurred. Review-tier findings can remain visible under the default policy.
1 blocking findingsAt least one finding blocks the active evidence policy, but none were confirmed live.
2 operator errorFix the arguments, configuration, detector corpus, or operator-correctable input.
3 system errorRepair or retry the runner. This includes low-level I/O, fatal daemon service, incremental-cache, and explicitly selected SIMD failures.
4 backend --self-test or maintenance failureThe requested installation, repair, backend, or autoroute health check was unhealthy.
10 live credentialsAt least one credential was confirmed live. update --check also uses this code when a newer release exists.
11 scanner panicDiscard the scan result because scanner state is not trustworthy.
12 required GPU failureAn explicitly selected or required GPU path could not execute.
13 incomplete coverageA requested source failed or input coverage was incomplete, and no finding outcome took precedence.
130 interruptedSIGINT or Ctrl-C interrupted the process.
Exposure surfaceExample
Final package artifactRun npm pack, then scan the produced .tgz with keyhog scan package.tgz. Archive expansion checks generated files, source maps, fixtures, and metadata that are absent from the expected source tree.
Deployed browser applicationkeyhog scan --url https://app.example.com/assets/app.js follows bounded JavaScript, source-map, WASM, and response decoding without turning the scanner into an unbounded crawler.
GitHub issues, pull requests, discussions, wikis, and gistskeyhog scan --github-collaboration owner/repo --github-all scans every collaboration surface outside the checkout.
AI agent and MCP configurationkeyhog scan ~/.config ~/.claude ~/.codex applies the same detector, decode, evidence, and reporting pipeline to local tool configuration.
Container image layerskeyhog scan --docker-image registry.example.com/team/app:v1 scans the image content that will run, including files introduced during the build.
Cloud object inventorieskeyhog scan --s3-bucket BUCKET, --gcs-bucket BUCKET, or --azure-container-url URL preserves provider pagination, object, and byte-limit coverage in the terminal report.
Entire development hostsudo keyhog scan-system --space 50G discovers mounted filesystems and reachable Git history under a hard storage budget.
NeedStart withThroughput and reuseCoverage boundary
Quick local feedbackkeyhog scan . --fast --incrementalReuses unchanged-file hashes. The fast preset skips decode, entropy, and ML work.Run the default policy before merge because fast is intentionally narrower.
Full repository scankeyhog scan .Calibrated auto and the CPU-core worker default. Add --incremental for repeated scans of the same trusted tree.Current files only. It does not add Git history.
Staged commit gatekeyhog scan --git-staged or keyhog hook installReads exact index blobs, so unstaged edits cannot change the result.Staged content only. Run a working-tree scan separately when local unstaged bytes matter.
Perpetual repository guardkeyhog guard add . --mode repo then keyhog guard status .Daemon-resident root registry with a 7-state machine, clean attestation cache, and policy identity tracking.Requires a running daemon. The guard supplements, not replaces, staged and working-tree scans.
GitHub pull-request gatesanthreal/keyhog@v0The Action installs, scans, publishes SARIF and an artifact, then preserves KeyHog's status.One checked-out path. Use provider inventory scanning for an organization.
GitLab, Jenkins, Buildkite, or shell CIkeyhog scan . --format json-envelope --output keyhog.jsonPersist the report and exit code on success, findings, and errors. Use --git-diff <base> only for an explicitly narrower changed-line gate.The bytes present in the checkout, or the selected diff.
Adopt a repository with known findingsCreate .keyhog-baseline.json, commit it, then scan with --baseline .keyhog-baseline.json.Existing identities remain visible in the baseline while only new findings fail the gate.A baseline does not suppress changed credentials or incomplete coverage.
Recursive Git recoverykeyhog scan --deep --git-history . --git-blobs . --daemon=offCalibrate the deep policy once per worker class. Run in process.One repository. --git-history covers only the current checkout's ancestry, so a branch you never checked out is missed with no coverage gap; --git-blobs also reaches dangling blobs, amended-away commits, stashes, notes, annotated tag messages, and packed refs.
Container or archive inspectionkeyhog scan --docker-image registry/app:v1 or keyhog scan incoming/Keep an envelope report so skipped, corrupt, encrypted, unsafe, or oversized members remain visible.Only the selected image or filesystem path and supported nested formats.
URL, response, or HAR inspectionkeyhog scan --url https://api.example.com/config or keyhog scan capture.harUse bounded source limits and preserve the terminal envelope.Only fetched responses or capture entries. This is not a crawler.
Organization or cloud inventorykeyhog scan --daemon=off --github-org acme --format json-envelope --output acme.jsonPartition by provider, owner, or bucket. Run independent partitions concurrently with one report and status each.One selected provider inventory per job. Pagination or object limits remain coverage boundaries.
Confirm whether eligible findings are livekeyhog scan . --verifyProvider concurrency and rate controls are separate from scanner workers.Sends credential-derived requests to declared provider endpoints. Not every detector supports verification.
Whole-host health scansudo keyhog scan-system --space 50GUses all CPU cores by default and scans discovered Git history after filesystem data.Local mounted filesystems. Network mounts are opt-in and the space ceiling is hard.
GPU-backed directory, history, archive, remote, or cloud inventory on UnixCalibrate autoroute, start keyhog daemon start --mass, then run keyhog scan --daemon=mass <SOURCE>.Streams bounded batches through one compiled CPU, Hyperscan, CUDA, Metal, or WGPU worker. Add --incremental for warm unchanged filesystem trees. The terminal receipt reports exact total and GPU batches, chunks, bytes, GPU share, and throughput.Baselines, verification, lockdown, presets, overlays, and other scanner-policy changes are rejected before acquisition. Incremental state applies only to daemon-local filesystem roots.
Source or use caseCommand
Several local rootskeyhog scan services/api services/web deploy/
Continuously changed fileskeyhog watch services/api deploy/
Staged bytes, changed lines, reachable history, or blobskeyhog scan --git-staged, --git-diff main, --git-history ., or --git-blobs .
Native binaries and firmware stringskeyhog scan --binary firmware.bin (a plain directory scan skips binaries and still exits 0)
Archives and compressed sourceskeyhog scan incoming/ (supported members expand automatically)
Docker image layerskeyhog scan --docker-image registry/app:v1
JavaScript, source maps, WASM, or an endpoint responsekeyhog scan --url https://api.example.com/config
HTTP request and response captureskeyhog scan capture.har
GitHub issues, pull requests, discussions, wikis, and gistskeyhog scan --github-collaboration owner/repo --github-all
GitHub, GitLab, or Bitbucket inventories--github-org ORG, --gitlab-group GROUP, or --bitbucket-workspace WORKSPACE
S3, GCS, or Azure Blob inventories--s3-bucket BUCKET, --gcs-bucket BUCKET, or --azure-container-url URL
A bounded stream from another toolproducer | keyhog scan --stdin (use set -o pipefail so a failed producer surfaces its own error, not a zero-byte scan)
ControlUse it forKeep this invariant
Calibrated --backend autoRoutine CPU, Hyperscan, or GPU selection.An explicit backend is a diagnostic override, not a faster default.
--threads <N>Reserving CPU capacity on a shared runner. Dedicated hosts should normally leave it unset so KeyHog uses the available cores.Every value must be positive. Several concurrent KeyHog processes each own a worker pool, so divide the host budget across partitions.
--reader-threads <N>Measured storage pipelines where reader work, not scanning, is the bottleneck.The default derives from the scan worker pool. Leave it unset until profiling shows a reader bottleneck.
--incremental and --incremental-cache <PATH>Repeated scans of the same trusted tree.Do not share one index across unrelated repositories or untrusted jobs.
Provider or repository partitionsConcurrent estate scanning and independent retries.Preserve one terminal envelope and raw exit code per partition. Do not concatenate findings and discard coverage state.
--verify-concurrency, --verify-rate, and --verify-batchBounding live provider checks independently of file scanning.Verification sends credential-derived requests. Provider rate limits, not CPU count, own this concurrency.
Mass daemonTB-scale directory, history, archive, remote, or cloud streams on one Unix worker.Each frame is limited to 8 MiB and 1,024 chunks. The daemon serializes fragment state and returns an exact CPU/GPU execution receipt.
--fast, default, --deep, or --precisionSelecting an explicit detection-cost and recall policy.These presets are mutually exclusive and change coverage. They are not interchangeable speed knobs.
Requested routeWallThroughputPeak RSSF1
Hyperscan/SIMD860 ms2.70 MB/s416 MiB0.9328
Pure-Rust CPU903 ms2.57 MB/s509 MiB0.9328
CUDA2.03 s1.14 MB/s963 MiB0.9328
WGPU1.97 s1.18 MB/s1264 MiB0.9328
Automatic1.46 s1.59 MB/s634 MiB0.9328
PolicyWallPrecisionRecallF1Findings
Fast737 ms0.97000.88370.92482,738
Default860 ms0.96510.90270.93282,816
Deep861 ms0.96450.90670.93472,845
Precision849 ms0.95900.63970.76742,001
457 MiB
Explicit routeIn processWarm daemonWarm / one-shotIn-process RSSDaemon RSS
Hyperscan/SIMD323 ms106 ms0.33×63 MiB74 MiB
Pure-Rust CPU278 ms109 ms0.39×62 MiB66 MiB
CUDA1.65 s232 ms0.14×674 MiB666 MiB
WGPU1.33 s237 ms0.18×596 MiB600 MiB
WorkersReader threadsMedian wallp95 wallThroughputSpeedupEfficiencyMedian peak RSS
1auto8,134.4 ms8,135.4 ms7.9 MiB/s1.00x100.0%47.0 MiB
2auto4,398.2 ms6,906.7 ms14.6 MiB/s1.85x92.5%50.3 MiB
4auto2,392.6 ms6,245.2 ms26.7 MiB/s3.40x85.0%57.2 MiB
8auto1,816.3 ms6,117.6 ms35.2 MiB/s4.48x56.0%63.4 MiB
16auto1,428.5 ms6,867.7 ms44.8 MiB/s5.69x35.6%78.4 MiB
32auto1,862.8 ms5,939.1 ms34.4 MiB/s4.37x13.6%126.7 MiB
Scan workersReader threadsMedian wallp95 wallThroughputRelative to 1 readerMedian peak RSS
3211,898.7 ms1,922.1 ms33.7 MiB/s1.00x121.3 MiB
3221,881.7 ms1,887.5 ms34.0 MiB/s1.01x122.8 MiB
3241,874.2 ms1,891.2 ms34.1 MiB/s1.01x126.6 MiB
3281,873.2 ms1,885.7 ms34.2 MiB/s1.01x133.4 MiB
32161,856.8 ms1,868.5 ms34.5 MiB/s1.02x153.9 MiB
32321,877.3 ms1,880.4 ms34.1 MiB/s1.01x179.5 MiB
CorpusFilesExact bytesMedian wallp95 wallThroughputMedian peak RSS
small2568 MiB869.9 ms886.1 ms9.2 MiB/s111.1 MiB
medium1,02464 MiB1,859.9 ms1,874.8 ms34.4 MiB/s126.3 MiB
large2,048256 MiB5,214.9 ms5,321.7 ms49.1 MiB/s137.1 MiB
Storage classFilesystemDevice IDMedian wallp95 wallThroughputRelative to first storageMedian peak RSS
workspaceext4663051,847.4 ms1,863.4 ms34.6 MiB/s1.00x127.0 MiB
local-temptmpfs1161,870.8 ms1,887.3 ms34.2 MiB/s0.99x124.9 MiB
ProcessesWorkers per processAggregate workersTotal filesTotal bytesMedian wallAggregate throughputSpeedupMedian summed peak RSS
132322568 MiB871.9 ms9.2 MiB/s1.00x111.5 MiB
2163251216 MiB404.6 ms39.5 MiB/s4.31x134.0 MiB
48321,02432 MiB571.1 ms56.0 MiB/s6.11x227.2 MiB
WorkflowDetection policyExecution and reuseAdditional control
First repository scanDefaultCalibrated auto; --daemon=autoReview all findings before adding suppressions.
Repeated local tree or CI scanDefaultCalibrated auto; --incrementalPersist the incremental cache only between scans of the same trusted tree.
Short feedback loop--fastCalibrated auto; optional --incrementalAccept reduced decode, entropy, and ML coverage. Run the default policy before merge.
Highest-recall recovery--deepIn processDeep is mutually exclusive with fast and precision, and is not daemon eligible.
Lower-noise large inventory--precisionIn process for repository collections, history, and cloud sourcesThe preset raises confidence floors and disables entropy discovery. It can miss lower-confidence credentials.
TB-scale directory, history, archive, remote, or cloud inventory on UnixDefaultkeyhog daemon start --mass, then --daemon=massBatches stay bounded at 8 MiB and 1,024 chunks. Preserve the terminal coverage report and GPU execution receipt.
Live credential validationDefaultIn processAdd --verify explicitly. Verification sends credential-derived requests to providers.
Linux no-swap scanDefault plus --lockdownIn process; incremental cache disabledLockdown refuses verification, plaintext secrets, fast mode, and completeness-reducing switches.
evidence_score
0.40
--min-confidence
  • Bayesian per-detector calibration. keyhog calibrate --fp generic-api-key writes a Beta(α,β) posterior. Scans use it only when --calibration-cache or [system].calibration_cache points at that file, so confidence tuning is explicit and reproducible instead of depending on stray host cache state.
  • RankScannerF1PrecisionRecallFindingsWallPeak RSS
    1KeyHog0.93280.96510.902728161.05s416 MB
    2TruffleHog0.52941.00000.360010801.59s300 MB
    3Kingfisher0.46830.38770.591352554.81s402 MB
    4Titus0.42070.33810.556751512.86s115 MB
    5Nosey Parker0.41860.35110.518345290.82s285 MB
    6Betterleaks0.34980.22410.7970111130.74s198 MB
    ScannerScanner version / executable digestCorpus identityHost identityRun date
    KeyHogversion: KeyHog v0.5.70
    Commit: d1eb2e09eb2c289181d93d719ce3f62411aeaf2c
    Detector Set: 926 (926-4168e2c6c93a16ca)
    Build Target: x86_64-linux
    ML Model Version: moe-v1-246a05b92bec9aa3
    ML Model Card: recorded 2026-07-15; features 55; synthetic F1 0.971 / P 0.945 / R 0.999; real F1 0.832 / P 0.753 / R 0.931 / [email protected] 0.938; zero-recall detectors 2/32; six-scanner differential unavailable
    executable SHA-256: 2899ee53789bff9c531f72645f6c8380a7c873230dfb2b6857079467bc8d2dcd
    mirror; 15,000 fixtures; 3,000 labeled positives; 2,431,242 byteshostname SHA-256/12: 82fcd9288623
    Linux 6.17.0-19-generic
    AMD Ryzen 9 9950X 16-Core Processor
    2026-08-11T01:29:39Z
    TruffleHogversion: trufflehog 3.96.0
    executable SHA-256: 6eb1f98fb890bf9361d8833c061e122dcb4f14fb7b71c65e603b7c096153c724
    mirror; 15,000 fixtures; 3,000 labeled positives; 2,431,242 byteshostname SHA-256/12: 82fcd9288623
    Linux 6.17.0-19-generic
    AMD Ryzen 9 9950X 16-Core Processor
    2026-08-11T01:29:58Z
    Kingfisherversion: kingfisher 1.94.0
    executable SHA-256: a49f8e9838d7f1da1e9f328a4dbc45a16996bce5078cde3ff1b8ad422d8ab07a
    mirror; 15,000 fixtures; 3,000 labeled positives; 2,431,242 byteshostname SHA-256/12: 82fcd9288623
    Linux 6.17.0-19-generic
    AMD Ryzen 9 9950X 16-Core Processor
    2026-08-11T01:29:50Z
    Titusversion: Titus v1.1.20 (Go port of NoseyParker)
    executable SHA-256: 0b9c126a6c280ba28c6ed8795f88bf9bd793164c15959a34921f47a7ed276bcf
    mirror; 15,000 fixtures; 3,000 labeled positives; 2,431,242 byteshostname SHA-256/12: 82fcd9288623
    Linux 6.17.0-19-generic
    AMD Ryzen 9 9950X 16-Core Processor
    2026-08-11T01:30:03Z
    Nosey Parkerversion: noseyparker 0.24.0 Build Configuration: Build Timestamp: 2025-05-08T21:11:15.600909923Z Commit Timestamp: 2025-05-08T17:04:47.000000000-04:00 Commit Branch: HEAD Commit SHA: 61fa4ca67e4ded1b47b3b9ecce618ae91f1ff2fe Cargo Features: color_backtrace,default,disable_trace,github,log,mimalloc,parquet,release Debug: true Optimization: 3 Target Triple: x86_64-unknown-linux-gnu Build System: OS: Ubuntu OS Version: Linux (Ubuntu 22.04) CPU Vendor: AuthenticAMD CPU Brand: AMD EPYC 7763 64-Core Processor CPU Cores: 2 rustc Version: 1.86.0 rustc Channel: stable rustc Host Triple: x86_64-unknown-linux-gnu rustc Commit Date: 2025-03-31 rustc Commit SHA: 05f9846f893b09a1be1fc8560e33fc3c815cfecb rustc LLVM Version: 19.1
    executable SHA-256: 42d6e88bf77904866a9dda49d7cf333501e76b62e9054b112e67f81dc88e2b71
    mirror; 15,000 fixtures; 3,000 labeled positives; 2,431,242 byteshostname SHA-256/12: 82fcd9288623
    Linux 6.17.0-19-generic
    AMD Ryzen 9 9950X 16-Core Processor
    2026-08-11T01:29:53Z
    Betterleaksversion: betterleaks version dev
    executable SHA-256: 466f7d34e1ebcf12ecd5939494f509c17125e54416226976fced2f046da56ba4
    mirror; 15,000 fixtures; 3,000 labeled positives; 2,431,242 byteshostname SHA-256/12: 82fcd9288623
    Linux 6.17.0-19-generic
    AMD Ryzen 9 9950X 16-Core Processor
    2026-08-11T01:29:43Z
    ScannerConfigCorpusWallThroughputPeak RSS
    Betterleaksdefault-nocache-nodaemon-no-validatemirror0.74s3.1 MB/s198 MB
    Nosey Parkerdefault-nocache-nodaemon-no-git-historymirror0.82s2.8 MB/s285 MB
    KeyHogsimd-nocache-nodaemon-fullmirror1.05s2.2 MB/s416 MB
    TruffleHogdefault-nocache-nodaemon-no-verifymirror1.59s1.5 MB/s300 MB
    Titusdefault-nocache-nodaemon-no-validatemirror2.86s0.8 MB/s115 MB
    Kingfisherdefault-nocache-nodaemon-low-no-validatemirror4.81s0.5 MB/s402 MB
    FieldExact result
    Corpussamsung-creddata-fx-record-spans-v1
    Corpus revisionf1de3f85dbdf42bf7b3467c0d273a4dfe44d56ee
    Corpus SHA-2564f2de506f334521121bb5b4aef8a37bf0b8153a4f9115e7ba9392d0eed1757b9
    Fixture SHA-256a0ff018dc0a64b2cc78b25999043d1a441afa0087070f4cd8d73ae82408a59b4
    Executable SHA-2562899ee53789bff9c531f72645f6c8380a7c873230dfb2b6857079467bc8d2dcd
    Workspace detector corpus SHA-256d87e8b3d086e9ffa4c8a94f35a717ec710d5224e52e5b4fc7e71db30677609c9
    Scanner detector digest8d789251e092959f
    Detector corpus SHA-2563729bd72df768187420f37e08ab64cd2b5a8bac558002d8b0844f465e9a75711
    Bloom rejection110/51794 (0.21%); 51684 admitted
    External availability51794 measured; 0 explicitly unavailable of 51794 declared; reasons:
    Enabled vs bypassed findingsIDENTICAL; 977/977 findings
    Finding identity SHA-2561517bad01ab5228e85b7f4fd44e72226aa3f195bc18a67d58b7a6364b6bf6e0e / 1517bad01ab5228e85b7f4fd44e72226aa3f195bc18a67d58b7a6364b6bf6e0e
    Bloom density/state1793/65536 slots; healthy; saturation at 39322