Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AI Fraud Detection & Cyber Safety Portal

A complete web application that leverages machine learning and Generative AI (Gemini) to detect scam messages (SMS/WhatsApp) and provide real-time cybersecurity advice.

Tech Stack

  • Frontend: React.js (Vite), Tailwind CSS, Lucide Icons, Client-side JWT routing
  • Backend: Python Flask REST API, Flask-JWT-Extended, Flask-SQLAlchemy, Cryptography
  • Database: MySQL (tested, with automatic SQLite fallback for immediate out-of-the-box operation)
  • AI & Machine Learning: Scikit-learn (TF-IDF Vectorizer + Logistic Regression), Gemini 2.5 Flash REST Integration

Folder Structure

├── backend/            # Flask server, configurations, blueprints
│   ├── app.py          # Entry point and admin account seeder
│   ├── auth.py         # Registration & JWT Login router
│   ├── chatbot.py      # CyberGuard AI Chatbot & message classifier endpoints
│   ├── config.py       # Configuration parser (.env loader)
│   ├── database.py     # SQLAlchemy setups (with MySQL check/SQLite fallback)
│   ├── models.py       # User, Chat, and Report tables
│   ├── requirements.txt# Backend Python libraries
│   └── scam_detector.py# ML model interface & heuristic fallbacks
├── database/           # DDL queries
│   └── schema.sql      # Database initializing query
├── datasets/           # ML dataset training
│   ├── generate_dataset.py # Generates simulated scam logs CSV
│   └── train_model.py  # TF-IDF & Logistic Regression training pipeline
├── frontend/           # React single-page dashboard application (Vite)
│   ├── src/            # React codebase
│   │   ├── components/ # Login, Register, Chatbot, Scanner, Reporting, Admin panels
│   │   ├── api.js      # Consolidated backend HTTP handlers
│   │   ├── App.jsx     # Central layout & routing orchestrator
│   │   └── index.css   # Stylesheets & animations
│   ├── package.json    # Frontend dependency records
│   └── tailwind.config.js # Custom security dashboard styling rules
├── models/             # Output directories for trained classifiers
│   ├── scam_detector.pkl
│   └── vectorizer.pkl
└── README.md           # Project Documentation

Setup & Running the Application

1. Prerequisite Installations

Ensure you have Python 3.10+ and Node.js 18+ installed.

2. Backend Setup

  1. Open a terminal and navigate to the backend folder:

    cd backend
  2. Build the configuration .env file (already created by default):

    • Open backend/.env
    • Insert your Gemini API Key in the GEMINI_API_KEY slot.
    • Customize the MySQL credentials in DATABASE_URL. (Note: If MySQL is not running or credentials fail, the server will fall back to SQLite automatically so you can run and test immediately!)
  3. Run the Flask server:

    python app.py

    The backend will start running on http://localhost:5000.


3. Machine Learning Model Training

The project comes with a pre-trained model generated on a rich scam text dataset. If you ever want to re-train the classifier:

  1. Generate the CSV dataset:
    python datasets/generate_dataset.py
  2. Train the model:
    python datasets/train_model.py
    This will output newly updated .pkl files in the models/ folder.

4. Frontend Setup

  1. Open a new terminal and navigate to the frontend folder:
    cd frontend
  2. Install npm dependencies:
    npm install
  3. Start the dev server:
    npm run dev
    The application will boot up at http://localhost:5173.

Default Accounts

Upon launching the backend, it automatically seeds the database with a default administrator account. You can log in using these credentials to review reports and toggle case statuses:

  • Admin Username: admin
  • Admin Email: admin@fraudshield.com
  • Admin Password: admin123

About

AI-powered scam detection and cybersecurity assistant

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages