Kester.py — a lightweight, single-file Python tool to extract and validate API / AI / cloud keys from one input file and classify them by platform.
No external dependencies. Built on Python's standard library so it runs out-of-the-box on macOS and Windows (or inside a virtual environment).
- Reads a single input file (plain
.txtor.rtf). - Extracts many API key formats (OpenAI, Google
AIza, AWSAKIA, Groq, Ollama, DeepSeek, GitHub, and more). - Uses context heuristics and endpoint testing to separate Google-style keys into GEMINI vs GOOGLE_CLOUD when possible.
- Tests keys online where feasible (using
urllib) and classifies them asWORKING,REJECTED, orUNKNOWN. - Writes a readable log file next to the input file (default:
kester_key_check.log).
- Single-file, dependency-free Python script (
Kester.py). - Supports
.txtand.rtfinputs. - Platform-aware classification and online validation (where possible).
- Safe for local use — no external packages required.
- Easily extensible: add regexes or endpoints to support more providers.
-
Copy
Kester.pyinto a folder. -
(Optional but recommended) Create and activate a virtual environment:
python3 -m venv venv
# macOS / Linux
source venv/bin/activate
# Windows (cmd)
venv\Scripts\activate- Run the script against your file:
python Kester.py /full/path/to/your/keys.txt- The script prints results to the terminal and saves a log file next to the input file named
kester_key_check.log.
The log file is organized by platform sections, each containing three subsections:
=== PLATFORM ===
-- WORKING --
...keys...
-- REJECTED --
...keys...
-- UNKNOWN --
...keys...
Common platform headings: GEMINI, GOOGLE_CLOUD, OPENAI, AWS, GROQ, OLLAMA, DEEPSEEK, GITHUB, OTHER.
Because Google API keys share the same AIza prefix across many services, Kester.py uses a hybrid method:
- Extract all
AIza...keys and capture surrounding text. - Use context hints (variable names or nearby words like
GEMINI,AI_STUDIO,GCP,VERTEX) to make an initial guess. - Attempt a Gemini-specific endpoint test first — if it returns
200, classify as GEMINI. - If Gemini fails, try a generic Google Cloud endpoint — success means GOOGLE_CLOUD.
- If both fail, fall back to context-based guess and mark the key
REJECTEDorUNKNOWN.
This approach reduces false classifications compared to format-only matching.
- AWS keys: An AWS Access Key ID (e.g.,
AKIA...) cannot be validated without the secret access key and a signed request — Kester marks these asUNKNOWN. - Rate limits: Rapidly testing many keys may hit provider rate limits — use responsibly.
- Restricted keys: A key may exist but be limited to specific APIs or projects; tests against particular endpoints may fail even though the key is otherwise valid.
- Security: Do not commit real keys or logs to a public repo. Treat logs as sensitive data; consider redaction before sharing.
- Add new patterns in the
KEY_PATTERNSsection. - Add or change endpoints in the
ENDPOINTSmapping. - Add parallelism (thread pool) to speed up many checks.
- Export JSON/CSV summaries in addition to the human-readable log.
This project is licensed under the MIT License. See LICENSE for details.
Contributions, issues, and feature requests are welcome — open a GitHub issue or a pull request.