Spaces:
Build error
Build error
File size: 2,664 Bytes
781a94d b85377a 41caa46 b85377a 41caa46 b85377a 41caa46 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | ---
title: SecurityChatbot
emoji: π
colorFrom: gray
colorTo: pink
sdk: docker
pinned: false
---
# Security Awareness Chatbot ππ€
A modular, AI-powered backend that simulates social engineering attacks and provides interactive quizzes to train users on cybersecurity best practicesβall in a friendly **Egyptian Arabic** persona!
## π What Does This Bot Offer?
1. **π‘οΈ Interactive Security Assistant**
Talk to a cybersecurity expert AI. Ask any question about digital safety, and get answers in simple, casual Egyptian Arabic.
2. **π΅οΈββοΈ Social Engineering Simulation (Roleplay)**
Users can type `/train` to enter a simulated attack scenario.
- **Scenarios:** Bank employee, Delivery Courier, IT Support, WhatsApp Support, Lottery.
- **Difficulty Levels:** Easy, Medium, Hard (ranging from obvious to highly manipulative).
- **Mechanism:** The AI plays the attacker, trying to extract sensitive info. A separate AI (Evaluator) acts as a referee to catch if the user leaks data or successfully defends themselves for 4 turns.
3. **π Dynamic Cybersecurity Quizzes**
Users can choose the Quiz mode to get a dynamically generated Multiple Choice Question (MCQ) about cybersecurity topics. The bot evaluates their answer and provides a friendly explanation.
4. **β‘ High Reliability (Fallback Logic)**
Powered by OpenAI (GPT-4o-mini) and Groq (Llama-3), with built-in automatic fallback to Google Gemini (1.5-flash) if the primary models experience downtime.
---
## π Project Structure
```
securityChatbot/
βββ app/
β βββ __init__.py
β βββ main.py
β βββ core/
β β βββ __init__.py
β β βββ config.py
β β βββ prompts.py
β βββ models/
β β βββ __init__.py
β β βββ schemas.py
β βββ routers/
β β βββ __init__.py
β β βββ webhook.py
β βββ services/
β βββ __init__.py
β βββ llm_service.py
β βββ state_manager.py
βββ Dockerfile
βββ .dockerignore
βββ pyproject.toml
βββ README.md
```
## Setup & Run Locally
```bash
uv sync
uv run uvicorn app.main:app --reload --host 0.0.0.0 --port 8000
```
## API Endpoints
| Method | Path | Description |
|--------|------------|------------------------------|
| GET | `/` | Health check |
| POST | `/webhook` | Main chat endpoint |
### Webhook Payload
```json
{
"user_id": "user123",
"message": "Hello"
}
```
### Commands
- `/train` β Start the social engineering simulation
|