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.1.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.1-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: keyscan-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 3d50f482b7ed9bf49addaf20c9f47ca6f1fc4bc2490affccb49cd94aa3d225e9
MD5 1677ccfde6b21485ae0ac3edb97cc525
BLAKE2b-256 1b379e3a12d776b0c7f392213a0f72af224bef019e0989e7f865850141c8c7dd

See more details on using hashes here.

File details

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

File metadata

  • Download URL: keyscan-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 37227fd66eaf3a9b6071509ee80ecaadaa0bddf7a090b7bbe147ff5479796fad
MD5 cc0abcab23b7636d17212dd6ccfac2b4
BLAKE2b-256 31d372f0ee0abdcfc33dce6a4ee57873d699ae46fdd2888ed37d2ddab70a5f7d

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