securityChatbot / README.md
AI Assistant
feat: add support for Gemini API and implement state management for quiz turns and answers
b85377a
|
Raw History Blame Contribute Delete
2.66 kB
metadata
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

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

{
  "user_id": "user123",
  "message": "Hello"
}

Commands

  • /train β€” Start the social engineering simulation