Skip to main content

A template-driven engine for validating exposed API keys and secrets.

Project description

keyscan

Build License Stars Issues Python Last Commit

Template-driven API key validation engine

┌─────────┐    ┌──────────┐    ┌──────────┐    ┌────────┐
│ Detect  │───→│ Classify │───→│ Validate │───→│ Score  │
└─────────┘    └──────────┘    └──────────┘    └────────┘

keyscan is a Nuclei-inspired tool built for security researchers to automatically validate exposed API keys and secrets using extensible YAML templates.

Instead of manually testing keys using scattered scripts, keyscan provides a scalable and structured workflow for secret validation.

Why keyscan?

Finding API keys is easy.
Validating them is time-consuming and inconsistent.

With keyscan:

  • Detects and classifies keys
  • Predicts possible services
  • Runs validation templates automatically
  • Outputs confidence-based results

Features

Feature Details
Template-based validation YAML templates, Easily extendable
Smart key classification Regex + prefix detection (sk-, AKIA, etc.), Length + charset analysis, Entropy-based scoring
Async validation engine Parallel requests using httpx
Confidence scoring Returns probability-based results
Clean CLI output Table output, JSON output (planned)

Installation

git clone https://github.com/harxh-v/keyscan.git
cd keyscan

pip install -e .

Usage

Validate a single key

keyscan -k "sk_live_123456789" -t templates/

Validate keys from a file

keyscan -f keys.txt -t templates/

Example Output

┌──────────────┬──────────┬────────────┬────────────┐
│ Key           Service   Status      Confidence │
├──────────────┼──────────┼────────────┼────────────┤
│ sk_live_****  Stripe    Valid       0.91       │
│ AKIA****      AWS       Invalid     0.76       │
└──────────────┴──────────┴────────────┴────────────┘

Template Example

id: stripe-key-check
service: stripe

requests:
  - method: GET
    url: https://api.stripe.com/v1/charges
    headers:
      Authorization: Bearer {{key}}

matchers:
  - type: status
    status: [200, 401]

Project Structure

keyscan/
├── cli.py
├── engine/
├── classifiers/
├── templates/
├── utils/

Security Notice

  • This project does not include real API keys
  • All templates use placeholders
  • Do not commit live secrets

If a key is exposed:

  • Revoke it immediately
  • Rotate credentials

Roadmap

[ ] JSON output [ ] Burp Suite extension [ ] GitHub Action integration [ ] ML-based classification [ ] Community template registry


Contributing

Contributions are welcome:

  • Add templates
  • Improve classifiers
  • Optimize performance

License

MIT license

Author

Harsh Verma

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keyscan-0.1.0.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

keyscan-0.1.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file keyscan-0.1.0.tar.gz.

File metadata

  • Download URL: keyscan-0.1.0.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for keyscan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 894082d1cd3609cafc9513dc53e4c0b3c0b0d286582b4c4a7bd4b8816a6a76bf
MD5 5e7e681341c63c847035ab3cf37f5f7d
BLAKE2b-256 32c88724bf66e72f303af63aaaa792b6da2b0e6ac722731392aac9943183473a

See more details on using hashes here.

File details

Details for the file keyscan-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: keyscan-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for keyscan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2eadbed90fd12f3e9f0c97497a5256102f8c2377e3d5603ffe957ba2989f6e24
MD5 788b12a7ebdef63ba5c6b3d57b42f1e5
BLAKE2b-256 543a684e90972bfe3c16f7a2487fa482be5d46743f14d87e30098c93a7ab880e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page