Skip to content

dvinix/PhishShield

Repository files navigation

πŸ›‘οΈ PhishShield - Advanced Spam & Fraud Detection System

PhishShield Logo

Python PyTorch Streamlit License Accuracy

A sophisticated AI-powered system for detecting spam messages, financial fraud, and phishing attempts in real-time

Designed to combat modern scams including Jamtara-style financial fraud schemes

πŸš€ Quick Start β€’ πŸ“Š Features β€’ πŸ› οΈ Installation β€’ πŸ“± Usage β€’ πŸ“ˆ Roadmap


🌟 Overview

PhishShield is a comprehensive fraud detection system that combines machine learning with rule-based detection to identify harmful messages with high accuracy. The system specifically targets modern fraud schemes like those seen in Jamtara-style scams, providing real-time protection against:

  • πŸ’³ Financial Fraud (Banking, UPI, loan scams)
  • 🎣 Phishing Attempts (Credential theft, fake offers)
  • πŸ“§ Traditional Spam (Unwanted marketing, malicious content)
  • πŸ“± SMS Fraud (OTP theft, fake alerts)

πŸ“Š Features

🧠 Hybrid AI Detection

  • Neural Network: 97% accuracy on spam detection
  • Rule-Based Engine: 30+ financial fraud patterns
  • Pattern Recognition: URLs, money amounts, fraud keywords
  • Real-Time Analysis: Instant fraud scoring

🎯 Advanced Detection Capabilities

Feature Description Coverage
πŸ’° Financial Keywords Banking, UPI, card-related terms 25+ patterns
🎣 Phishing Indicators Urgency, fake offers, social engineering 20+ patterns
πŸ”— URL Detection Malicious domains, shortened links 7+ patterns
⏰ Time Pressure Urgency manipulation tactics Real-time detection
πŸ’Έ Money Mentions Currency amounts in messages Multi-currency

🌐 User Interface

  • Web-Based Dashboard: Streamlit-powered interface
  • Binary Classification: Simple SPAM vs LEGITIMATE results
  • Detailed Analysis: Risk breakdown and explanations
  • Example Library: Pre-loaded test cases
  • Safety Guidelines: Built-in fraud protection tips

πŸ› οΈ Installation

πŸ“‹ Prerequisites

  • Python 3.7+ (Recommended: Python 3.9+)
  • pip package manager
  • Git (for cloning the repository)

πŸš€ Quick Setup

Method 1: Automated Installation (Recommended)

# Clone the repository
git clone https://github.com/divinixx/PhishShield.git
cd PhishShield

# Run automated setup (Windows)
run_phishshield.bat

# Or use Python setup script
python setup_and_run.py

Method 2: Manual Installation

# 1. Clone the repository
git clone https://github.com/divinixx/PhishShield.git
cd PhishShield

# 2. Install dependencies
pip install -r requirements.txt

# 3. Train the model (if not already trained)
python spam.py

# 4. Launch the application
streamlit run app.py

πŸ“¦ Required Libraries

streamlit>=1.25.0
torch>=2.0.1
scikit-learn>=1.3.0
nltk>=3.8.1
pandas>=2.0.3
numpy>=1.24.3
joblib>=1.3.2

πŸ“± Usage

πŸ–₯️ Web Interface

  1. Start the application:

    streamlit run app.py
  2. Open your browser to http://localhost:8501

  3. Analyze messages:

    • Enter any message in the text area
    • Click "πŸ” Analyze Message"
    • View binary classification result
    • Check detailed fraud analysis

πŸ§ͺ Testing & Validation

# Test fraud detection with sample messages
python test_fraud_detection.py

# Verify system components
python -c "from app import load_model_components; print('βœ… All components loaded successfully!')"

πŸ“Š Example Results

❌ SPAM Detection

Input: "Dear customer, your debit card will be blocked within 2 hrs. Call 9876543210 to reactivate."

Output:
🚨 SPAM DETECTED (90% confidence)
πŸ“Š Fraud Risk Score: 100%
πŸ’³ Financial Keywords: debit card, reactivate
οΏ½ Suspicious Content: Phone number detected
⏰ Time Pressure: within 2 hrs

βœ… LEGITIMATE Detection

Input: "Hi! Are we still meeting for lunch tomorrow at 12pm?"

Output:
βœ… LEGITIMATE MESSAGE (95% confidence)
πŸ“Š Fraud Risk Score: 0%
ℹ️ No suspicious patterns detected

🎯 Detection Examples

