Ptector is a URL-based anti-phishing Chrome extension developed as a CS204 - interconnection of CPS course project at SMU.
It detects phishing websites in real time using a ML model and provides immediate feedback through a browser extension.
default.mp4
- Real-time URL analysis
- Machine learning-based phishing detection
- Detailed analysis popup
![]() Safe Website |
![]() Phishing Detected |
The project consists of three main components:
-
Chrome Extension
- Content scripts for webpage interaction
- Background service worker
- Popup interface for results display
-
Flask Backend
- REST API for URL analysis
- Integration with ML model
- Page rank and Google index checking
-
Machine Learning
-
CNN (Raw URL-based)
Initially trained a CNN model directly on raw URL strings, achieving approximately 92% accuracy.
This approach captured character-level patterns but lacked interpretability and flexibility. -
DNN (Feature-based)
Switched to a feature-based DNN after identifying the need for explicit learning of URL characteristics.
This improved performance to approximately 95% accuracy by leveraging structured URL features. -
Random Forest (Final Model)
Due to the limited dataset size and model complexity, a Random Forest model was selected as the final approach.
Applied feature importance-based feature selection, achieving 94% accuracy with significantly faster inference, making it more suitable for real-time browser usage.
- Install Python dependencies:
- Run
cd flask-backendto navigate to the backend directory. - Set-up python virtual environment
py -3.11 -m venv .venv - Activate the virtual environment with
source .venv/bin/activate - Install dependencies with
python -m pip install -r requirements.txt
- Set up environment variables:
- Create
.envfile in flask-backend directory - Copy the code and replace
# API Keys OPENPAGE_API_KEY=<your_openpage_api_key> # Google Index API Key GOOGLE_API_KEY=<your_google_api_key> GOOGLE_SEARCH_ENGINE_ID=<your_google_search_engine_id>
- Steps to get required API keys
-
OpenPage Rank API
- Visit OpenPageRank : https://www.domcop.com/openpagerank/
- Create an account/Sign up
- Navigate to API dashboard
- Replace
<your_openpage_api_key>in.envwith your actual API key
-
Google API Key
- Go to Google Cloud Console : https://console.cloud.google.com/
- Create new project/Select existing project
- Go to "APIs & Services" > "Library"
- Enable "Custom Search API"
- Go to "Credentials"
- Create API Key (Create Credentials > API Key)
- Replace
<your_google_api_key>in.envwith your actual API key
-
Google Search Engine ID
- Go to Programmable Search Engine : https://programmablesearchengine.google.com/
- Click "Create Search Engine"
- Configure settings:
- Set search engine name
- Use "*" for all sites
- Click "Create" to finalize the setup
- Copy
Search Engine IDand replace<your_google_search_engine_id>in.env
- Load the Chrome extension:
- Open Chrome extensions page
- Enable Developer mode
- Click "Load unpacked"
- Select the /chromeExtension directory
- Start the Flask backend:
- Run
cd flask-backendto navigate to the backend directory. - Start the app with
python app.py. - Enjoy the extension!
- Run
MIT License
Copyright (c) 2024 banchan_01
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

