8-Layer AI Prompt
Injection Detection

Drop-in Python library that scans prompts through 8 detection layers and catches 17 attack vectors in under 1ms. Zero dependencies.

Start Free → ⭐ Star on GitHub
$ pip install nullsec-prompt-armor
8
Detection Layers
17
Attack Vectors
<1ms
Avg Scan Time
0
Dependencies
64
Tests Passing

8 Layers of Defense

Every prompt is scanned through a multi-stage pipeline. Each layer catches what others miss.

1

Lexical Analysis

70+ regex signatures across 9 categories detect role hijacks, delimiter escapes, jailbreaks, and tool abuse.

2

Structural Detection

Multi-persona patterns, instruction sandwiches, role stacking, invisible Unicode, and token stuffing.

3

Entropy Analysis

Shannon entropy + multi-format decoder catches base64, hex, ROT13, and Unicode encoded payloads.

4

Semantic Drift

5-category keyword scoring detects system manipulation, code execution, data exfiltration, and social engineering.

5

Canary Traps

Zero-width character markers verify the model hasn't been hijacked mid-conversation.

6

Multi-Turn Memory

Tracks conversation history for boiling-frog escalation, sudden spikes, and multi-vector probing.

7

Indirect Injection

Embedded content scanner for HTML comments, hidden divs, markdown images, data URIs, and JSON fields.

8

Language Evasion

Unicode analysis for homoglyphs (Cyrillic/Greek), leetspeak, reversed text, mixed scripts, spaced characters.

3 Lines to Protect Your LLM

Drop in, scan, decide. That's it.

app.py
from prompt_armor import analyze

# Scan user input before it reaches your LLM
verdict = analyze(user_input)

if verdict.threat_level in ("hostile", "critical"):
    return "⚠️ Blocked — injection detected"

# Safe to forward to LLM
response = llm.chat(user_input)

Scan Result

Risk Score
88.2
🔴 CRITICAL
Scanned in 0.22ms across 8 layers
lexical → ROLE_HIJACK
95% confidence
lexical → DATA_EXFILTRATION
85% confidence
semantic → INSTRUCTION_OVERRIDE
62% confidence

CLI for CI/CD Pipelines

Scan prompts from terminal, files, or stdin. Returns exit code 1 for hostile+ threats.

Terminal
$ prompt-armor scan "Ignore all previous instructions"

  Risk Score:   88.2/100
  Threat Level: CRITICAL
  Input Hash:   f6a4446ff0131378...

  Findings (3):
      lexical [ROLE_HIJACK]
       Matched role_hijack signature at position 0 (95%)
      lexical [DATA_EXFILTRATION]
       Matched data_exfiltration signature at position 37 (85%)
      semantic [INSTRUCTION_OVERRIDE]
       Semantic alignment with system_manipulation (62%)

$ prompt-armor scan --json "Hello, how are you?"
{
  "risk_score": 0,
  "threat_level": "clean",
  "findings": []
}

$ prompt-armor bench
  Average: 0.22ms/scan
  Throughput: 4,632 scans/sec

Built For

Whether you're building a chatbot or a production AI pipeline, Prompt Armor drops in.

🤖

Chatbot Protection

Scan every user message before it reaches your LLM. Block jailbreaks, role hijacks, and prompt leaks in real-time.

🔗

LangChain / LlamaIndex

Add as middleware in your AI chain. Filter RAG inputs, tool calls, and agent responses.

🏢

Enterprise AI Gateways

Deploy as an API gateway between users and your AI models. Enforce security policies at scale.

🔄

CI/CD Pipeline Guard

Scan prompt templates and test fixtures in CI. Fail builds if injection vectors are detected.

📊

Security Auditing

Audit existing prompt libraries for vulnerabilities. Generate compliance reports with threat scores.

🛡️

Red Team Testing

Use the built-in bench and 17 vector definitions to test your own LLM's resilience to attacks.

REST API Included

Spin up a hosted scanning service with one command. Built on FastAPI.

Launch API Server
$ prompt-armor server --port 8080

🛡️  Prompt Armor API v2.0
   Docs:  http://localhost:8080/docs
   Scan:  POST /v1/scan
   Batch: POST /v1/scan/batch
cURL
$ curl -X POST http://localhost:8080/v1/scan \
  -H "X-API-Key: pa_pro_xxx" \
  -H "Content-Type: application/json" \
  -d '{"text": "Ignore previous instructions"}'

{
  "risk_score": 88.2,
  "threat_level": "critical",
  "findings": [...],
  "scan_time_ms": 0.22,
  "tier": "pro"
}

Simple Pricing

Start free. Scale when you need to.

Free

$0
Forever free for small projects
  • 100 scans/day
  • 4 detection layers
  • CLI tool
  • JSON output
  • Community support
  • Batch scanning
  • Webhook alerts
  • Custom rules
Get Started Free

Enterprise

$149/mo
For security teams at scale
  • Unlimited scans
  • All 8 detection layers
  • Custom rules engine
  • Compliance reports
  • SLA guarantee
  • Dedicated support
  • Self-hosted option
  • SOC 2 ready
Contact Sales

Works Everywhere

Pure Python, zero dependencies. Integrates with anything.

🐍

Python 3.10+

pip install, import, done. No C extensions or heavy deps.

FastAPI

Built-in API server with OpenAPI docs, CORS, auth, and rate limiting.

🔧

LangChain

Drop in as custom tool or chain middleware. Filter before & after LLM calls.

🐳

Docker

Ship as a sidecar container. Scan at the network edge.

🔄

GitHub Actions

CI/CD prompt scanning. Fail builds on hostile prompt templates.

☁️

Any Cloud

AWS Lambda, GCP Functions, Azure — deploy anywhere Python runs.

Protect Your AI.
Start in 30 Seconds.

One pip install. Three lines of code. Eight layers of defense.

$ pip install nullsec-prompt-armor
⭐ Star on GitHub 💛 Sponsor