This repository contains the codebase for PhishShield, a machine learning project designed to detect phishing URLs through a browser extension.
- Python 3.12.x (64-bit)
-
Install Python
Download and install Python 3.12.x from the official website:
👉 https://www.python.org/downloads/ (Skip if already installed) -
Clone Repository
- Download and install Git Bash from the offical website: 👉 https://git-scm.com/downloads (Skip if already installed)
- Click
Cloneand copy URL to clipbord. - Open Command Prompt (CMD):
git clone https://github.com/dayeizz/PhishShield.git
OR
- Click
Cloneand clickDownload ZIP.
-
Set Up Virtual Environment
OpenCMDand run:C:\[project_path]\PhishShield python -m venv venv venv\Scripts\activate python -m pip install --upgrade pip pip install -r requirements.txt
-
Configure Python Interpreter in VSCode
- Press
Ctrl + Shift + Pto open Command Palette. - Search: Python: Select Interpreter
- Click Enter interpreter path…
- Browse to:
C:\[project_path]\PhishShield\venv\Scripts\python.exe
- Press
-
Select Kernel (for Jupyter Notebooks)
- Click "Select Kernel" (top right of the notebook interface).
- Click Python environment.
- Choose:
venv\Scripts\python.exe
-
Follow the steps on this guide to generate a Google Safe Browsing API key.
-
Open the
Utils.pyfile and add the API key as shown in the image below:
-
Open Chrome and navigate to:
chrome://extensions -
Enable Developer Mode.
-
Click Load unpacked.
-
Select:
C:\[project_path]\PhishShield\frontend
-
The extension will appear in Chrome. Click the red marked to activate:
- Start the FastAPI server. Open
CMDand run:cd C:\[project_path]\PhishShield\api python -m uvicorn app:app --reload
- To stop the server. Press
Ctrl + Cin the CMD, or close theCMDwindow. - If you encounter repeated errors such as
400 Bad Requeston multiple websites, check theCMDwindow for any error messages. If no issues are found there, stop the server andrestartthe PC.
PhishShield/
│
├── api/
│ ├── API.py
│ ├── app.py
│ ├── xgb.pkl
│ ├── report.json
│ ├── UrlData.py
│ └── Utils.py
│
├── asset/
│ ├── alert.png
│ ├── API.png
│ ├── badrequest.png
│ ├── detail.png
│ ├── extension.png
│ ├── forbidden.png
│ ├── input.png
│ ├── internal server.png
│ ├── main.png
│ ├── phishing.png
│ ├── save.png
│ └── suspicious.png
│
├── frontend/
│ ├── css/
│ │ ├── app.css
│ │ ├── bootstrap.min.css
│ │ └── style.css
│ │
│ ├── icons/
│ │ ├── 16x16.png
│ │ ├── 32x32.png
│ │ ├── 48x48.png
│ │ └── 128x124.png
│ │
│ ├── js/
│ │ ├── detail.js
│ │ ├── index.js
│ │ ├── input.js
│ │ └── jquery.min.js
│ │
│ ├── detail.html
│ ├── header.html
│ ├── index.html
│ ├── input.html
│ └── manifest.json
│
├── Notebook/
│ ├── Dataset_Processing.ipynb
│ ├── testing_training.ipynb
│ ├── url_dataset_processed.csv
│ └── url_dataset.csv
│
├── README.md
└── requirements.txt
This part includes a step-by-step video guide to the process.
This repository is a browser extension for PhishShield: URL Phishing Detection using Machine Learning. The goal is to classify URLs as phishing, suspicious, or safe. In the Notebook folder, I perform data preprocessing, training, and testing, ultimately selecting the XGBoost Classifier model as the best-performing model with 96% accuracy.
In the API.py file, I implemented a scoring mechanism to mitigate false positives and negatives. The base score starts at 100, and deductions are made based on 10 attributes, including the model's prediction. For example, if the model detects phishing, 40 points are deducted from the score, and further deductions are made based on attribute changes.
In the index.js, details.js, and input.js files, the final score is classified as:
-
Safe if the score is above 70
-
Suspicious if the score is between 50 and 70
-
Phishing if the score is below 50.
The communication between the front-end and back-end is handled using FastAPI and AJAX, implemented in the back-end app.py and in the front-end index.js, details.js, and input.js.
The system extracts 17 features for machine learning, including entropyDomain, entropyurl, longUrl,suspiciousExtension, countDepth, countDot, hasHttps, suspiciousTld, suspiciousDomain, validateUrl, suspiciousWord, longDomain, hypenDomain, countDigitURL, countDigitDomain,openRedirect, and uppercaseUrl.
The scoring mechanism with 10 attributes include checkLegitimacy, unshortenUrl, suspiciousDomain, whoisData, checkGoogleSafeBrowsing, dnsBlacklist, domainActive, sslCertificate, ipAddressLocation, and isURLMalicious.
This system consists of three main modules. The first is the main module, where activating the extension will automatically scan the URL of the currently active browser tab.
The second is the detail module, which generates a comprehensive report based on the URL prediction. This report includes details such as the URL itself, domain name, model confidence, IP address, location, server name, similarity domain, domain age, SSL certificate status, DNS blacklist status, and Google Web Safe status.
Lastly, there is the input module, which allows users to manually enter a URL.
For further reading, you can cite my article in the journal here. Please note that the article describes a web-based tool a bit different from this project framework.







