bistighosh16/promptarmor-ai

GitHub: bistighosh16/promptarmor-ai

一款 AI 驱动的 LLM 提示注入检测与安全分析平台,提供威胁评分、批量扫描和红队对抗测试能力。

Stars: 0 | Forks: 0

# 🛡️ PromptArmor AI 一款 AI 驱动的安全扫描器,可检测 **10 类 prompt injection 攻击**,并提供严重性评分、批处理、攻击库、实时分析仪表板,以及用于测试防御能力的 Red Team Lab(用于生成对抗性 prompt)。 采用受 Sentry 监控美学启发的自定义 **"Toxic Bloom"** 设计系统构建。 ![Python](https://img.shields.io/badge/Python-3.11-3776AB?style=for-the-badge&logo=python&logoColor=white) ![Streamlit](https://img.shields.io/badge/Streamlit-FF4B4B?style=for-the-badge&logo=streamlit&logoColor=white) ![Groq](https://img.shields.io/badge/Groq-Llama_3.3_70B-10b981?style=for-the-badge) ![SQLite](https://img.shields.io/badge/SQLite-003B57?style=for-the-badge&logo=sqlite&logoColor=white) ![License](https://img.shields.io/badge/License-MIT-a3e635?style=for-the-badge) ### 🚀 [**启动在线演示 →**](https://promptarmor-ai.streamlit.app/) **无需注册 · 永久免费 · 30秒即可体验** ## 🎯 痛点问题 Prompt injection 是 **LLM 应用程序中的第一大安全漏洞**(OWASP LLM Top 10)。然而,大多数 AI 应用在发布时没有任何防御层。PromptArmor 让扫描、分析和防御这些攻击变得简单。 ## ✨ 功能特性 ### 🔍 单次扫描 即时 AI 驱动的威胁分析,提供: - 0-100 威胁评分 - 攻击类别分类 - 置信度评级 - 检测到的模式高亮显示 - 安全重写建议 - 缓解建议 ### 📦 批量扫描器 - 上传包含数百个 prompt 的 CSV/TXT 文件 - 带有进度追踪的批量分析 - 汇总统计数据 - 将结果导出为 CSV 或 JSON ### 📚 攻击库 **10 种攻击类别**的综合参考: - 🎯 直接注入 - 🎭 角色劫持(DAN、越狱角色) - 🎪 上下文操纵 - 📤 数据外渗 - 🔓 越狱(奶奶漏洞等) - 🔐 编码攻击(Base64、ROT13) - 🎭 社会工程学 - 🔄 递归注入 - ⚙️ 分隔符滥用 - ✅ 良性 / 安全 ### 📊 分析仪表板 - 4 个 KPI 指标 - 类别分布饼图 - 严重性细分柱状图 - 带有颜色编码标记的**威胁评分时间线** - 近期扫描表 - CSV + JSON 导出 ### 🧪 Red Team Lab - 使用 AI 生成对抗性 prompt - 测试 PromptArmor 的检出率 - 每种攻击类型 1-5 个变体 - 目标上下文自定义 - 检出率报告 ## 🛠️ 技术栈 | 层级 | 技术 | |-------|-----------| | **Frontend** | Streamlit(多页面) | | **LLM** | Groq (Llama 3.3 70B Versatile) | | **数据库** | SQLite3 | | **图表** | Plotly | | **设计** | 自定义 CSS(Toxic Bloom 主题) | | **字体** | Space Grotesk, Rubik, JetBrains Mono | ## 🎨 设计:"Toxic Bloom" 主题 受 Sentry 监控美学启发的自定义设计系统: - 🌑 深邃的 **森林墨色** 画布 (#111713) - 💚 充满活力的 **翠绿色** 主色调 (#10b981) - 🌱 标志性的 **酸橙色芯片** 关键词高亮 (#a3e635) - 🚦 语义威胁颜色(绿色/琥珀色/红色) - 🖤 双极性画布系统(深色用于扫描,浅色用于库) - ✨ 微妙的网格 + 星空背景 - 💚 自定义的“用 💚 制作”品牌标识 ## 🚀 快速开始 ### 前置条件 - Python 3.11+ - 从 [console.groq.com](https://console.groq.com/keys) 获取免费的 Groq API key ### 安装说明 ``` # Clone the repo git clone https://github.com/bistighosh16/promptarmor-ai.git cd promptarmor-ai # Create virtual environment python -m venv venv # Activate (Windows) .\venv\Scripts\activate # Activate (Mac/Linux) source venv/bin/activate # Install dependencies pip install -r requirements.txt # Set up your API key cp .env.example .env # Edit .env and add your GROQ_API_KEY # Run the app streamlit run app.py ``` 应用程序将在 `http://localhost:8501` 打开 🎉 ## 📁 项目结构 ``` promptarmor-ai/ ├── .streamlit/ │ └── config.toml ├── pages/ │ ├── 1_📦_Batch_Scanner.py │ ├── 2_📚_Attack_Library.py │ ├── 3_📊_Dashboard.py │ └── 4_🧪_Red_Team_Lab.py ├── utils/ │ ├── analyzer.py # Core AI analysis engine │ ├── database.py # SQLite operations │ ├── attack_library.py # 10 attack categories taxonomy │ └── theme.py # Toxic Bloom design system ├── data/ # SQLite DB storage ├── app.py # Main page (Single Scan) ├── requirements.txt ├── .env.example └── README.md ``` ## 🎯 适用场景 - 🛡️ **AI 应用开发者** — 为您的 LLM 应用添加防御层 - 🎓 **安全研究员** — 研究并对注入技术进行分类 - 🧪 **Red Team 成员** — 为 AI 安全审计生成测试用例 - 📚 **学生** — 通过实践探索学习 AI 安全 - 💼 **企业** — 监控并记录 prompt 安全事件 ## 📄 许可证 MIT License — 详情请参阅 [LICENSE](LICENSE)。 ## 👋 关于作者 由 **Vivi** 构建 — 热衷于 AI 安全与精美设计。 - 🌐 GitHub: [@bistighosh16](https://github.com/bistighosh16) - 💼 LinkedIn: [与我联系!](https://www.linkedin.com/in/bisti-ghosh-660488387/)
**由 Vivi 用 💚 制作** *发布更安全的 AI 应用。* 🛡️
标签:AI安全, Chat Copilot, Kubernetes, Python, Streamlit, 提示词注入检测, 无后门, 无服务器架构, 访问控制, 逆向工具