Skip to content

PhishGuard AI emphasizes interpretability by clearly highlighting specific lexical, structural, and domain anomalies that contribute to phishing classifications, empowering users with deeper understanding of threats.

Notifications You must be signed in to change notification settings

Jasmine5220/PhishGuardAI

Repository files navigation

PhishGuard AI

Project Overview

PhishGuard AI is a sophisticated AI-powered system designed to combat phishing threats through three core components:

  1. Machine Learning-based URL Analysis
  2. Natural Language Processing (NLP) for Email Classification
  3. Explainable AI (XAI) for Transparent Decision-making

The solution is delivered through a robust Flask backend and a user-friendly Chrome Extension, ensuring real-time detection capabilities and enhanced user awareness.

Key Differentiator: Explainable AI

Unlike conventional "black-box" approaches, PhishGuard AI emphasizes interpretability by clearly highlighting specific lexical, structural, and domain anomalies that contribute to phishing classifications, empowering users with deeper understanding of threats.

System Architecture

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Chrome        │    │   Flask         │    │   ML Models     │
│   Extension     │◄──►│   Backend       │◄──►│   (Email/URL)   │
│                 │    │                 │    │                 │
└─────────────────┘    └─────────────────┘    └─────────────────┘
         │                       │                       │
         │                       │                       │
         ▼                       ▼                       ▼
┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Real-time     │    │   REST API      │    │   Pre-trained    │
│   Analysis      │    │   Endpoints     │    │   Models        │
└─────────────────┘    └─────────────────┘    └─────────────────┘

File Structure (Frontend)

frontend/
├── app.py                          # Flask backend API
├── requirements.txt                # Python dependencies
├── templates/
│   └── index.html                  # Web dashboard UI
└── chrome-extension/
    ├── manifest.json              # Extension configuration
    ├── background.js               # Service worker
    ├── content.js                  # Content script for email analysis
    ├── popup.html                  # Extension popup UI
    ├── popup.js                    # Popup functionality
    └── README.md                   # Installation guide

Features Implemented

1. Flask Backend API (app.py)

Core Functionality:

  • Email content analysis with heuristic and ML-based detection
  • URL analysis with lexical, structural, and domain anomaly detection
  • Combined analysis for comprehensive threat assessment
  • Explainable AI with detailed reasoning for each decision

API Endpoints:

  • POST /api/analyze_email - Analyze email content
  • POST /api/analyze_url - Analyze URLs for phishing
  • POST /api/analyze_combined - Combined email and URL analysis
  • GET /api/health - Health check endpoint
  • GET /api/explanations - Get explanation guidelines

Key Features:

  • Risk scoring (0-100%) with confidence levels
  • Detailed explanations for flagged content
  • Support for multiple email datasets
  • Real-time analysis capabilities

2. Web Dashboard (templates/index.html)

User Interface:

  • Modern, responsive design with Bootstrap 5
  • Real-time analysis demo interface
  • Feature showcase with visual indicators
  • Chrome extension integration information

Functionality:

  • Email content input and analysis
  • URL scanning capabilities
  • Visual risk indicators with color coding
  • Detailed explanation display
  • Sample phishing email examples

3. Chrome Extension

Manifest V3 Compliance:

  • Modern Chrome extension architecture
  • Secure permissions model
  • Service worker-based background processing

Content Script (content.js):

  • Real-time email analysis on Gmail and Outlook
  • Automatic URL extraction and scanning
  • Visual badges for risk indicators
  • Interactive analysis panels with detailed explanations

Background Script (background.js):

  • API communication with Flask backend
  • Settings management and storage
  • Notification handling for phishing alerts
  • Tab monitoring for email platforms

Popup Interface (popup.html):

  • Extension status and controls
  • Quick analysis functionality
  • Settings toggles for protection and notifications
  • Direct access to web dashboard

Technical Implementation

Email Analysis Features

Heuristic Detection:

  • Urgency indicators detection
  • Financial terms analysis
  • Suspicious phrase identification
  • Grammar and spelling error detection

ML Integration:

  • TF-IDF vectorization for text processing
  • SVM-based classification (96.28% accuracy)
  • Feature importance analysis
  • Cross-validation for model stability

URL Analysis Features

Structural Analysis:

  • URL length and complexity assessment
  • Domain name analysis
  • Subdomain counting
  • Special character detection

Security Indicators:

  • HTTPS presence verification
  • IP address detection
  • Suspicious keyword identification
  • Port number analysis

Explainable AI Implementation

Transparency Features:

  • Clear risk score explanations
  • Specific indicator highlighting
  • Educational content about phishing techniques
  • Visual representation of threat factors

User Education:

  • Detailed explanations for each decision
  • Learning opportunities about phishing tactics
  • Best practices recommendations
  • Threat awareness enhancement

Installation and Setup

1. Flask Backend Setup

cd frontend
pip install -r requirements.txt
python app.py

2. Chrome Extension Installation

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable "Developer mode"
  3. Click "Load unpacked" and select the chrome-extension folder
  4. Configure extension settings in the popup

3. System Requirements

  • Python 3.8+
  • Chrome browser (version 88+)
  • Flask server running on localhost:5000

Performance Metrics

Model Performance

  • Email Classification Accuracy: 96.28%
  • Cross-validation Score: 96.24% ± 0.15%
  • False Positive Rate: 4.7%
  • False Negative Rate: 2.8%

System Performance

  • Real-time Analysis: < 2 seconds per email
  • URL Scanning: < 1 second per URL
  • Memory Usage: Minimal impact on browser performance
  • API Response Time: < 500ms average

Security and Privacy

Data Protection

  • All analysis performed locally
  • No external data transmission
  • Email content processed in memory only
  • Secure API communication

Privacy Features

  • No user data storage
  • Anonymous analysis processing
  • Local model execution
  • Transparent data handling

Conclusion

PhishGuard AI successfully implements a comprehensive phishing detection system with:

  • High Accuracy: 96.28% classification accuracy
  • Real-time Protection: Instant analysis of emails and URLs
  • Explainable AI: Transparent decision-making process
  • User-friendly Interface: Intuitive Chrome extension and web dashboard
  • Privacy-focused Design: Local processing with no data collection

The system provides a solid foundation for phishing protection while educating users about threat indicators and security best practices.

About

PhishGuard AI emphasizes interpretability by clearly highlighting specific lexical, structural, and domain anomalies that contribute to phishing classifications, empowering users with deeper understanding of threats.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •