A comprehensive toolkit for discovering, validating, and reporting exposed Google API keys (AIza format). Built for authorized bug bounty research on Termux/ARM64, Linux, and WSL.
Based on Lostsec's May 2026 methodology. For authorized testing only.
An opencode skill is available at ~/.config/opencode/skills/google-api-key-toolkit/SKILL.md — load it with opencode's skill system for guided toolkit usage.
| Tool | Lines | Purpose |
|---|---|---|
gemisc.py |
~780 | Primary scanner: crawl domains + JS, validate keys, capability testing, evidence generation |
multi_scanner.py |
~350 | Multi-service scanner: 24 Google API endpoints with severity + cost tracking |
gkey_burp.py |
~400 | Burp Suite passive extension + standalone CLI (-u/-f/--crawl) |
gemini_chat.html |
335 | Browser-based Gemini chat interface with password input, toasts, typing indicator |
report_builder.py |
~465 | Submission-ready markdown report generator with CVSS scoring + CLI mode |
pipeline.sh |
290 | Bash orchestration pipeline: scan → validate → report |
rules/google_api_key_exposure.yml |
280 | 13 Semgrep rules for Google API key detection |
templates/google-gemini-key.yaml |
256 | Nuclei template for 8-test key validation |
tests/integration_test.sh |
330 | 47-test offline validation suite for all tools |
python3 gemisc.py # interactive menu (modes 1-6)
python3 gemisc.py 1 -d example.com # CLI: single domain
python3 gemisc.py 1 -d http://127.0.0.1:8080/ --depth 2 -o lab.txt # lab with directory crawl
python3 gemisc.py 2 -l domains.txt # CLI: batch domains
python3 gemisc.py 2 -l domains.txt --depth 1 # batch with limited depth
python3 gemisc.py 3 -j jsurls.txt # CLI: JS URL list
python3 gemisc.py 4 -k keys.txt # CLI: validate keys
python3 gemisc.py 5 -k keys.txt -c # CLI: capability testing
Controls recursive link following (0-5, default 2). Integrated in gemisc.py, gkey_burp.py, and pipeline.sh.
| Depth | Behaviour | Use case |
|---|---|---|
| 0 | Single page only (no follow) | Fast single-URL check |
| 1 | + linked HTML pages (<a href>) |
Shallow site |
| 2 | + directory listings (Directory listing for) + asset probing (config.json, app.js, style.css, *.map, page2.html) |
Lab/self-hosted http://127.0.0.1:8080/ (finds all 20 site*/ + 30 keys) |
| 3+ | Deeper recursion for nested directories | Complex labs |
Interactive modes prompt Crawl depth [2] (0=single, 1=+linked, 2=+dir); CLI: --depth N / -D N.
| Mode | Name | Description |
|---|---|---|
| 1 | Single Target | Crawl one domain, extract keys from HTML + JS |
| 2 | Batch Scan | Thread-pooled domain scan (12 workers) with progress bar |
| 3 | JS Scanner | Direct JS URL list scan |
| 4 | Key Validation | Validate keys via Gemini models + corpora (referer bypass) |
| 5 | Capability Testing | Test text gen, image gen (Imagen), TTS (single/multi), video (Veo), File API, generate PoC commands + report |
| 6 | Exit |
- Text generation — Gemini 2.5 Flash (output saved as
text_gen.txt) - Image generation — Imagen 4.0 (saved as
generated_image.png) - TTS — single + multi-speaker, auto-converts PCM→WAV (no ffmpeg needed)
- Video generation — Veo 3.0 (long-running operation, polls for completion)
- File API — upload PoC file, verify, then delete (cleanup)
- PoC curl commands —
poc_commands.shgenerated in evidence dir - Report —
report.mdwith cost estimates per capability
gemini_evidence/<key_suffix>/
text_gen.txt
generated_image.png
single_speaker.wav
multi_speaker.wav
generated_video.mp4
file_upload_response.json
poc_commands.sh
report.md
httpx[http2],anyio,beautifulsoup4(async path);requests,urllib3fallback whenhttpxmissingrequests,urllib3,beautifulsoup4(optional — regex fallback built-in)
python3 multi_scanner.py # interactive mode
python3 multi_scanner.py -k AIza... # single key
python3 multi_scanner.py -f keys.txt # file of keys
python3 multi_scanner.py --list-services # list all 24 endpoint checks
python3 multi_scanner.py -k AIza... --csv --markdown # export formats
| Group | Services | Severity |
|---|---|---|
| Gemini AI | Model List, File API, Corpora (referer bypass) | CRITICAL / HIGH |
| Google Maps | Geocoding, Static Map, Places, Directions, Elevation, Distance Matrix, Timezone, Street View | HIGH / MEDIUM / LOW |
| YouTube Data | Video Search, Channel List | MEDIUM |
| Cloud Vision | Label Detection, Text Detection (OCR) | HIGH |
| Cloud Translate | Text Translation, Language Detection | MEDIUM / LOW |
| Cloud NLP | Sentiment Analysis, Entity Extraction | MEDIUM |
| Firebase | Dynamic Links | HIGH |
| Custom Search | Web Search | MEDIUM |
| Cloud TTS | Synthesize Speech | MEDIUM |
| Cloud STT | Speech Recognition | MEDIUM |
| Vertex/PaLM | Text Bison (legacy) | HIGH |
- JSON — full raw results
- CSV — vulnerable services only, append-mode
- Markdown — per-key report with impact table
- Vulnerable keys file —
ms_vulnerable.txt
- Thread pool scanning (8 workers)
- Retry with backoff (429, 5xx)
- Cost estimation per endpoint
- Severity color-coded output
- Interactive + CLI modes
Load in Burp Extender → Add → Python → Select this file
- Passive scan: regex-matches AIza keys in responses
- Auto-validates against Gemini models endpoint
- Referer bypass + corpora fallback
- Scanner alerts: High (validated) / Information (potential)
python3 gkey_burp.py # help
python3 gkey_burp.py -u https://target.com # scan single URL
python3 gkey_burp.py -f urls.txt # scan URLs from file
python3 gkey_burp.py -u https://target.com --crawl # crawl + find JS keys
python3 gkey_burp.py -u http://127.0.0.1:8080/ --crawl --depth 2 -o lab.json # lab with depth
python3 gkey_burp.py -f urls.txt --crawl -o report.json
python3 gkey_burp.py -u https://target.com --crawl --depth 1 --max-js 50 # custom limits
- Direct —
GET /v1beta/models?key=... - Referer bypass —
Referer: https://www.google.com/on corpora endpoint - Corpora fallback — when models endpoint returns 403
Open in any browser. No build step needed.
- Password-type key input with visibility toggle
- Typing indicator — animated 3-dot bounce during generation
- Toast notifications — success/error/info popups
- Keyboard shortcuts:
Enter— send messageShift+Enter— newlineCtrl+Enter— send (alt)Ctrl+L— clear chat
- Model list — fetches available models on connect
- Empty state — branded welcome screen with shortcut hints
- Character count — status bar shows response length
python3 report_builder.py
- CVSS 3.1 scoring — 9.8 (Critical) / 8.1 (High) / 6.5 (Medium) based on capabilities
- Financial impact — per-run + hourly abuse estimate (100 req/min × 60 min)
- Evidence loader — reads
gemini_evidence/<suffix>/automatically - PoC steps — curl commands for each confirmed capability
- Interactive config — platform, target, source URL, source type
- Output —
FINAL_REPORT.mdready for platform submission
- 3+ capabilities or 2+ with Firebase/Vision/Maps/YouTube → Critical (9.8)
- 1+ capability → High (8.1)
- No confirmed capabilities → Medium (6.5)
./pipeline.sh
| # | Action | Description |
|---|---|---|
| 1 | Full Auto Pipeline | Domains → JS → validate → report (prompts depth) |
| 2 | Domain Batch Scan | Wrapper for gemisc.py mode 2 (--depth prompt) |
| 3 | JS URL Scan | Wrapper for gemisc.py mode 3 |
| 4 | Validate Keys | Shell-only validation (curl, no Python) |
| 5 | Capability Test | Single key: PoC curls + gemisc mode 5 |
| 6 | Multi-Service Scan | Wrapper for multi_scanner.py |
| 7 | Generate Report | Wrapper for report_builder.py |
| 8 | Install Dependencies | pip install -r requirements.txt |
| 0 | Exit |
Options 1 and 2 now prompt Crawl depth [2] (0-5) and forward --depth to gemisc.py. Use 2 for http://127.0.0.1:8080/ lab to discover all 20 site*/ targets.
- No Python needed for quick checks
- Tests models endpoint + corpora referer bypass
- Outputs
results/vulnerable.txt - Rate-limited (0.3s between keys)
13 rules for detecting Google API keys across languages and file types:
| # | Rule ID | Target | Severity |
|---|---|---|---|
| 1 | hardcoded-literal |
Any file with AIza pattern | ERROR |
| 2 | variable-assignment |
Key assigned to variable | ERROR |
| 3 | url-query-parameter |
key= in URLs |
ERROR |
| 4 | dotenv-exposure |
.env files with key vars |
ERROR |
| 5 | in-fetch-call-js |
fetch()/axios to googleapis.com |
ERROR |
| 6 | python-requests-hardcoded |
requests.get/post with key |
ERROR |
| 7 | firebase-config-hardcoded |
Firebase config object apiKey |
ERROR |
| 8 | google-services-json |
Android google-services.json |
ERROR |
| 9 | maps-html-script-src |
Maps JS loader <script> tag |
WARNING |
| 10 | cicd-workflow |
CI/CD config files | ERROR |
| 11 | sourcemap-or-minified |
Minified JS / source maps | ERROR |
| 12 | android-resources |
Android XML resource files | ERROR |
| 13 | header-hardcoded |
x-goog-api-key header |
ERROR |
semgrep --config rules/google_api_key_exposure.yml --error .- Placeholder keys (
YOUR_API_KEY,AIzaXXX...,INSERT_KEY_HERE) excluded - Env var usage (
os.environ,process.env) excluded - Test/dummy patterns (
test_key,sample,placeholder) excluded
nuclei -t templates/google-gemini-key.yaml -var KEY=AIza...
| # | Test | Endpoint |
|---|---|---|
| 1 | Models Liveness | GET /v1beta/models |
| 2 | File API Access | GET /v1beta/files |
| 3 | Corpora Direct | GET /v1beta/corpora |
| 4 | Corpora Referer Bypass | GET /v1beta/corpora (Referer header) |
| 5 | Text Generation | POST /v1beta/models/gemini-2.0-flash:generateContent |
| 6 | Maps Geocoding | GET /maps/api/geocode/json |
| 7 | YouTube Data | GET /youtube/v3/search |
| 8 | Cloud Vision | POST /v1/images:annotate |
Every Python tool supports both interactive prompts and CLI args for automation:
- No args → interactive menu
- Args present → non-interactive batch mode
gemisc.py and gkey_burp.py work with stdlib only when requests/bs4 unavailable:
| Library | Primary | Fallback |
|---|---|---|
| HTTP | requests (with retry) |
urllib.request |
| HTML parsing | beautifulsoup4 |
regex |
| ANSI | escape codes | no-op when not a TTY |
All CLI tools use consistent ANSI styling: banners, finding boxes, progress bars, color-coded severity. Automatically disables when output is not a TTY.
Cost estimates based on published Google API pricing:
- Gemini text output: $2.50/1M tokens
- Imagen image: $0.04/image
- TTS: $10.00/1M chars
- Veo video: $0.035/second
- Maps APIs: $0.70–$17.00/1K requests
- Vision: $1.50/1K requests
- Translate: $20.00/1M chars
- YouTube: $100/1M units
| Feature | Our Toolkit | operation-keyhunt |
|---|---|---|
| Service endpoints | 24 | 15 |
| CSV/MD export | Yes | No |
| Cost per endpoint | Yes | No |
| Multi-speaker TTS | Yes | No |
| PCM→WAV conversion | Yes (built-in) | No (ffmpeg command) |
| Progress bar | Yes | Yes |
| PoC curl generation | Yes | Yes |
| Report builder | Yes | Yes |
| Semgrep rules | 13 rules | 13 rules |
| Nuclei template | 8 tests | 8 tests |
| Pipeline orchestration | Yes | Yes |
| Shell validation | Yes | Yes |
| Service descriptions | Yes (multi_scanner) | Yes |
| Remediation text | Yes (rules) | Yes (multiservice.py) |
google-api-key-tools/
├── gemisc.py # Primary scanner (interactive + CLI)
├── multi_scanner.py # 24-endpoint multi-service scanner
├── gkey_burp.py # Burp extension + standalone CLI
├── gemini_chat.html # Browser chat interface
├── report_builder.py # Submission report generator
├── pipeline.sh # Bash orchestration pipeline
├── requirements.txt # pip dependencies
├── README.md
├── rules/
│ └── google_api_key_exposure.yml # 13 Semgrep rules
├── templates/
│ └── google-gemini-key.yaml # Nuclei validation template
├── tests/
│ └── integration_test.sh # 47-test offline validation suite
└── __pycache__/
bash tests/integration_test.sh # full 47-test suite
bash tests/integration_test.sh -v # verbose mode
PYTHONPATH=. pytest tests/ -v # 5 async unit tests (offline mock)Tests 15 categories offline (no external network calls):
- Syntax & compilation (all Python files)
--help/--versionflags- Invalid arg rejection
- KEY_RE regex pattern matching (8 cases)
- CLI arg acceptance for all tools
- ANSI auto-disable when piped
- Semgrep rule YAML + regex validation
- Nuclei template validation
- pipeline.sh syntax + menu
- File existence & README coverage
- Async httpx offline mock (
fetch_async/scan_target_async/batch_async+gkey_burpscan_url_async/scan_file_asyncwith mocked fetch)
| Scenario | Sync (requests ThreadPool 12) | Async (httpx) | Coverage |
|---|---|---|---|
Lab http://127.0.0.1:8080/ depth 2 (20 sites, 30 keys) |
3–4s | <2s (~1.4s) | 30/30 |
| Batch 100 external domains | ~60s | <30s | http-skip, Total time: retained |
| Memory Termux | — | <150MB | lightweight |
| Fallback | — | asyncio.to_thread(fetch_sync) when httpx missing (Burp Jython) |
pure stdlib |
httpx.AsyncClient(http2=True, Limits(max_connections=20, max_keepalive=20), timeout=8) + lru_cache(512) + Semaphore(20) + asyncio.gather for JS assets and page links. Verify: time python3 gemisc.py 1 -d http://127.0.0.1:8080/ --depth 2 -o /tmp/out.txt and gkey_burp.py -u http://127.0.0.1:8080/ --crawl --depth 2.
# Install dependencies
pip install -r requirements.txt --break-system-packages
# 1. Scan a target
python3 gemisc.py
# or: python3 gemisc.py 1 -d target.com
# 2. Validate found keys
python3 gemisc.py 4 -k results.txt
# 3. Capability test vulnerable keys
python3 gemisc.py 5 -k vulnerable.txt -c
# 4. Test against 24 Google services
python3 multi_scanner.py -f vulnerable.txt --csv --markdown
# 5. Generate submission report
python3 report_builder.py
# All-in-one with pipeline
./pipeline.shFor authorized bug bounty research only. All testing must be within scope of a valid bug bounty program or authorized penetration test.