Skip to main content

leakcheck-cli

PyPI version Python versions GitHub stars LinkedIn License: MIT Zephyrus Labs

A high-speed, zero-dependency local secret scanner and Git pre-commit guard with Shannon entropy analysis by Zephyrus Labs for Linux, macOS, and Windows.


Features

  • ⚡ Zero External Dependencies: 100% pure Python standard library (re, math, os, sys).
  • 🛡️ 50+ Secret Detection Signatures: Detects keys for OpenAI, Anthropic, AWS, GitHub, Stripe, Google Cloud, Slack, Discord, Telegram, DB URLs, and SSH Private Keys.
  • 📐 Shannon Entropy Verification: Measures cryptographic randomness to filter out false positives and mock strings.
  • 🪝 One-Click Git Pre-Commit Hook: Install a local .git/hooks/pre-commit guard with leakcheck --install-hook to block secrets from entering git history.
  • 🔒 Git Staged Scanning: Scan only files staged in git index with --staged.
  • 🤖 CI/CD & Machine Ready: Formatted interactive terminal UI or --json output with standard exit codes (0 for clean, 1 for leaks).
  • 🧙 Interactive Security Wizard: Launch an intuitive terminal wizard to inspect findings, configure thresholds, and install hooks.

Installation

pip install leakcheck-cli

Or install the development build directly:

pip install git+https://github.com/uchiha-fire/leakcheck-cli.git

Interactive Mode

Run leakcheck with --interactive or invoke it without arguments to launch the wizard:

leakcheck --interactive
╔══════════════════════════════════════════════════════════════╗
║               leakcheck-cli  v0.1.0                          ║
║     High-Speed Local Secret Scanner & Git Hook Guard         ║
║     Zephyrus Labs (https://zephyrus-labs.tech/)              ║
╚══════════════════════════════════════════════════════════════╝

Welcome to the leakcheck Interactive Security Wizard!

Select Action:
  [1] Scan current repository (.)
  [2] Scan specific directory or file
  [3] Scan git staged changes only
  [4] Install Git Pre-Commit Hook (blocks commits on leak)
  [5] Uninstall Git Pre-Commit Hook
Choose [1/2/3/4/5] (default: 1): 1

Select Minimum Severity Threshold:
  [1] LOW
  [2] MEDIUM (Recommended)
  [3] HIGH
  [4] CRITICAL
Choose [1/2/3/4] (default: 2): 2

Scanning for secret leaks (min severity: MEDIUM)...

Scan Complete: 38 files inspected.
✓ CLEAN: 0 leaks found. Your codebase is safe to commit!

CLI Usage & Options

# Scan current workspace
leakcheck

# Scan only git staged files before commit
leakcheck --staged

# Install automatic git pre-commit hook in local repo
leakcheck --install-hook

# Scan specific folder with high severity filter
leakcheck ./services --min-severity HIGH

# Generate machine-readable JSON for CI/CD pipelines
leakcheck --json > security-report.json

Options Reference

Flag Long Option Default Description
path (positional) . Target path or file to scan
--staged False Scan only git staged files (pre-commit check)
--install-hook False Install pre-commit hook into .git/hooks/
--uninstall-hook False Remove pre-commit hook from .git/hooks/
--min-severity medium Severity threshold: low, medium, high, critical
--json False Output structured machine-readable JSON
-i --interactive False Launch interactive terminal wizard
-v --version — Display package version

Exit Codes

  • 0: Scan passed clean. No leaks detected.
  • 1: One or more security leaks detected (aborts commit if used as git hook).
  • 2: Runtime error or invalid target path.

Git Pre-Commit Hook

Protect your repository from accidental token leaks:

leakcheck --install-hook

This creates an executable script at .git/hooks/pre-commit. Whenever you run git commit, leakcheck will scan staged diffs before the commit is finalized.

To uninstall:

leakcheck --uninstall-hook

Python API Reference

from leakcheck import scan_text, scan_path

# Scan in-memory content
content = 'OPENAI_KEY = "sk-proj-" + "ab1234567890abcdefghijklmnopqrstuvwxyz"'
findings = scan_text(content, filename="app.py", min_severity="MEDIUM")

for f in findings:
    print(f"[{f['severity']}] {f['provider']} in {f['file']}:{f['line']}")
    print(f"Masked: {f['masked']} (Entropy: {f['entropy']})")
    print(f"Action: {f['remediation']}")

# Scan filesystem directory
report = scan_path("./src", min_severity="HIGH")
print(f"Scanned {report['scanned_files']} files, found {report['leaks_found']} leaks.")

Developed & Maintained by Zephyrus Labs

Built and maintained with ❤️ by Zephyrus Labs and Lead Developer Shubham Sharma.

If you find this tool helpful, please give it a ⭐️ on GitHub!


Acknowledgements & Attributions

leakcheck-cli is implemented entirely using Python's standard library. No external runtime dependencies are required.


License

This project is licensed under the MIT License - see the LICENSE file for details.


Lead Developer: Shubham Sharma (@uchiha-fire) • sharmashubham25962@gmail.com

Metadata

Release files for leakcheck-cli 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for leakcheck-cli 0.1.0
File Size Uploaded Provenance
leakcheck_cli-0.1.0.tar.gz 16.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for leakcheck-cli 0.1.0
File Interpreter ABI Platform
leakcheck_cli-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.4 kB

Release files / leakcheck_cli-0.1.0.tar.gz

Download URL leakcheck_cli-0.1.0.tar.gz
Size 16.4 kB
Tags Source
SHA-256 checksum
How to use checksums
d451ed784f69509ab251618b2acd5eba53bdb54eb83ec1aa17f5a4aa62359a76
BLAKE2b-256 checksum
How to use checksums
fbc30f706f5350d22f5a73d9a59a86caea53d72e6c13856a2993dbf94f793dfd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Release files / leakcheck_cli-0.1.0-py3-none-any.whl

Download URL leakcheck_cli-0.1.0-py3-none-any.whl
Size 13.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
838a31d706e28534bac16a3b753e674c6c7aa0e436a139ffab3174ffad779ba6
BLAKE2b-256 checksum
How to use checksums
3ab08db4cea49cd591e0a165af33f0f7025cdf416d16dd5242335c0ccbee95e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.8.10

Security for leakcheck-cli 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page