🚨 Financial Fraud Examples
Message Type Example Detection
Banking Fraud "Your account is blocked. Call 9876543210 immediately!" βœ… SPAM
Loan Scam "Pre-approved loan of β‚Ή5,00,000. Apply: http://scam-site.com" βœ… SPAM
Prize Scam "You won iPhone! Pay β‚Ή99 shipping: http://fake-apple.com" βœ… SPAM
OTP Theft "Share OTP 123456 to verify your account immediately" βœ… SPAM
βœ… Legitimate Message Examples
Message Type Example Detection
Personal "Hi! Are we meeting for lunch tomorrow?" βœ… LEGITIMATE
Business "Team meeting at 3 PM in conference room B" βœ… LEGITIMATE
Appointments "Doctor visit reminder: Friday at 3pm" βœ… LEGITIMATE
Delivery "Package will be delivered between 10 AM - 2 PM" βœ… LEGITIMATE

πŸ—οΈ Architecture

🧠 Model Architecture

Input Message
     ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Rule-Based      β”‚    β”‚ ML Classificationβ”‚
β”‚ Fraud Analysis  β”‚    β”‚ (Neural Network) β”‚
β”‚                 β”‚    β”‚                  β”‚
β”‚ β€’ Financial     β”‚    β”‚ β€’ TF-IDF         β”‚
β”‚ β€’ Phishing      β”‚    β”‚ β€’ 5000 features  β”‚
β”‚ β€’ URLs          β”‚    β”‚ β€’ 128β†’64β†’2       β”‚
β”‚ β€’ Keywords      β”‚    β”‚ β€’ PyTorch        β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     ↓                       ↓
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚         Confidence Fusion               β”‚
β”‚    (Hybrid Decision Engine)             β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
     ↓
Final Classification: SPAM / LEGITIMATE

πŸ”§ Technical Stack

  • Backend: Python 3.9+
  • ML Framework: PyTorch 2.0+
  • Feature Engineering: Scikit-learn, NLTK
  • Web Interface: Streamlit
  • Data Processing: Pandas, NumPy
  • Model Persistence: JobLib

πŸ“ Project Structure

PhishShield/
β”œβ”€β”€ πŸ“„ app.py                    # Main Streamlit application
β”œβ”€β”€ 🧠 spam.py                   # Model training script
β”œβ”€β”€ πŸ“Š spam.csv                  # Training dataset
β”œβ”€β”€ πŸ”§ requirements.txt          # Python dependencies
β”œβ”€β”€ πŸš€ run_phishshield.bat      # Windows launcher
β”œβ”€β”€ πŸ› οΈ setup_and_run.py         # Automated setup script
β”œβ”€β”€ πŸ§ͺ test_fraud_detection.py   # Testing utilities
β”œβ”€β”€ πŸ“š README.md                 # Project documentation
└── πŸ€– Model Files/
    β”œβ”€β”€ spam_classifier.pth      # Trained neural network
    β”œβ”€β”€ tfidf_vectorizer.pkl     # TF-IDF vectorizer
    └── label_encoder.pkl        # Label encoder

⚑ Performance Metrics

Metric Score Description
Overall Accuracy 97% General spam detection accuracy
Financial Fraud Detection 95%+ Specialized fraud pattern detection
False Positive Rate <3% Legitimate messages marked as spam
Processing Speed <100ms Average analysis time per message
Model Size ~2.5MB Compact for deployment

πŸ”’ Security Features

πŸ›‘οΈ Fraud Protection

  • Multi-layer Detection: ML + Rule-based validation
  • Real-time Scoring: Instant risk assessment
  • Pattern Recognition: Advanced fraud indicators
  • Educational Alerts: Built-in safety guidelines

πŸ“‹ Safety Guidelines

  • ❌ Never share: PIN, OTP, passwords via SMS
  • βœ… Always verify: Requests through official channels
  • 🚨 Report fraud: Suspicious messages to authorities
  • πŸ›‘οΈ Stay informed: Keep updated on latest scam tactics

πŸ“ˆ Roadmap

🎯 Upcoming Features

  • πŸ“± Mobile App: React Native mobile application
  • 🌐 Multi-language: Hindi, Tamil, Telugu support
  • πŸ”Š Voice Analysis: Audio message fraud detection
  • πŸ“ž Call Integration: Real-time call analysis
  • πŸ€– Advanced AI: Transformer-based models
  • πŸ“Š Analytics Dashboard: Fraud trend analysis
  • πŸ”Œ API Integration: RESTful API for third-party apps

🏒 Enterprise Features

  • πŸ‘₯ Team Management: Multi-user support
  • πŸ“ˆ Reporting: Advanced analytics and insights
  • πŸ”’ Enterprise Security: Enhanced data protection
  • ⚑ High Performance: Scalable cloud deployment

This is a personal project created by divinixx for educational and research purposes.


⭐ Star this repository if PhishShield helped protect you from fraud! ⭐

PhishShield Python

πŸ›‘οΈ Protecting users from fraud, one message at a time πŸ›‘οΈ


πŸ“Š Usage Analytics

GitHub stars GitHub forks GitHub issues GitHub pull requests

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published