A machine learning-based system to detect phishing emails directly within Gmail. This project consists of a Python backend API and a Chrome Extension that scans emails in real-time and alerts users automatically.
- π‘οΈ Real-time phishing detection inside Gmail
- π€ Machine learning models trained with Random Forest and SGD classifiers
- π RESTful Flask backend for predictions
- π Chrome Extension with content and background scripts
- π Data preprocessing and feature extraction pipeline
- β‘ Fast response times for email scanning
- Python 3.10+
- Flask - RESTful API framework
- Scikit-learn - Machine learning library
- JavaScript - Chrome Extension
- Random Forest & SGD - ML algorithms
Phishing-detection/
βββ BackendRest.py # Flask API server
βββ TeachMLM.py # ML model training script
βββ Preproccess_data.py # Data cleaning & vectorization
βββ manifest.json # Chrome extension manifest
βββ background.js # Extension background script
βββ content.js # Extension content script
βββ data/ # Preprocessed datasets
βββ models/ # Trained ML models
βββ requirements.txt # Python dependencies
βββ .env.example # Environment variables template
βββ LICENSE # MIT License
- Python 3.10 or later
- Chrome browser
- Git
- pip (Python package manager)
git clone https://github.com/the3y3-code/Phishing-detection.git
cd Phishing-detectionpip install -r requirements.txtCopy the example environment file and customize if needed:
cp .env.example .envIf you want to retrain the models with your own dataset:
- Place your dataset CSV file (e.g.,
Phishing_validation_emails.csv) in the project root. - Run preprocessing:
python Preproccess_data.py- Train the models:
python TeachMLM.pyStart the Flask API server:
python BackendRest.pyThe server will be accessible at http://localhost:5000.
- Open Chrome and navigate to
chrome://extensions/ - Enable Developer mode (toggle in top right)
- Click Load unpacked
- Select the
Phishing-detectionproject directory
- Ensure the backend server is running
- Open Gmail in your browser
- The extension will automatically scan incoming emails
- Alerts will appear if phishing attempts are detected
To run tests (if implemented):
pytest tests/Predicts if an email is phishing or legitimate.
Request:
{
"email_content": "Your email text here"
}Response:
{
"prediction": "phishing" | "legitimate",
"confidence": 0.95
}Contributions are welcome! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Please read CONTRIBUTING.md for details on our code of conduct and development process.
- Add deep learning models (LSTM, BERT)
- Support for multiple email providers
- Mobile app version
- Real-time threat intelligence integration
- Multi-language support
This project is licensed under the MIT License - see the LICENSE file for details.
- Scikit-learn community for ML tools
- Flask framework contributors
- Chrome Extensions documentation
the3y3-code - GitHub Profile
Project Link: https://github.com/the3y3-code/Phishing-detection
β If you find this project useful, please consider giving it a star!