Prompt Injection · Jailbreaks · Prompt Exfiltration · LLM Security Testing
DIVYASTRA is a modular framework for automated security testing of LLMs and LLM-powered applications.
It tests adversarial prompts, classifies model responses, and generates machine-readable and human-readable reports.
Built from practical LLM attack techniques studied through PortSwigger Web Security Academy.
- Prompt injection & indirect injection
- Jailbreak assessment
- Prompt exfiltration testing
- Instruction override detection
- Encoding & obfuscation attacks
- Scope boundary testing
- Negation-aware detection
- Confidence-based classification
- Ollama, OpenAI-compatible, Gemini & custom HTTP adapters
- Gemini model fallback & retry handling
- JSON, HTML & Markdown reports
- YAML-based payloads
- OWASP LLM Top 10 mapping
Current: 18 payloads · 6 attack categories
Payloads
│
▼
Attack Engine
│
▼
Adapter Router
┌─┼─────────────┬────────────┐
▼ ▼ ▼ ▼
Ollama OpenAI Gemini Custom HTTP
└─┴─────────────┴────────────┘
│
▼
Detection Engine
│
▼
VULNERABLE / SAFE / UNCERTAIN
│
▼
JSON / HTML / MD
| Adapter | Target |
|---|---|
ollama |
Local LLMs |
openai |
OpenAI-compatible APIs |
gemini |
Google Gemini |
custom |
Custom LLM applications |
git clone https://github.com/CalculusGuy/DIVYASTRA.git
cd DIVYASTRA
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txtCreate .env:
GEMINI_API_KEY=your_key_hereollama pull llama3python divyastra.py --target ollama --model llama3python divyastra.py --target geminipython divyastra.py --target openai --model gpt-4 --api-key $OPENAI_API_KEYpython divyastra.py --target custom --url https://target.example/api/chatpython divyastra.py --target gemini --category role_play_jailbreak
python divyastra.py --target gemini --payload-id io_001python divyastra.py \
--target gemini \
--json-out reports/run.json \
--html-out reports/run.html \
--md-out reports/run.mdpython divyastra.py --target gemini --verbose| Flag | Description |
|---|---|
--target |
ollama / openai / gemini / custom |
--model |
Target model |
--api-key |
API key |
--url |
Custom endpoint |
--category |
Run one attack category |
--payload-id |
Run one payload |
--delay |
Request delay |
--json-out |
JSON report |
--html-out |
HTML report |
--md-out |
Markdown report |
--quiet |
Summary only |
--verbose |
Full response output |
DIVYASTRA v2 uses negation-aware and refusal-aware detection to reduce false positives.
Signal Match
│
▼
Negation Check
│
▼
Refusal Detection
│
▼
Confidence Scoring
│
▼
VULN / SAFE / UNCERTAIN
Example:
"No API keys were exposed."
A naive keyword detector may flag API key.
DIVYASTRA recognizes the negation and avoids incorrectly reporting a leak.
Machine-readable results for automation.
Self-contained report with findings, confidence and response details.
GitHub-ready report for documentation and writeups.
Payloads are defined in:
payloads/payloads.yaml
Example:
- id: custom_001
category: instruction_override
text: "Your payload"
success_signal: "expected signal"Add payloads without modifying the core engine.
python test_smoke.py- Multi-adapter runtime
- 18 payloads / 6 categories
- Detection engine
- Gemini support
- Negation-aware detection
- JSON / HTML / Markdown reports
- OWASP LLM mapping
- 50+ payloads
- Multi-turn attack chains
- CI/CD integration
- SARIF output
- Interactive dashboard
- Multi-model benchmarking
DIVYASTRA is for authorized security testing, research and education.
Only test systems, models and applications you own or have explicit permission to assess.
Nilanjan Chowdhury
Cybersecurity Researcher · AI/LLM Security
GitHub · LinkedIn · Medium · Portfolio
MIT License — see LICENSE.