A single-file, zero-dependency recon tool that sweeps public repositories for exposed Shodan API keys and validates each one against the Shodan API β so your results contain only keys that actually work.
Developers leak secrets. It happens every day β a hardcoded key in a commit, a forgotten config in a public repo. ShodanHound automates the discovery and, crucially, the verification step that most grep-and-pray scripts skip:
- π Searches smart β drives the GitHub Code Search API with a curated set of Shodan-specific patterns instead of one naive string.
- π― Scoped where keys leak β searches
.py,.js,.ts,.jsonand.envfiles, quoted or bare. Targeted scopes mean fewer downloads and a much faster sweep than a blind crawl. - β
Validates live β every candidate is checked against
api.shodan.io; only keys with real, usable credits make it to your output. - π§ Respects rate limits β honours
Retry-After/X-RateLimit-Resetheaders with adaptive backoff, so it runs unattended without getting you throttled. - πͺΆ Zero dependencies β pure Node.js built-in
fetch. Nonpm install, no supply-chain surface. One file, drop it anywhere. - π§Ή Deduplicates on the fly β each key is checked exactly once per run.
ββββββββββββββββ ββββββββββββββββββββββ βββββββββββββββββββββ ββββββββββββββββ
β keyword β βββΆ β GitHub Code Search β βββΆ β fetch file, parse β βββΆ β Shodan API β
β patterns β β (paginated, 100/pg)β β 32-char candidate β β validate key β
ββββββββββββββββ ββββββββββββββββββββββ βββββββββββββββββββββ ββββββββ¬ββββββββ
β
credits β₯ 50 ? βββββββββββββββββ
β yes
βΌ
keys.out β
- Read patterns from
keywords/shodan.txt(one query per line). - For each pattern, search GitHub Code Search scoped to the file types where
keys leak β
.py,.js,.ts,.json,.env. - Download each matching file and extract any isolated 32-character token near the keyword β quoted or bare.
- Hit the Shodan
api-infoendpoint. If the key has β₯ 50 query credits, it's real and useful β append it to your output file.
Requirements: Node.js β₯ 18 and a GitHub personal access token (no scopes needed β public code search only).
# clone
git clone https://github.com/damanoreshkan-beep/ShodanHound.git
cd ShodanHound
# run β pass your GitHub token and an output file
node shodanhound.mjs <github-token> keys.outUsing the GitHub CLI? Skip the token juggling:
node shodanhound.mjs "$(gh auth token)" keys.out
β οΈ A full sweep takes a while β GitHub caps Code Search at ~10 requests/min, so ShodanHound deliberately paces itself.
06.06.2026, 00:18:09 β query: 'language:python shodan_api_key='
β KEY FOUND: ******************************** (credits: 99, scans: 100)
Done. 1342 unique candidates checked. Results in keys.out
Patterns live in keywords/shodan.txt β one search string
per line, no spaces. Add your own to widen the net:
shodan_api_key=
api_shodan_key=
shodankey=
sd=shodan(
Point ShodanHound at more keyword files by editing the KEYWORD_FILES array at
the top of shodanhound.mjs. Each pattern is searched across every scope in the
SCOPES array (.py, .js, .ts, .json, .env by default) β add or remove
scopes there to tune coverage vs. speed.
ShodanHound is built for defensive security research, bug bounty, and responsible disclosure β for example, finding your own organisation's leaked keys before an attacker does.
- β Audit your own / authorised infrastructure.
- β Report discovered keys to their owners and to Shodan so they can be rotated.
- β Never use, sell, or store third-party keys you are not authorised to access.
Discovered credentials are live secrets. Treat them as toxic: report and discard. The output file is git-ignored by default so you never publish what you find. You are responsible for complying with all applicable laws and the terms of service of GitHub and Shodan.
MIT Β© 2026
If ShodanHound saved you from a leak, drop a β β it helps others find it.