Skip to content

About

CLI that scans JSON data for leaked secrets and sensitive keys (JWTs, API keys, tokens, cards) during authorized security testing. pip-installable, jq-friendly.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Repository files navigation

🔍 JsonExploit

A CLI tool that scans JSON data for sensitive keys and secret-looking values — built for authorized security testing.

Stars Forks Issues License Python

⭐️ If you find this tool useful, please leave a star and share your feedback! ⭐️


JsonExploit recursively scans JSON files, raw JSON strings, or stdin to locate:

  • Interesting keys commonly associated with vulnerabilities or sensitive data (password, token, jwt, api_key, secret, admin, redirect, url, ...)
  • Secret-looking values even under innocent key names — JWTs, AWS keys, GitHub/Slack/Stripe/Google tokens, private key blocks, basic-auth URLs, emails, IPv4 addresses, and credit cards (Luhn-checked)

⚠️ Use responsibly. Only scan data and systems you own or are explicitly authorized to test (bug bounty scope, pentest ROE, your own API responses, incident response).

Features

  • Recursively inspects nested JSON objects and arrays, reporting full paths (endpoints[0].token)
  • Case- and separator-insensitive key matching (API-Key = api_key = ApiKey), optional --fuzzy substring matching (token matches accessToken)
  • Value-pattern detection: JWT, AWS access key IDs, GitHub/Slack/Google/Stripe tokens, private keys, bearer tokens, inline credentials, emails, IPs, credit cards (Luhn)
  • Input from files, raw JSON strings, stdin, or multiple sources at once
  • Output as a rich table, or machine-readable JSON / CSV / TXT (-o), with --export FILE
  • --mask partially redacts secrets in output (abcd...wxyz)
  • Custom key lists via --keys custom_keys.txt
  • --max-depth, --case-sensitive, --no-value-scan for fine control
  • Proper exit codes (0 = ok, 1 = input error) — pipes cleanly into jq and scripts
  • Installable as a package: pip install . → jsonexploit command
  • Tested with pytest

Installation

git clone https://github.com/Venu-exe/JsonExploit.git
cd JsonExploit
pip install -r requirements.txt        # or: pip install .  to get the `jsonexploit` command

Or install straight from GitHub:

pip install git+https://github.com/Venu-exe/JsonExploit.git

Usage

python3 JsonExploit.py [inputs...] [options]
# or, after `pip install .`:
jsonexploit [inputs...] [options]

inputs can be JSON file paths, raw JSON strings, or - for stdin. With no input and a piped stdin, it reads stdin automatically; interactively it prompts you (original behavior).

Examples

# Scan a saved API response
jsonexploit response.json

# Pipe a response straight in, get JSON for jq
curl -s https://api.example.com/me | jsonexploit - -o json | jq '.[].path'

# Raw JSON string
jsonexploit '{"user": {"email": "a@b.com", "password": "hunter2"}}'

# Fuzzy key matching + masked output + CSV export, multiple files
jsonexploit --fuzzy --mask --export findings.csv --keys extra_keys.txt a.json b.json

# Only secret-value patterns, limit depth
jsonexploit --max-depth 3 dump.json

Options

Option Description
inputs JSON file path(s), raw JSON string(s), or - for stdin
-o, --output {table,json,csv,txt} Output format (default: table)
--export FILE Also write findings to FILE (JSON if output is table)
--keys FILE Extra interesting keys: JSON list/dict or one per line
--fuzzy Substring key matching (token matches accessToken)
--case-sensitive Disable case/separator-insensitive matching
--no-value-scan Skip secret-value pattern detection
--mask Redact values: abcd...wxyz
--max-depth N Limit recursion depth
-q, --quiet Suppress banner
--version Print version

Example run

Given test.json:

{
  "name": "test_user",
  "email": "test@example.com",
  "config": { "api_key": "12345-ABCDE-67890", "debug": true },
  "endpoints": [ { "url": "https://api.example.com/v1", "token": "secret_token_value" } ]
}
$ jsonexploit test.json
JsonExploit v2.0.0 — find sensitive keys & secrets in JSON data
Author: Venu-exe   GitHub: https://github.com/Venu-exe/JsonExploit
Scanned 8 key(s) → 6 finding(s)
┏━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━┳━━━━━━━┳━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━━━━━━┓
┃ Source   ┃ Path             ┃ Key     ┃ Value                  ┃ Reason          ┃
┡━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━╇━━━━━━━╇━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━━━━━━━━━━━━━━┩
│ test.json│ email            │ email   │ test@example.com       │ interesting key │
│ test.json│ email            │ -       │ test@example.com       │ value matches   │
│          │                  │         │                        │ Email address   │
│ test.json│ config.api_key   │ api_key │ 12345-ABCDE-67890      │ interesting key │
│ test.json│ config.debug     │ debug   │ True                   │ interesting key │
│ test.json│ endpoints[0].url │ url     │ https://api.example... │ interesting key │
│ test.json│ endpoints[0]...  │ token   │ secret_token_value     │ interesting key │
└──────────┴──────────────────┴─────────┴────────────────────────┴─────────────────┘

A JWT stored in json.txt is caught by value scanning even without an interesting key:

$ jsonexploit json.txt -o txt
<json.txt>  <root>  -  eyJhbGciOiJFUzI1NiJ9.eyJ...  value matches JWT

Development

pip install -r requirements-dev.txt
pytest -q

Project structure

JsonExploit.py            # the tool (single-file CLI)
tests/test_jsonexploit.py # pytest suite
pyproject.toml            # packaging + `jsonexploit` console script
requirements.txt          # runtime deps (rich)
requirements-dev.txt      # dev deps (pytest)
test.json                 # sample input
json.txt                  # sample JWT

Roadmap

  • --url to fetch a URL and scan the response directly
  • High-entropy string detection (Shannon entropy) for unknown secret formats
  • SARIF output for CI / GitHub code-scanning integration
  • Severity scoring per finding

Author

Venu-exe

License

MIT License

About

CLI that scans JSON data for leaked secrets and sensitive keys (JWTs, API keys, tokens, cards) during authorized security testing. pip-installable, jq-friendly.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages